本文整理匯總了PHP中IPSMember::isInGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::isInGroup方法的具體用法?PHP IPSMember::isInGroup怎麽用?PHP IPSMember::isInGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::isInGroup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: warning
public function warning($member)
{
if (!ipsRegistry::$settings['warn_on']) {
return false;
}
if (ipsRegistry::$settings['warn_protected']) {
if (IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
return false;
}
}
return true;
}
示例2: userCanViewAds
/**
* Checks to see if the specified member group can view ads
*
* @access public
*
* @param integer $group_id Group to check
* @return bool
*/
public function userCanViewAds()
{
/* Check to see if the system is globally disabled */
if (!ipsRegistry::$settings['ad_code_global_enabled']) {
return false;
}
/* Check to see if this member group can view ads */
if (ipsRegistry::$settings['ad_code_exempt_groups']) {
if (IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', ipsRegistry::$settings['ad_code_exempt_groups']))) {
return false;
}
}
return true;
}
示例3: parseOnlineEntries
/**
* Parse/format the online list data for the records
*
* @author Brandon Farber
* @param array Online list rows to check against
* @return array Online list rows parsed
*/
public function parseOnlineEntries($rows)
{
if (!is_array($rows) or !count($rows)) {
return $rows;
}
//-----------------------------------------
// Init
//-----------------------------------------
$forums_raw = array();
$forums = array();
$topics_raw = array();
$topics = array();
$posts_raw = array();
$posts = array();
$final = array();
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] != 'forums' or !$row['current_module']) {
continue;
}
if ($row['current_section'] == 'forums') {
$forums_raw[$row['location_2_id']] = '';
} else {
if ($row['current_section'] == 'topics') {
$topics_raw[$row['location_1_id']] = $row['location_1_id'];
} else {
if ($row['current_section'] == 'post') {
$forums_raw[$row['location_2_id']] = '';
$topics_raw[$row['location_1_id']] = $row['location_1_id'];
}
}
}
}
//-----------------------------------------
// Get the forums, if you dare
//-----------------------------------------
ipsRegistry::getAppClass('forums');
if (count($forums_raw)) {
foreach (ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum) {
if (isset($forums_raw[$fid])) {
if (ipsRegistry::getClass('permissions')->check('view', $forum) !== false) {
$forums[$fid] = $forum['name'];
}
}
}
}
//-----------------------------------------
// Get the topics, if you care
//-----------------------------------------
if (count($topics_raw)) {
$_approved = ipsRegistry::getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
ipsRegistry::DB()->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.tid IN(' . implode(',', $topics_raw) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'), 'add_join' => array(array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'", 'type' => 'left'))));
$tr = ipsRegistry::DB()->execute();
while ($r = ipsRegistry::DB()->fetch($tr)) {
$_forum = ipsRegistry::getClass('class_forums')->getForumByid($r['forum_id']);
if (count($_forum) and ipsRegistry::getClass('class_forums')->forumsCheckAccess($_forum['id'], false, 'topic', $r, true)) {
if (ipsRegistry::getClass('permissions')->check('read', $_forum) !== false) {
if ($_forum['password'] == '' or IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', $_forum['password_override'])) or IPSCookie::get("ipbforumpass_{$_forum['id']}") == md5($_forum['password'])) {
$topics[$r['tid']] = $r['title'];
}
}
}
}
}
//-----------------------------------------
// Put humpty dumpty together again
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] != 'forums') {
$final[$row['id']] = $row;
continue;
}
if (!$row['current_module']) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['board_index'];
$final[$row['id']] = $row;
continue;
}
if ($row['current_section'] == 'forums') {
if (isset($forums[$row['location_2_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_sf'];
$row['where_line_more'] = $forums[$row['location_2_id']];
$row['where_link'] = 'showforum=' . $row['location_2_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
}
} else {
if ($row['current_section'] == 'topics') {
if (isset($topics[$row['location_1_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_st'];
$row['where_line_more'] = $topics[$row['location_1_id']];
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
//.........這裏部分代碼省略.........
示例4: can
/**
* Perform a permission check
*
* @param string Type of check (add/edit/delete/editall/deleteall/approve all)
* @param array Array of GENERIC data
* @return true or string to be used in exception
*/
public function can($type, array $array)
{
/* Init */
$comment = array();
/* Got data? */
if (empty($array['comment_parent_id'])) {
trigger_error("No parent ID passed to " . __FILE__, E_USER_WARNING);
}
/* Get the file */
$event = $this->fetchParent($array['comment_parent_id']);
/* Fetch comment */
if ($array['comment_id']) {
$comment = $this->fetchById($array['comment_id']);
}
/* Check permissions */
switch ($type) {
case 'view':
if (!$this->registry->permissions->check('view', $event)) {
return 'NO_PERMISSION';
}
if ($event['event_private'] and (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id'])) {
return 'NO_PERMISSION';
}
if ($event['event_perms'] != '*') {
$permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
return 'NO_PERMISSION';
}
}
return true;
break;
case 'edit':
if (!$this->registry->permissions->check('comment', $event)) {
return 'NO_PERMISSION';
}
if (!$this->memberData['g_is_supmod'] and ($this->memberData['member_id'] != $comment['comment_author_id'] or !$comment['comment_author_id'])) {
return 'NO_PERMISSION';
}
return true;
break;
case 'add':
if (!$this->registry->permissions->check('comment', $event)) {
return 'NO_PERMISSION';
}
return true;
break;
case 'delete':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'visibility':
case 'moderate':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'hide':
return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_HIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
break;
case 'unhide':
return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_UNHIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
break;
}
}
示例5: calendarShowEvent
/**
* Show a single event based on eventid
*
* @return @e void
*/
public function calendarShowEvent()
{
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = intval($this->request['event_id']);
if (!$event_id) {
$this->registry->output->showError('calendar_event_not_found', 10429, null, null, 404);
}
//-----------------------------------------
// Get the event data
//-----------------------------------------
$_joins = array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=e.event_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'));
if ($this->settings['reputation_enabled']) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
$this->registry->setClass('repCache', new $classToLoad());
$_joins[] = $this->registry->getClass('repCache')->getTotalRatingJoin('event_id', $event_id, 'calendar');
$_joins[] = $this->registry->getClass('repCache')->getUserHasRatedJoin('event_id', $event_id, 'calendar');
}
$event = $this->DB->buildAndFetch(array('select' => 'e.*', 'from' => array('cal_events' => 'e'), 'where' => 'e.event_id=' . $event_id, 'add_join' => $_joins));
if (!$event['event_id']) {
$this->registry->output->showError('calendar_event_not_found', 10430, null, null, 404);
}
//-----------------------------------------
// Reset calendar
//-----------------------------------------
$this->calendar = $this->functions->getCalendar($event['event_calendar_id']);
if ($this->calendar['cal_id'] != $event['event_calendar_id']) {
$this->registry->output->showError('cal_no_perm', 1040.22, null, null, 403);
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if ($event['event_private'] and $this->memberData['member_id'] != $event['event_member_id']) {
$this->registry->output->showError('calendar_event_not_found', 10431, null, null, 403);
}
if (!$this->memberData['g_is_supmod'] and !$event['event_approved']) {
$this->registry->output->showError('calendar_event_not_found', 10432.1, null, null, 404);
}
if ($event['event_perms'] != '*') {
$permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
$this->registry->output->showError('calendar_event_not_found', 10432, null, null, 404);
}
}
//-----------------------------------------
// Are we RSVPing?
//-----------------------------------------
if ($this->request['_rsvp'] and $event['event_rsvp']) {
if ($this->registry->permissions->check('rsvp', $this->calendar) and $this->memberData['member_id']) {
//-----------------------------------------
// Make sure we aren't already RSVPed
//-----------------------------------------
$_check = $this->DB->buildAndFetch(array('select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id']));
if (!$_check['rsvp_id']) {
$_insert = array('rsvp_event_id' => $event['event_id'], 'rsvp_member_id' => $this->memberData['member_id'], 'rsvp_date' => time());
$this->DB->insert('cal_event_rsvp', $_insert);
$this->registry->output->redirectScreen($this->lang->words['rsvp_saved_im'], $this->settings['base_url'] . "app=calendar&module=calendar&section=view&do=showevent&event_id=" . $event['event_id'], $event['event_title_seo'], 'cal_event');
}
}
}
//-----------------------------------------
// Comments class
//-----------------------------------------
require_once IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php';
/*noLibHook*/
$this->_comments = classes_comments_bootstrap::controller('calendar-events');
$comments = array('html' => $this->_comments->fetchFormatted($event, array('offset' => intval($this->request['st']))), 'count' => $this->_comments->count($event));
//-----------------------------------------
// Highlight...
//-----------------------------------------
if ($this->request['hl']) {
$event['event_content'] = IPSText::searchHighlight($event['event_content'], $this->request['hl']);
$event['event_title'] = IPSText::searchHighlight($event['event_title'], $this->request['hl']);
}
//-----------------------------------------
// Can we report?
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary', 'core');
$reports = new $classToLoad($this->registry);
$event['_canReport'] = $reports->canReport('calendar');
//-----------------------------------------
// Output
//-----------------------------------------
$member = IPSMember::load($event['event_member_id'], 'all');
$this->registry->output->addNavigation($this->calendar['cal_title'], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}", $this->calendar['cal_title_seo'], 'cal_calendar');
//-----------------------------------------
// Try to match out and improve navigation
//-----------------------------------------
$_referrer = $_SERVER['HTTP_REFERER'];
if ($_referrer) {
//-----------------------------------------
// Came from add form?
//-----------------------------------------
if (preg_match("#/add\$#", $_referrer)) {
//.........這裏部分代碼省略.........
示例6: getUpcomingEvents
/**
* Retrieve upcoming events
*
* @return string
*/
public function getUpcomingEvents()
{
//-----------------------------------------
// Make sure calendar app is installed
//-----------------------------------------
if (!$this->settings['show_calendar'] or !IPSLib::appIsInstalled('calendar')) {
return '';
}
//-----------------------------------------
// Get current date data
//-----------------------------------------
$a = explode(',', gmdate('Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset()));
$day = $a[2];
$month = $a[1];
$year = $a[0];
//-----------------------------------------
// Check calendar limit
//-----------------------------------------
$this->settings['calendar_limit'] = intval($this->settings['calendar_limit']) < 2 ? 1 : intval($this->settings['calendar_limit']);
$our_unix = gmmktime(0, 0, 0, $month, $day, $year);
$max_date = $our_unix + $this->settings['calendar_limit'] * 86400;
$events = array();
$show_events = array();
//-----------------------------------------
// Loop over the cache
//-----------------------------------------
if (is_array($this->caches['calendar_events']) and count($this->caches['calendar_events'])) {
foreach ($this->caches['calendar_events'] as $u) {
//-----------------------------------------
// Private?
//-----------------------------------------
if ($u['event_private'] == 1 and $this->memberData['member_id'] != $u['event_member_id']) {
continue;
}
//-----------------------------------------
// Got perms?
//-----------------------------------------
if ($u['event_perms'] != '*') {
$permissionGroups = explode(',', IPSText::cleanPermString($u['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
continue;
}
}
//-----------------------------------------
// Got calendar perms?
//-----------------------------------------
if (!$this->registry->permissions->check('view', $u)) {
continue;
}
//-----------------------------------------
// Times and dates
//-----------------------------------------
$u['isoDate'] = gmdate('c', strtotime($u['event_start_date']));
$u['_start_time'] = strtotime($u['event_start_date']);
$u['_end_time'] = ($u['event_end_date'] and $u['event_end_date'] != '0000-00-00 00:00:00') ? strtotime($u['event_end_date']) : 0;
if (!$u['event_all_day']) {
if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
$u['_start_time'] = $u['_start_time'] + $this->memberData['time_offset'] * 3600;
} else {
if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
$u['_start_time'] = $u['_start_time'] + $this->settings['time_offset'] * 3600;
}
}
if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
$u['_end_time'] = $u['_end_time'] ? $u['_end_time'] + $this->memberData['time_offset'] * 3600 : 0;
} else {
if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
$u['_end_time'] = $u['_end_time'] ? $u['_end_time'] + $this->settings['time_offset'] * 3600 : 0;
}
}
}
//-----------------------------------------
// In range?
//-----------------------------------------
if (!$u['event_recurring'] and ($u['_end_time'] >= $our_unix and $u['_start_time'] <= $max_date or !$u['_end_time'] and $u['_start_time'] >= $our_unix and $u['_start_time'] <= $max_date)) {
if ($u['_end_time']) {
if ($u['_start_time'] < gmmktime(0)) {
$u['_start_time'] = gmmktime(0);
}
}
$events[str_pad($u['_start_time'] . $u['event_id'], 15, "0")] = $u;
} elseif ($u['event_recurring'] > 0) {
$cust_range_s = $u['_start_time'];
while ($cust_range_s <= $u['_end_time']) {
if ($cust_range_s >= $our_unix and $cust_range_s <= $max_date) {
//-----------------------------------------
// Special case for "monthly" to ensure it lands on the same day
//-----------------------------------------
if ($u['event_recurring'] != 1) {
$u['_start_time'] = gmmktime(1, 1, 1, gmdate('n', $cust_range_s), gmdate('j', $u['_start_time']), gmdate('Y', $cust_range_s));
} else {
$u['_start_time'] = $cust_range_s;
}
$events[str_pad($u['_start_time'] . $u['event_id'], 15, "0")] = $u;
}
//.........這裏部分代碼省略.........
示例7: __f__cdf08cf85f92ef8ef4013206021a0615
function __f__cdf08cf85f92ef8ef4013206021a0615($links, $title = '', $url = '', $cssClass = 'topic_share left')
{
$_ips___x_retval = '';
$__iteratorCount = 0;
foreach ($links as $id => $data) {
$__iteratorCount++;
$_ips___x_retval .= "\n\t\t" . (($data['share_enabled'] and ($data['share_groups'] == '*' or IPSMember::isInGroup($this->memberData, explode(',', $data['share_groups'])))) ? "" . (($data['customOutput'] and is_array($data['customOutput'])) ? "\n\t\t\t\t" . $this->registry->output->getTemplate($data['customOutput'][0])->{$data}['customOutput'][1]($data['_rawUrl'], $title, $data['customOutput'][2]) . "\n\t\t\t" : "<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("sharelink={$data['share_key']};{$data['_url']};{$title}", "public", ''), "", "") . "" . ($data['overrideApp'] ? "&overrideApp={$data['overrideApp']}" : "") . "\" rel=\"nofollow\" target=\"_blank\" title=\"" . (isset($this->lang->words['gbl_sharelink_with_' . $data['share_key']]) ? "{$this->lang->words['gbl_sharelink_with_' . $data['share_key']]}" : "{$this->lang->words['gbl_sharelink_with']} {$data['share_title']}") . "\" class='_slink' id='slink_{$data['share_key']}'><img src=\"{$this->settings['public_cdn_url']}style_extra/sharelinks/{$data['share_key']}.png\" /></a></li>") . "" : "") . "\n\t\n";
}
$_ips___x_retval .= '';
unset($__iteratorCount);
return $_ips___x_retval;
}
示例8: share
/**
* Share the link.
*
* @access public
* @param string Document title
* @param string Document URL
*/
public function share($title, $url)
{
/* Disabled? */
if (!$this->settings['sl_enable']) {
return false;
}
/* Permission Check */
$cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
if ($cache[$this->_pluginKey]['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache[$this->_pluginKey]['share_groups']))) {
return false;
}
/* Ensure title is correctly de-html-ized */
$title = IPSText::UNhtmlspecialchars($title);
if (is_object($this->_plugin)) {
/* Grab URL details */
$data = $this->deconstructUrl($url);
/* Requires a permission check? */
if ($data['data_app'] and method_exists($this->_plugin, 'requiresPermissionCheck')) {
if ($this->_plugin->requiresPermissionCheck($data) !== false) {
$_file = IPSLib::getAppDir($data['data_app']) . '/extensions/coreExtensions.php';
$_result = false;
/* Check for the file */
if (is_file($_file)) {
/* Get the file */
$_class = IPSLib::loadLibrary($_file, $data['data_app'] . 'ShareLinks', $data['data_app']);
/* Check for the class */
if (class_exists($_class)) {
/* Create an object */
$_obj = new $_class();
/* Check for the module */
if (method_exists($_obj, 'permissionCheck')) {
if ($_obj->permissionCheck($data) !== false) {
$_result = true;
}
}
}
}
if ($_result === false) {
$this->registry->getClass('output')->showError('no_permission');
}
}
}
/* Log it */
$this->log($url, $title, $data);
/* In almost all cases, there is no data to return as the plugin
redirects or posts an action */
$this->_plugin->share($title, $url);
}
return false;
}
示例9: forumsCheckAccess
/**
* Check Forum Access
*
* @param integer $fid Forum id
* @param bool $prompt_login Prompt login/show error
* @param string $in [topic|forum]
* @param array $topic Topic data
* @param bool $return Return instead of displaying an error
* @return bool
*/
public function forumsCheckAccess($fid, $prompt_login = 0, $in = 'forum', $topic = array(), $return = false)
{
$fid = intval($fid);
$deny_access = 1;
/* Pass it along */
$this->registry->permissions->setMemberData($this->getMemberData());
if ($this->registry->permissions->check('view', $this->allForums[$fid]) == TRUE) {
if ($this->registry->permissions->check('read', $this->allForums[$fid]) == TRUE) {
$deny_access = 0;
} else {
//-----------------------------------------
// Can see topics?
//-----------------------------------------
if ($this->allForums[$fid]['permission_showtopic']) {
$this->read_topic_only = 1;
if ($in == 'forum') {
$deny_access = 0;
} else {
if ($return) {
return false;
}
$this->forumsCustomError($fid);
$deny_access = 1;
}
} else {
if ($return) {
return false;
}
$this->forumsCustomError($fid);
$deny_access = 1;
}
}
} else {
if ($return) {
return false;
}
$this->forumsCustomError($fid);
$deny_access = 1;
}
/* Reset member data after use */
$this->registry->permissions->setMemberData($this->memberData);
//-----------------------------------------
// Do we have permission to even see the password page?
//-----------------------------------------
if ($deny_access == 0) {
$group_exempt = 0;
if (isset($this->allForums[$fid]['password']) and $this->allForums[$fid]['password'] != '' and $this->allForums[$fid]['sub_can_post']) {
if (isset($this->allForums[$fid]['password_override']) && IPSText::cleanPermString($this->allForums[$fid]['password_override']) != '') {
if (IPSMember::isInGroup($this->_memberData, explode(",", IPSText::cleanPermString($this->allForums[$fid]['password_override'])))) {
$group_exempt = 1;
$deny_access = 0;
}
}
if ($group_exempt == 0) {
if ($this->forumsComparePassword($fid) == TRUE) {
$deny_access = 0;
} else {
$deny_access = 1;
if ($prompt_login == 1) {
if ($return) {
return false;
}
$this->forumsShowLogin($fid);
}
}
}
}
}
if (is_array($topic) && count($topic)) {
if (!$this->_memberData['g_other_topics'] and $topic['starter_id'] != $this->_memberData['member_id']) {
if ($return) {
return false;
}
$this->registry->getClass('output')->showError('forums_no_view_topic', 103136, null, null, 404);
} else {
if (!$this->allForums[$fid]['can_view_others'] and !$this->_memberData['is_mod'] and $topic['starter_id'] != $this->_memberData['member_id']) {
if ($return) {
return false;
}
$this->registry->getClass('output')->showError('forums_no_view_topic', 103137, null, null, 404);
}
}
}
if ($this->allForums[$fid]['min_posts_view'] && $this->allForums[$fid]['min_posts_view'] > $this->_memberData['posts'] && !$this->_memberData['g_is_supmod']) {
if ($return) {
return false;
}
$this->registry->getClass('output')->showError('forums_not_enough_posts', 103138, null, null, 403);
}
if ($deny_access == 1) {
//.........這裏部分代碼省略.........
示例10: _showLeaders
/**
* Show the forum leaders
*
* @return @e void [Outputs to screen]
*/
protected function _showLeaders()
{
/* Load language */
$this->lang->loadLanguageFile(array('public_online', 'public_profile'), 'members');
/* Init */
$st = intval($this->request['st']);
$perpage = 25;
$group_ids = array();
$member_ids = array();
$members = array();
$forumsMembers = array();
$pagination = '';
$mids = array();
$location_info = array();
$whereClause = array();
/* Work out who our super mods / mods aer */
foreach ($this->cache->getCache('group_cache') as $i) {
if ($i['g_is_supmod']) {
$group_ids[$i['g_id']] = '*';
} elseif ($i['g_access_cp']) {
$group_ids[$i['g_id']] = array();
}
}
$modCache = $this->cache->getCache('moderators');
$modCache = is_array($modCache) && count($modCache) ? $modCache : array();
foreach ($modCache as $i) {
if ($i['is_group'] && !$this->caches['group_cache'][$i['group_id']]['gbw_hide_leaders_page']) {
if (isset($group_ids[$i['group_id']])) {
if (is_array($group_ids[$i['group_id']])) {
$group_ids[$i['group_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
}
} else {
$group_ids[$i['group_id']] = array($i['forum_id'] => ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name']);
}
} else {
if ($i['member_id']) {
$member_ids[$i['member_id']] = $i['member_id'];
$forumsMembers[$i['member_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
}
}
}
/* Custom Fields */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
$custom_fields_class = new $classToLoad();
//-----------------------------------------
// Get em
//-----------------------------------------
/* Got groups? */
if (count($group_ids)) {
$whereClause[] = $this->DB->buildWherePermission(array_keys($group_ids), 'm.member_group_id', FALSE);
}
/* Got members? */
if (count($member_ids)) {
$whereClause[] = $this->DB->buildWherePermission(array_keys($member_ids), 'm.member_id', FALSE);
}
/* So we got something? If not skip the whole thing.. */
if (count($whereClause)) {
/* Get a count */
$count = $this->DB->buildAndFetch(array('select' => 'count(*) as dracula', 'from' => array('members' => 'm'), 'where' => implode(' OR ', $whereClause)));
if ($count['dracula']) {
/* Sort out pagination */
$pagination = $this->registry->output->generatePagination(array('totalItems' => $count['dracula'], 'itemsPerPage' => $perpage, 'currentStartValue' => $st, 'baseUrl' => "app=forums&module=extras§ion=stats&do=leaders"));
/* Fetch the ones we want */
$this->DB->build(array('select' => 'm.*, m.member_id as my_member_id', 'from' => array('members' => 'm'), 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left')), 'where' => implode(' OR ', $whereClause), 'order' => 'm.members_display_name', 'limit' => array($st, $perpage)));
$e = $this->DB->execute();
while ($r = $this->DB->fetch($e)) {
/* Reset member ID just in case.. */
$r['member_id'] = $r['my_member_id'];
$members[$r['member_id']] = IPSMember::buildDisplayData($r);
}
/* Now fetch session data */
$this->DB->build(array('select' => '*', 'from' => 'sessions', 'where' => 'member_id IN (' . implode(',', array_keys($members)) . ')'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
if (!$r['id'] or IPSMember::isLoggedInAnon($members[$r['member_id']])) {
$location_info[$r['member_id']] = '';
} else {
$location_info[$r['member_id']] = IPSMember::getLocation($r);
}
}
//-----------------------------------------
// Display
//-----------------------------------------
foreach ($members as $k => $member) {
$forums = isset($member_ids[$member['member_id']]) ? $member_ids[$member['member_id']] : array();
if ($forums == '*') {
$forums = $this->lang->words['leader_all_forums'];
} else {
$forums = array();
foreach ($group_ids as $gid => $fs) {
if (IPSMember::isInGroup($member, $gid)) {
if ($fs == '*') {
$forums = $this->lang->words['leader_all_forums'];
break;
} else {
//.........這裏部分代碼省略.........
示例11: markMembersAsSpam
/**
* Marks member(s) as spam
*
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
* @param array Array of member ids
* @return string Confirmation message
*/
public function markMembersAsSpam($ids)
{
/* Grab members */
$members = IPSMember::load($ids);
/* Load moderator's library */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
$modLibrary = new $classToLoad($this->registry);
/* Load custom profile fields class */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
$fields = new $classToLoad();
/* Load language file */
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_mod'), 'forums');
/* Cycle all members */
foreach ($members as $member_id => $member) {
/* Protected group? */
if (IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
continue;
}
/**
* Update member group and then flag as spammer,
* we're removing them from the validating queue anyway
*
* We must run this query here before they're flagged as spammer because
* the 'onProfileUpdate' member sync call could edit further their group
*/
$this->DB->update('members', array('member_group_id' => $this->settings['member_group']), 'member_id=' . $member['member_id']);
$member['member_group_id'] = $this->settings['member_group'];
# Change group here too to reflect the update just in case
IPSMember::flagMemberAsSpammer($member, $this->memberData, FALSE);
}
/* Remove validating rows */
$this->DB->delete('validating', "member_id IN (" . implode(",", $ids) . ")");
/* Reset last member */
IPSMember::resetLastRegisteredMember();
$message = sprintf($this->lang->words['t_setasspammers'], count($ids));
ipsRegistry::getClass('adminFunctions')->saveAdminLog($message);
return $message;
}
示例12: buildDisplayData
//.........這裏部分代碼省略.........
$member['member_rank_img_i'] = 'pips';
$member['member_rank_img'] = $member['member_rank_img'] . ipsRegistry::getClass('output')->getReplacement('pip_pip');
}
} else {
$member['member_rank_img_i'] = 'img';
$member['member_rank_img'] = ipsRegistry::$settings['public_dir'] . 'style_extra/team_icons/' . $pips;
}
}
}
//-----------------------------------------
// Moderator data
//-----------------------------------------
if (($parseFlags['spamStatus'] or $parseFlags['warn']) and $member['member_id']) {
/* Possible forums class isn't init at this point */
if (!ipsRegistry::isClassLoaded('class_forums')) {
try {
$viewingMember = IPSMember::setUpModerator(ipsRegistry::member()->fetchMemberData());
ipsRegistry::member()->setProperty('forumsModeratorData', $viewingMember['forumsModeratorData']);
} catch (Exception $error) {
IPS_exception_error($error);
}
}
$moderator = ipsRegistry::member()->getProperty('forumsModeratorData');
}
$forum_id = isset(ipsRegistry::$request['f']) ? intval(ipsRegistry::$request['f']) : 0;
//-----------------------------------------
// Spammer status
//-----------------------------------------
if ($parseFlags['spamStatus'] and $member['member_id'] and ipsRegistry::member()->getProperty('member_id')) {
/* Defaults */
$member['spamStatus'] = NULL;
$member['spamImage'] = NULL;
if (!empty($moderator[$forum_id]['bw_flag_spammers']) or ipsRegistry::member()->getProperty('g_is_supmod')) {
if (!ipsRegistry::$settings['warn_on'] or !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
if ($member['bw_is_spammer']) {
$member['spamStatus'] = TRUE;
} else {
$member['spamStatus'] = FALSE;
}
}
}
}
//-----------------------------------------
// Warny porny?
//-----------------------------------------
$member['show_warn'] = FALSE;
if ($parseFlags['warn'] and $member['member_id']) {
if (ipsRegistry::$settings['warn_on'] and !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
/* Warnings */
if (!empty($moderator[$forum_id]['allow_warn']) or ipsRegistry::member()->getProperty('g_is_supmod') or ipsRegistry::$settings['warn_show_own'] and ipsRegistry::member()->getProperty('member_id') == $member['member_id']) {
$member['show_warn'] = TRUE;
} else {
if (is_array($moderator) && count($moderator) && !$forum_id) {
foreach ($moderator as $forum) {
if ($forum['allow_warn']) {
$member['show_warn'] = TRUE;
break;
}
}
}
}
}
}
//-----------------------------------------
// Profile fields stuff
//-----------------------------------------
示例13: parseOnlineEntries
/**
* Parse/format the online list data for the records
*
* @access public
* @author Brandon Farber
* @param array Online list rows to check against
* @return array Online list rows parsed
*/
public function parseOnlineEntries($rows)
{
if (!is_array($rows) or !count($rows)) {
return $rows;
}
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_calendar'), 'calendar');
//-----------------------------------------
// Init
//-----------------------------------------
$cals_raw = array();
$cals = array();
$events_raw = array();
$events = array();
$final = array();
//-----------------------------------------
// Extract the data
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] != 'calendar' or !$row['current_module']) {
continue;
}
if ($row['location_1_type'] == 'event') {
$events_raw[$row['location_1_id']] = $row['location_1_id'];
} else {
if ($row['location_1_type'] == 'calendar') {
$cals_raw[$row['location_1_id']] = $row['location_1_id'];
}
}
}
//-----------------------------------------
// Get calendars
//-----------------------------------------
$calendars = ipsRegistry::cache()->getCache('calendars');
if (count($cals_raw)) {
foreach ($calendars as $cid => $calendar) {
if (isset($cals_raw[$cid])) {
if (ipsRegistry::getClass('permissions')->check('view', $calendar)) {
$cals[$cid] = $calendar;
}
}
}
}
//-----------------------------------------
// And events
//-----------------------------------------
if (count($events_raw)) {
ipsRegistry::DB()->build(array('select' => 'event_id, event_title, event_title_seo, event_calendar_id, event_approved, event_private, event_perms', 'from' => 'cal_events', 'where' => 'event_id IN(' . implode(',', $events_raw) . ')'));
$tr = ipsRegistry::DB()->execute();
while ($r = ipsRegistry::DB()->fetch($tr)) {
if (ipsRegistry::getClass('permissions')->check('view', $calendars[$r['event_calendar_id']])) {
if ($r['event_private'] and $this->memberData['member_id'] != $r['event_member_id']) {
continue;
}
if (!$this->memberData['g_is_supmod'] and !$r['event_approved']) {
continue;
}
if ($r['event_perms'] != '*') {
$permissionGroups = explode(',', IPSText::cleanPermString($r['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
continue;
}
}
$events[$r['event_id']] = $r;
}
}
}
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] == 'calendar') {
if ($row['location_1_type'] == 'event' and isset($events[$row['location_1_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['cal_event_ol'];
$row['where_line_more'] = $events[$row['location_1_id']]['event_title'];
$row['where_link'] = "app=calendar&module=calendar&section=view&do=showevent&event_id={$events[$row['location_1_id']]['event_id']}";
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $events[$row['location_1_id']]['event_title_seo'], 'cal_event');
} else {
if ($row['location_1_type'] == 'calendar' and isset($cals[$row['location_1_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['cal_calendar_ol'];
$row['where_line_more'] = $cals[$row['location_1_id']]['cal_title'];
$row['where_link'] = "app=calendar&module=calendar&section=view&cal_id={$cals[$row['location_1_id']]['cal_id']}";
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $cals[$row['location_1_id']]['cal_title_seo'], 'cal_calendar');
} else {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_calendar'];
$row['where_link'] = 'app=calendar';
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl('app=calendar', 'public', 'false', 'app=calendar');
}
}
}
$final[$row['id']] = $row;
}
return $final;
//.........這裏部分代碼省略.........
示例14: _setAsSpammer
/**
* Flag a user account as a spammer
*
* @return @e void
*/
protected function _setAsSpammer()
{
//-----------------------------------------
// Init
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$toSave = array('core' => array('bw_is_spammer' => 1));
$topicId = intval($this->request['t']);
$topic = array();
if ($topicId) {
$topic = $this->DB->buildAndFetch(array('select' => 'tid, title_seo, forum_id', 'from' => 'topics', 'where' => 'tid=' . $topicId));
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load($member_id);
if (!$member['member_id']) {
$this->registry->output->showError('moderate_no_permission', 10311900, true, null, 404);
}
if (!$this->memberData['g_access_cp'] and $member['g_access_cp']) {
return $this->registry->getClass('output')->getTemplate('modcp')->modcpMessage($this->lang->words['mod_cannot_edit_admin']);
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if (!$this->memberData['g_is_supmod'] and !$this->memberData['forumsModeratorData'][$topic['forum_id']]['bw_flag_spammers']) {
$this->registry->output->showError('moderate_no_permission', 103119, true, null, 403);
}
if (IPSMember::isInGroup($member, explode(',', $this->settings['warn_protected']))) {
$this->registry->output->showError('moderate_no_permission', 10311901, true, null, 403);
}
if ($this->request['auth_key'] != $this->member->form_hash) {
$this->registry->output->showError('moderate_no_permission', 10311902, null, null, 403);
}
//-----------------------------------------
// Do it
//-----------------------------------------
IPSMember::flagMemberAsSpammer($member, $this->memberData);
//-----------------------------------------
// Redirect
//-----------------------------------------
if ($topicId) {
$this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showtopic=" . $topic['tid'] . "&st=" . intval($this->request['st']), $topic['title_seo'], 'showtopic');
} else {
$this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showuser=" . $member['member_id'], $member['members_seo_name'], 'showuser');
}
}
示例15: doExecute
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute(ipsRegistry $registry)
{
/* Disabled? */
if (!$this->settings['sl_enable']) {
$this->registry->output->showError('forward_turned_off', 103240.1);
}
/* Permission Check */
$cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
if ($cache['email']['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache['email']['share_groups']))) {
$this->registry->output->showError('forward_turned_off', 103240.2);
}
//-----------------------------------------
// Grab skin and lang stuff
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_emails'), 'core');
/* Via URL and topic title? */
if ($this->request['url'] and $this->request['title']) {
$this->page['url'] = IPSText::parseCleanValue(IPSText::base64_decode_urlSafe($this->request['url']));
$this->page['title'] = IPSText::parseCleanValue(urldecode($this->request['title']));
} else {
//-----------------------------------------
// Check the input
//-----------------------------------------
$this->request['t'] = intval($this->request['t']);
$this->request['f'] = intval($this->request['f']);
if (!$this->request['t']) {
$this->registry->output->showError('forward_no_tid', 10321);
}
//-----------------------------------------
// Get the topic details
//-----------------------------------------
$this->topic = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t']));
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[$this->topic['forum_id']];
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if (!$this->forum['id']) {
$this->registry->output->showError('forward_no_fid', 10322);
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if (!$this->topic['tid']) {
$this->registry->output->showError('forward_no_tid', 10323);
}
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if (!$this->memberData['member_id']) {
$this->registry->output->showError('forward_only_members', 10324);
}
ipsRegistry::getClass('class_forums')->forumsCheckAccess($this->forum['id']);
}
/* last check */
if (!$this->topic['tid'] and !$this->page['url']) {
$this->registry->output->showError('forward_no_tid', 10323.2);
}
/* Ok, I lied. Is this share entry enabled? */
$cache = ipsRegistry::cache()->getCache('sharelinks');
if (!is_array($cache['email']) or !$cache['email']['share_enabled']) {
$this->registry->output->showError('forward_turned_off', 103240);
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ($this->request['do'] == '01') {
$this->_sendEmail();
} else {
$this->_showForm();
}
}