本文整理匯總了PHP中IPSMember::setUpGuest方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::setUpGuest方法的具體用法?PHP IPSMember::setUpGuest怎麽用?PHP IPSMember::setUpGuest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::setUpGuest方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setMemberData
/**
* @param string key
* @param string value
*/
public function setMemberData($k, $v = '')
{
if (is_integer($k)) {
$this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k, 'all');
} else {
if (is_string($k) && $k == intval($k)) {
$this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k, 'all');
} else {
if (is_array($k)) {
$this->_memberData = $k;
} else {
if (!empty($k)) {
$this->_memberData[$k] = $v;
}
}
}
}
/* Set perm ids and that */
if ($this->memberData['member_id'] == $this->_memberData['member_id']) {
$this->_memberData['_perm_id_array'] = $this->member->perm_id_array;
} else {
/* Force to guest for now */
$permId = !empty($this->_memberData['org_perm_id']) ? $this->_memberData['org_perm_id'] : $this->_memberData['g_perm_id'];
$this->_memberData['_perm_id_array'] = array_unique(explode(",", $permId));
}
}
示例2: process
/**
* Process Results
*
* @param array Row from database using query specified in fetch()
* @return array Same data with any additional processing necessary
*/
public function process($row)
{
/* Build poster's display data */
$member = $row['author_id'] ? IPSMember::load($row['author_id'], 'profile_portal,pfields_content,sessions,groups', 'id') : IPSMember::setUpGuest();
$row = array_merge($row, IPSMember::buildDisplayData($member, array('reputation' => 0, 'warn' => 0)));
/* Get forum data (damn HTML >.<) */
$forumData = ipsRegistry::getClass('class_forums')->getForumById($row['forum_id']);
/* Parse BBCode */
IPSText::getTextClass('bbcode')->parse_smilies = $row['use_emo'];
IPSText::getTextClass('bbcode')->parse_html = ($forumData['use_html'] and $member['g_dohtml'] and $row['post_htmlstate']) ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others'];
$row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['post']);
/* Parse attachments */
$messageHTML = array($row['pid'] => $row['post']);
$attachHTML = $this->class_attach->renderAttachments($messageHTML, array($row['pid']));
if (is_array($attachHTML) and count($attachHTML)) {
/* Get rid of any lingering attachment tags */
if (stristr($attachHTML[$row['pid']]['html'], "[attachment=")) {
$attachHTML[$row['pid']]['html'] = IPSText::stripAttachTag($attachHTML[$row['pid']]['html']);
}
$row['post'] = $attachHTML[$row['pid']]['html'] . $attachHTML[$row['pid']]['attachmentHtml'];
}
/* Get rep buttons */
if ($row['repUserGiving'] == ipsRegistry::member()->getProperty('member_id')) {
$row['has_given_rep'] = $row['rep_rating'];
}
$row['rep_points'] = ipsRegistry::getClass('repCache')->getRepPoints(array('app' => 'forums', 'type' => 'pid', 'type_id' => $row['pid'], 'rep_points' => $row['rep_points']));
$row['repButtons'] = ipsRegistry::getClass('repCache')->getLikeFormatted(array('app' => 'forums', 'type' => 'pid', 'id' => $row['pid'], 'rep_like_cache' => $row['rep_like_cache']));
/* Return */
return $row;
}
示例3: doExecute
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Get member data and format
//-----------------------------------------
$user = intval($this->request['user']);
$id = intval($this->request['id']);
if (!$user) {
$this->returnString("no");
}
if ($id) {
$member = IPSMember::buildDisplayData(IPSMember::load($id));
} else {
$member = IPSMember::buildDisplayData(IPSMember::setUpGuest($this->lang->words['global_guestname'] . "_" . $user));
}
//-----------------------------------------
// Mod permissions
//-----------------------------------------
$my_groups = array($this->memberData['member_group_id']);
if ($this->memberData['mgroup_others']) {
$my_groups = array_merge($my_groups, explode(",", IPSText::cleanPermString($this->memberData['mgroup_others'])));
}
$permissions = 0;
$private = 0;
if ($this->settings['ipschat_mods']) {
$mod_groups = explode(",", $this->settings['ipschat_mods']);
foreach ($my_groups as $group_id) {
if (in_array($group_id, $mod_groups)) {
$permissions = 1;
break;
}
}
}
if ($this->settings['ipschat_private']) {
$mod_groups = explode(",", $this->settings['ipschat_private']);
foreach ($my_groups as $group_id) {
if (in_array($group_id, $mod_groups)) {
$private = 1;
break;
}
}
}
//-----------------------------------------
// Return output
//-----------------------------------------
$this->returnJsonArray(array('html' => ipsRegistry::getClass('output')->replaceMacros($this->registry->getClass('output')->getTemplate('ipchat')->ajaxNewUser(array('user_id' => $user, 'moderator' => $permissions, 'private' => $private, 'member' => $member))), 'prefix' => $this->settings['ipschat_format_names'] ? str_replace('"', '__DBQ__', $member['prefix']) : '', 'suffix' => $this->settings['ipschat_format_names'] ? str_replace('"', '__DBQ__', $member['suffix']) : '', 'pp_small_photo' => $member['pp_small_photo'], 'name' => $member['members_display_name'], '_canBeIgnored' => $member['member_id'] ? $member['_canBeIgnored'] : 1, 'g_id' => $member['g_id']));
}
示例4: setMemberData
/**
* @param string key
* @param string value
*/
public function setMemberData($k, $v = '')
{
if (is_integer($k)) {
$this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k);
} else {
if (is_string($k) && $k == intval($k)) {
$this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k);
} else {
if (is_array($k)) {
$this->_memberData = $k;
} else {
if (!empty($k)) {
$this->_memberData[$k] = $v;
}
}
}
}
$this->_memberData = IPSMember::setUpModerator($this->_memberData);
}
示例5: __construct
/**
* Constructor :: Authorizes the session
*
* @access public
* @return mixed Void normally, but can print error message
*/
public function __construct()
{
/* Make object */
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->_member = self::instance();
$this->_memberData =& self::instance()->fetchMemberData();
/* Delete immediately */
$this->_deleteNow = true;
/**
* If the sso.php file is present in this folder, we'll load it.
* This file can be used to easily integrate single-sign on in
* situations where you need to check session data
*/
if (file_exists(IPS_ROOT_PATH . '/sources/classes/session/sso.php')) {
require_once IPS_ROOT_PATH . '/sources/classes/session/sso.php';
if (class_exists("ssoSessionExtension")) {
$this->sso = new ssoSessionExtension($this->registry);
}
}
//-----------------------------------------
// INIT
//-----------------------------------------
$cookie = array();
$this->_userAgent = substr($this->_member->user_agent, 0, 200);
//-----------------------------------------
// Fix up app / section / module
//-----------------------------------------
$this->current_appcomponent = IPS_APP_COMPONENT;
$this->current_module = IPSText::alphanumericalClean($this->request['module']);
$this->current_section = IPSText::alphanumericalClean($this->request['section']);
$this->settings['session_expiration'] = $this->settings['session_expiration'] ? $this->settings['session_expiration'] : 3600;
//-----------------------------------------
// Return as guest if running a task
//-----------------------------------------
if (IPS_IS_TASK) {
self::$data_store = IPSMember::setUpGuest();
self::$data_store['last_activity'] = time();
self::$data_store['last_visit'] = time();
return true;
}
//-----------------------------------------
// no new headers if we're simply viewing an attachment..
//-----------------------------------------
if ($this->request['section'] == 'attach') {
$this->settings['no_print_header'] = 1;
}
//-----------------------------------------
// no new headers if we're updating chat
//-----------------------------------------
if (IPS_IS_AJAX && $this->request['section'] != 'login' or $this->request['section'] == 'attach' or $this->request['section'] == 'captcha') {
$this->settings['no_print_header'] = 1;
$this->do_update = 0;
}
//-----------------------------------------
// Continue!
//-----------------------------------------
$cookie['session_id'] = IPSCookie::get('session_id');
$cookie['member_id'] = IPSCookie::get('member_id');
$cookie['pass_hash'] = IPSCookie::get('pass_hash');
if ($cookie['session_id']) {
$this->getSession($cookie['session_id']);
$this->session_type = 'cookie';
} elseif (isset($this->request['s']) and $this->request['s']) {
$this->getSession($this->request['s']);
$this->session_type = 'url';
} else {
$this->session_id = 0;
}
//-----------------------------------------
// Do we have a valid session ID?
//-----------------------------------------
if ($this->session_id) {
//-----------------------------------------
// We've checked the IP addy and browser, so we can assume that this is
// a valid session.
//-----------------------------------------
if ($this->session_user_id != 0 and !empty($this->session_user_id)) {
//-----------------------------------------
// It's a member session, so load the member.
//-----------------------------------------
self::setMember($this->session_user_id);
//-----------------------------------------
// Did we get a member?
//-----------------------------------------
if (!self::$data_store['member_id'] or self::$data_store['member_id'] == 0) {
$this->_updateGuestSession();
/**
* If we have an SSO object, run it for the update guest session call
*/
//.........這裏部分代碼省略.........
示例6: _displayReport
/**
* Displays a report
*
* @return @e void
*/
public function _displayReport()
{
//-----------------------------------------
// Lets make sure this report exists...
//-----------------------------------------
$rid = intval($this->request['rid']);
$options = array('rid' => $rid);
$reports = array();
$comments = array();
if (!$rid) {
$this->registry->output->showError('reports_no_rid', 10137);
}
$this->registry->class_localization->loadLanguageFile(array('public_editors'));
$report_index = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . $rid));
//-----------------------------------------
// Basic title and nav routine..
//-----------------------------------------
$this->registry->output->addNavigation($this->lang->words['main_title'], 'app=core&module=reports&do=index');
$this->registry->output->addNavigation($report_index['title'], '');
if (!$report_index['id']) {
$this->registry->output->showError('reports_no_rid', 10138);
}
$COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
/* Load parser */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$parser = new $classToLoad();
//-----------------------------------------
// Get reports
//-----------------------------------------
$this->DB->buildFromCache('grab_report', array('COM' => $COM_PERM, 'rid' => $rid), 'report_sql_queries');
$outer = $this->DB->execute();
while ($row = $this->DB->fetch($outer)) {
$row['points'] = isset($row['points']) ? $row['points'] : $this->settings['_tmpPoints'][$row['id']];
if (!$options['url'] && $row['url']) {
$options['url'] = $this->registry->getClass('reportLibrary')->processUrl($row['url'], $row['seoname'], $row['seotemplate']);
}
if (!$options['class'] && $row['my_class']) {
$options['class'] = $row['my_class'];
}
if ($row['my_class'] == 'messages' && !$options['topicID'] && $row['exdat1']) {
$options['topicID'] = intval($row['exdat1']);
}
$options['title'] = $row['title'];
$options['status_id'] = $row['status'];
if (!$options['status_icon']) {
$options['status_icon'] = $this->registry->getClass('reportLibrary')->buildStatusIcon($row);
$options['status_text'] = $this->registry->getClass('reportLibrary')->flag_cache[$row['status']][$row['points']]['title'];
}
/* Stupid stupid stupidness */
$row['_title'] = $row['title'];
$row['title'] = $row['member_title'];
if ($row['member_id']) {
$row['author'] = IPSMember::buildDisplayData($row);
} else {
$row['author'] = IPSMember::buildDisplayData(IPSMember::setUpGuest(''));
}
$row['title'] = $row['_title'];
/* Set up some settings */
$parser->set(array('parseArea' => 'reports', 'memberData' => $row['author'], 'parseBBCode' => true, 'parseHtml' => false, 'parseEmoticons' => true));
$row['report'] = $parser->display($row['report']);
$reports[] = $row;
}
if (!$options['class']) {
$this->registry->output->showError('reports_no_rid', 10138);
}
$_tmp = $this->registry->getClass('reportLibrary')->flag_cache;
// Manually build array get just the statuses, not severities
foreach ($_tmp as $sid => $sta) {
if (is_array($sta) && count($sta)) {
foreach ($sta as $points => $info) {
if ($options['statuses'][$sid]) {
break;
}
$options['statuses'][$sid] = $info;
}
}
}
//-----------------------------------------
// Get comments
//-----------------------------------------
require_once IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php';
/*noLibHook*/
$this->_comments = classes_comments_bootstrap::controller('core-reports');
$comments = array('html' => $this->_comments->fetchFormatted($report_index, array('offset' => intval($this->request['st']))), 'count' => $this->_comments->count($report_index));
//-----------------------------------------
// Mark as read
//-----------------------------------------
$this->registry->classItemMarking->markRead(array('forumID' => 0, 'itemID' => $rid), 'core');
//-----------------------------------------
// And output
//-----------------------------------------
$this->output .= $this->registry->getClass('output')->getTemplate('reports')->viewReport($options, $reports, $comments);
}
示例7: _viewModern
//.........這裏部分代碼省略.........
$member['favorite_id'] = $favorite['forum_id'];
$member['_fav_posts'] = $favorite['f_posts'];
if ($member['posts']) {
$member['_fav_percent'] = round($favorite['f_posts'] / $member['posts'] * 100);
}
}
//-----------------------------------------
// Comments
//-----------------------------------------
if ($member['pp_setting_count_comments']) {
require_once IPSLib::getAppDir('members') . '/sources/comments.php';
$comment_lib = new profileCommentsLib($this->registry);
$comment_html = $comment_lib->buildComments($member);
}
//-----------------------------------------
// Visitors
//-----------------------------------------
if ($member['pp_setting_count_visitors']) {
$_pp_last_visitors = unserialize($member['pp_last_visitors']);
$_visitor_info = array();
$_count = 1;
if (is_array($_pp_last_visitors)) {
krsort($_pp_last_visitors);
$_members = IPSMember::load(array_values($_pp_last_visitors), 'extendedProfile');
foreach ($_members as $_id => $_member) {
$_visitor_info[$_id] = IPSMember::buildDisplayData($_member, 0);
}
foreach ($_pp_last_visitors as $_time => $_id) {
if ($_count > $member['pp_setting_count_visitors']) {
break;
}
$_count++;
if (!$_visitor_info[$_id]['members_display_name_short']) {
$_visitor_info[$_id] = IPSMember::setUpGuest();
}
$_visitor_info[$_id]['_visited_date'] = ipsRegistry::getClass('class_localization')->getDate($_time, 'TINY');
$_visitor_info[$_id]['members_display_name_short'] = $_visitor_info[$_id]['members_display_name_short'] ? $_visitor_info[$_id]['members_display_name_short'] : $this->lang->words['global_guestname'];
$visitors[] = $_visitor_info[$_id];
}
}
}
//-----------------------------------------
// Friends
//-----------------------------------------
# Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
# also fall back on last 10 if no cache
if ($member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled']) {
$member['_cache'] = IPSMember::unpackMemberCache($member['members_cache']);
if (is_array($member['_cache']['friends']) and count($member['_cache']['friends'])) {
foreach ($member['_cache']['friends'] as $id => $approved) {
$id = intval($id);
if ($approved and $id) {
$_member_ids[] = $id;
}
}
$member['_total_approved_friends'] = count($_member_ids);
if (is_array($_member_ids) and count($_member_ids)) {
$_max = count($_member_ids) > 50 ? 50 : count($_member_ids);
$_rand = array_rand($_member_ids, $_max);
$_final = array();
# If viewing member is in list, let's show em
if (in_array($this->memberData['member_id'], $_member_ids)) {
$_final[] = $this->memberData['member_id'];
$new_mids = array();
foreach ($_member_ids as $mid) {
if ($mid == $this->memberData['member_id']) {
示例8: parseAndFetchHtmlBlocks
/**
* Parse search results
*
* @param array $r Search result
* @return array $html Blocks of HTML
*/
public function parseAndFetchHtmlBlocks($rows)
{
/* Forum stuff */
$sub = false;
$isVnc = false;
$search_term = IPSSearchRegistry::get('in.clean_search_term');
$noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
$results = array();
$attachPids = array();
/* loop and process */
foreach ($rows as $id => $data) {
/* Reset */
$pages = 0;
/* Set up forum */
$forum = $this->registry->getClass('class_forums')->forum_by_id[$data['forum_id']];
$this->last_topic = $data['tid'];
/* Various data */
$data['_last_post'] = $data['last_post'];
$data['_longTitle'] = $data['content_title'];
$data['_shortTitle'] = IPSText::mbstrlen(strip_tags($data['content_title'])) > 60 ? IPSText::truncate($data['content_title'], 60) : $data['content_title'];
$data['last_poster'] = $data['last_poster_id'] ? IPSMember::buildDisplayData($data['last_poster_id']) : IPSMember::buildDisplayData(IPSMember::setUpGuest($this->settings['guest_name_pre'] . $data['last_poster_name'] . $this->settings['guest_name_suf']));
$data['starter'] = $data['starter_id'] ? IPSMember::makeProfileLink($data['starter_name'], $data['starter_id'], $data['seo_first_name']) : $this->settings['guest_name_pre'] . $data['starter_name'] . $this->settings['guest_name_suf'];
//$data['last_post'] = $this->registry->getClass( 'class_localization')->getDate( $data['last_post'], 'SHORT' );
if (isset($data['post_date'])) {
$data['_post_date'] = $data['post_date'];
//$data['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $data['post_date'], 'SHORT' );
}
if ($this->registry->getClass('class_forums')->canQueuePosts($forum['id'])) {
$data['posts'] += intval($data['topic_queuedposts']);
}
if ($this->registry->getClass('class_forums')->canSeeSoftDeletedPosts($forum['id'])) {
$data['posts'] += intval($data['topic_deleted_posts']);
}
if ($data['posts']) {
if (($data['posts'] + 1) % $this->settings['display_max_posts'] == 0) {
$pages = ($data['posts'] + 1) / $this->settings['display_max_posts'];
} else {
$number = ($data['posts'] + 1) / $this->settings['display_max_posts'];
$pages = ceil($number);
}
}
if ($pages > 1) {
for ($i = 0; $i < $pages; ++$i) {
$real_no = $i * $this->settings['display_max_posts'];
$page_no = $i + 1;
if ($page_no == 4 and $pages > 4) {
$data['pages'][] = array('last' => 1, 'st' => ($pages - 1) * $this->settings['display_max_posts'], 'page' => $pages, 'total' => $pages);
break;
} else {
$data['pages'][] = array('last' => 0, 'st' => $real_no, 'page' => $page_no, 'total' => $pages);
}
}
}
/* For-matt some stuffs */
if (IPSSearchRegistry::get('opt.noPostPreview') != true) {
if (!$data['cache_content']) {
IPSText::getTextClass('bbcode')->parse_smilies = $data['use_emo'];
IPSText::getTextClass('bbcode')->parse_html = ($forum['use_html'] and $this->caches['group_cache'][$data['member_group_id']]['g_dohtml'] and $data['post_htmlstate']) ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_bbcode = $forum['use_ibc'];
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
IPSText::getTextClass('bbcode')->parsing_mgroup = $data['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $data['mgroup_others'];
$data['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($data['post']);
} else {
$data['post'] = '<!--cached-' . gmdate('r', $data['cache_updated']) . '-->' . $data['cache_content'];
}
$data['post'] = IPSText::searchHighlight($data['post'], $search_term);
}
/* Has attachments */
if ($data['topic_hasattach']) {
$attachPids[$data['pid']] = $data['post'];
}
$rows[$id] = $data;
}
/* Attachments */
if (count($attachPids) and IPSSearchRegistry::get('set.returnType') != 'tids') {
/* Load attachments class */
if (!is_object($this->class_attach)) {
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
$this->class_attach = new $classToLoad($this->registry);
$this->class_attach->type = 'post';
$this->class_attach->init();
}
$attachHTML = $this->class_attach->renderAttachments($attachPids, array_keys($attachPids));
/* Now parse back in the rendered posts */
if (is_array($attachHTML) and count($attachHTML)) {
foreach ($attachHTML as $id => $_data) {
/* Get rid of any lingering attachment tags */
if (stristr($_data['html'], "[attachment=")) {
$_data['html'] = IPSText::stripAttachTag($_data['html']);
}
$rows[$id]['post'] = $_data['html'];
$rows[$id]['attachmentHtml'] = $_data['attachmentHtml'];
//.........這裏部分代碼省略.........
示例9: __call
/**
* Magic Call method
*
* @param string Method Name
* @param mixed Method arguments
* @return mixed
* Exception codes:
*/
public function __call($method, $arguments)
{
$firstBit = substr($method, 0, 3);
$theRest = substr($method, 3);
if (in_array($theRest, $this->_allowedInternalData)) {
if ($firstBit == 'set') {
if ($theRest == 'Author') {
if (is_array($arguments[0])) {
$this->_internalData[$theRest] = $arguments[0];
} else {
if ($arguments[0]) {
/* Set up moderator stuff, too */
$this->_internalData[$theRest] = IPSMember::setUpModerator(IPSMember::load(intval($arguments[0]), 'all'));
/* And ignored users */
$this->_internalData[$theRest]['ignored_users'] = array();
$this->registry->DB()->build(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . intval($arguments[0])));
$this->registry->DB()->execute();
while ($r = $this->registry->DB()->fetch()) {
$this->_internalData[$theRest]['ignored_users'][] = $r['ignore_ignore_id'];
}
} else {
$this->_internalData[$theRest] = IPSMember::setUpGuest();
}
}
if ($this->_internalData['Author']['mgroup_others']) {
$_others = explode(',', IPSText::cleanPermString($this->_internalData['Author']['mgroup_others']));
$_perms = array();
foreach ($_others as $_other) {
$_perms[] = $this->caches['group_cache'][$_other]['g_perm_id'];
}
if (count($_perms)) {
$this->_internalData['Author']['g_perm_id'] = $this->_internalData['Author']['g_perm_id'] . ',' . implode(',', $_perms);
}
}
} else {
$this->_internalData[$theRest] = $arguments[0];
return TRUE;
}
} else {
if (($theRest == 'Author' or $theRest == 'Settings' or $theRest == 'ModOptions') and isset($arguments[0])) {
return isset($this->_internalData[$theRest][$arguments[0]]) ? $this->_internalData[$theRest][$arguments[0]] : '';
} else {
return isset($this->_internalData[$theRest]) ? $this->_internalData[$theRest] : '';
}
}
} else {
switch ($method) {
case 'setForumData':
$this->_forumData = $arguments[0];
break;
case 'setPostData':
$this->_postData = $arguments[0];
break;
case 'setTopicData':
$this->_topicData = $arguments[0];
break;
case 'getForumData':
if (!empty($arguments[0])) {
return $this->_forumData[$arguments[0]];
} else {
return $this->_forumData;
}
break;
case 'getPostData':
if (!empty($arguments[0])) {
return $this->_postData[$arguments[0]];
} else {
return $this->_postData;
}
break;
case 'getTopicData':
if (!empty($arguments[0])) {
return $this->_topicData[$arguments[0]];
} else {
return $this->_topicData;
}
break;
case 'getPostError':
return isset($this->lang->words[$this->_postErrors]) ? $this->lang->words[$this->_postErrors] : $this->_postErrors;
break;
}
}
}
示例10: getPosts
/**
* Gets the posts to be printed/downloaded
*
* @access protected
* @return string
**/
protected function getPosts()
{
//-----------------------------------------
// Render the page top
//-----------------------------------------
$posts_html = $this->registry->getClass('output')->getTemplate('printpage')->pp_header($this->forum['name'], $this->topic['title'], $this->topic['starter_name'], $this->forum['id'], $this->topic['tid']);
$max_posts = 300;
$attach_pids = array();
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.topic_id={$this->topic['tid']} and p.queued=0", 'order' => 'p.pid', 'limit' => array(0, $max_posts), 'add_join' => array(array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'))));
$this->DB->execute();
//-----------------------------------------
// Loop through to pick out the correct member IDs.
// and push the post info into an array - maybe in the future
// we can add page spans, or maybe save to a PDF file?
//-----------------------------------------
$the_posts = array();
$mem_ids = array();
$member_array = array();
$cached_members = array();
while ($i = $this->DB->fetch()) {
$the_posts[] = $i;
if ($i['author_id']) {
$mem_ids[$i['author_id']] = $i['author_id'];
}
}
//-----------------------------------------
// Get the member profiles needed for this topic
//-----------------------------------------
if (count($mem_ids)) {
$this->DB->build(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id IN (' . implode(',', $mem_ids) . ')', 'add_join' => array(array('select' => 'g.*', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.member_group_id', 'type' => 'left'))));
$this->DB->execute();
while ($m = $this->DB->fetch()) {
$member_array[$m['member_id']] = $m;
}
}
//-----------------------------------------
// Format and print out the topic list
//-----------------------------------------
foreach ($the_posts as $row) {
$poster = array();
//-----------------------------------------
// Get the member info. We parse the data and cache it.
// It's likely that the same member posts several times in
// one page, so it's not efficient to keep parsing the same
// data
//-----------------------------------------
if ($row['author_id'] != 0) {
//-----------------------------------------
// Is it in the hash?
//-----------------------------------------
if (isset($cached_members[$row['author_id']])) {
//-----------------------------------------
// Ok, it's already cached, read from it
//-----------------------------------------
$poster = $cached_members[$row['author_id']];
$row['name_css'] = 'normalname';
} else {
//-----------------------------------------
// Ok, it's NOT in the cache, is it a member thats
// not been deleted?
//-----------------------------------------
if ($member_array[$row['author_id']]) {
$row['name_css'] = 'normalname';
$poster = $member_array[$row['author_id']];
//-----------------------------------------
// Add it to the cached list
//-----------------------------------------
$cached_members[$row['author_id']] = $poster;
} else {
//-----------------------------------------
// It's probably a deleted member, so treat them as a guest
//-----------------------------------------
$poster = IPSMember::setUpGuest($row['author_id']);
$row['name_css'] = 'unreg';
}
}
} else {
//-----------------------------------------
// It's definately a guest...
//-----------------------------------------
$poster = IPSMember::setUpGuest($row['author_name']);
$row['name_css'] = 'unreg';
}
//-----------------------------------------
$row['post'] = preg_replace("/<!--EDIT\\|(.+?)\\|(.+?)-->/", "", $row['post']);
//-----------------------------------------
$row['post_date'] = $this->registry->getClass('class_localization')->getDate($row['post_date'], 'LONG', 1);
//-----------------------------------------
// Quoted attachments?
//-----------------------------------------
$attach_pids[$row['pid']] = $row['pid'];
$row['post'] = $this->parseMessage($row['post'], $row);
//-----------------------------------------
// Parse HTML tag on the fly
//.........這裏部分代碼省略.........
示例11: setMember
/**
* Set current member to the member ID specified
*
* @param integer Member ID
* @return @e void
*/
public static function setMember($member_id)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval($member_id);
$addrs = array();
//-----------------------------------------
// If we have a member ID, set up the member
//-----------------------------------------
if ($member_id) {
self::instance()->data_store = IPSMember::load($member_id, 'extendedProfile,customFields,groups,itemMarkingStorage');
}
/* Got a member ID? */
if (!empty($member_id) && self::instance()->data_store['member_id']) {
self::setUpMember();
# Form hash
self::instance()->form_hash = md5(self::instance()->data_store['email'] . '&' . self::instance()->data_store['member_login_key'] . '&' . self::instance()->data_store['joined']);
} else {
self::instance()->data_store = IPSMember::setUpGuest();
self::instance()->perm_id = !empty(self::instance()->data_store['org_perm_id']) ? self::instance()->data_store['org_perm_id'] : self::instance()->data_store['g_perm_id'];
self::instance()->perm_id_array = explode(',', self::instance()->perm_id);
# Form hash
self::instance()->form_hash = md5("this is only here to prevent it breaking on guests");
}
//-----------------------------------------
// Set member data
//-----------------------------------------
self::instance()->member_id = $member_id;
}
示例12: _viewComments
/**
* Loads the content for the comments tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _viewComments()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$md5check = IPSText::md5Clean($this->request['md5check']);
$content = '';
$comment_perpage = 10;
$pages = '';
$start = intval($this->request['st']);
$sql_extra = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ($md5check != $this->member->form_hash) {
die('');
}
//-----------------------------------------
// Not my tab? So no moderation...
//-----------------------------------------
if ($member_id != $this->memberData['member_id'] and !$this->memberData['g_is_supmod']) {
$sql_extra = ' AND comment_approved=1';
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load($member_id);
//-----------------------------------------
// Check
//-----------------------------------------
if (!$member['member_id']) {
die('');
}
//-----------------------------------------
// How many comments must a man write down
// before he is considered a spammer?
//-----------------------------------------
$comment_count = $this->DB->buildAndFetch(array('select' => 'count(*) as count_comment', 'from' => 'profile_comments', 'where' => 'comment_for_member_id=' . $member_id . $sql_extra));
//-----------------------------------------
// Pages
//-----------------------------------------
$pages = $this->registry->output->generatePagination(array('totalItems' => intval($comment_count['count_comment']), 'itemsPerPage' => $comment_perpage, 'currentStartValue' => $start, 'baseUrl' => $this->settings['base_url'] . 'app=members&section=comments&module=profile&member_id=' . $member_id . '&do=view&md5check=' . $this->member->form_hash));
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->DB->build(array('select' => 'pc.*', 'from' => array('profile_comments' => 'pc'), 'where' => 'pc.comment_for_member_id=' . $member_id . $sql_extra, 'order' => 'pc.comment_date DESC', 'limit' => array($start, $comment_perpage), 'add_join' => array(0 => array('select' => 'm.members_display_name, m.login_anonymous', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pc.comment_by_member_id', 'type' => 'left'), 1 => array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
$o = $this->DB->execute();
while ($row = $this->DB->fetch($o)) {
$row['comment_content'] = IPSText::wordwrap($row['comment_content'], '19', ' ');
$row = IPSMember::buildDisplayData($row, 0);
if (!$row['members_display_name_short']) {
$row = array_merge($row, IPSMember::setUpGuest());
}
$comments[] = $row;
}
//-----------------------------------------
// Ok.. show the settings
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->showIframeComments($member, $comments, $pages);
$this->registry->getClass('output')->setTitle($this->settings['board_name']);
$this->registry->getClass('output')->popUpWindow($content);
}
示例13: __call
/**
* Magic Call method
*
* @access public
* @param string Method Name
* @param mixed Method arguments
* @return mixed
* Exception codes:
*/
public function __call($method, $arguments)
{
$firstBit = substr($method, 0, 3);
$theRest = substr($method, 3);
if (in_array($theRest, $this->_allowedInternalData)) {
if ($firstBit == 'set') {
if ($theRest == 'Author') {
if (is_array($arguments[0])) {
$this->_internalData[$theRest] = $arguments[0];
} else {
if ($arguments[0]) {
/* Set up moderator stuff, too */
$this->_internalData[$theRest] = $this->registry->getClass('class_forums')->setUpModerator(IPSMember::load(intval($arguments[0]), 'all'));
/* And ignored users */
$this->_internalData[$theRest]['ignored_users'] = array();
$this->registry->DB()->build(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . intval($arguments[0])));
$this->registry->DB()->execute();
while ($r = $this->registry->DB()->fetch()) {
$this->_internalData[$theRest]['ignored_users'][] = $r['ignore_ignore_id'];
}
} else {
$this->_internalData[$theRest] = IPSMember::setUpGuest();
}
}
} else {
$this->_internalData[$theRest] = $arguments[0];
return TRUE;
}
} else {
if (($theRest == 'Author' or $theRest == 'Settings' or $theRest == 'ModOptions') and isset($arguments[0])) {
return isset($this->_internalData[$theRest][$arguments[0]]) ? $this->_internalData[$theRest][$arguments[0]] : '';
} else {
return isset($this->_internalData[$theRest]) ? $this->_internalData[$theRest] : '';
}
}
} else {
switch ($method) {
case 'setForumData':
$this->_forumData = $arguments[0];
break;
case 'setPostData':
$this->_postData = $arguments[0];
break;
case 'setTopicData':
$this->_topicData = $arguments[0];
break;
case 'getForumData':
if ($arguments[0]) {
return $this->_forumData[$arguments[0]];
} else {
return $this->_forumData;
}
break;
case 'getPostData':
if ($arguments[0]) {
return $this->_postData[$arguments[0]];
} else {
return $this->_postData;
}
break;
case 'getTopicData':
if ($arguments[0]) {
return $this->_topicData[$arguments[0]];
} else {
return $this->_topicData;
}
break;
case 'getPostError':
return $this->lang->words[$this->_postErrors];
break;
}
}
}
示例14: parsePost
/**
* Builds an array of post data for output
*
* @param array $row Array of post data
* @return array
*/
public function parsePost(array $post)
{
/* Init */
$topicData = $this->getTopicData();
$forumData = $this->registry->getClass('class_forums')->getForumById($topicData['forum_id']);
$permissionData = $this->getPermissionData();
/* Start memory debug */
$_NOW = IPSDebug::getMemoryDebugFlag();
$poster = array();
/* Bitwise options */
$_tmp = IPSBWOptions::thaw($post['post_bwoptions'], 'posts', 'forums');
if (count($_tmp)) {
foreach ($_tmp as $k => $v) {
$post[$k] = $v;
}
}
/* Is this a member? */
if ($post['author_id'] != 0) {
$poster = $this->parseMember($post);
} else {
/* Sort out guest */
$post['author_name'] = $this->settings['guest_name_pre'] . $post['author_name'] . $this->settings['guest_name_suf'];
$poster = IPSMember::setUpGuest($post['author_name']);
$poster['members_display_name'] = $post['author_name'];
$poster['_members_display_name'] = $post['author_name'];
$poster['custom_fields'] = "";
$poster['warn_img'] = "";
$poster = IPSMember::buildProfilePhoto($poster);
}
/* Memory debug */
IPSDebug::setMemoryDebugFlag("PID: " . $post['pid'] . " - Member Parsed", $_NOW);
/* Update permission */
$this->registry->getClass('class_forums')->setMemberData($this->getMemberData());
$permissionData['softDelete'] = $this->registry->getClass('class_forums')->canSoftDeletePosts($topicData['forum_id'], $post);
/* Soft delete */
$post['_softDelete'] = $post['pid'] != $topicData['topic_firstpost'] ? $permissionData['softDelete'] : FALSE;
$post['_softDeleteRestore'] = $permissionData['softDeleteRestore'];
$post['_softDeleteSee'] = $permissionData['softDeleteSee'];
$post['_softDeleteReason'] = $permissionData['softDeleteReason'];
$post['_softDeleteContent'] = $permissionData['softDeleteContent'];
$post['_isVisible'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'visible' ? true : false;
$post['_isHidden'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'hidden' ? true : false;
$post['_isDeleted'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'sdelete' ? true : false;
/* Answered post */
try {
$post['_isMarkedAnswered'] = $this->postIsAnswer($post, $topicData) ? true : false;
} catch (Exception $e) {
$post['_isMarkedAnswered'] = false;
}
$post['_canMarkUnanswered'] = $post['_isMarkedAnswered'] === true && $this->canUnanswerTopic($topicData) ? true : false;
$post['_canAnswer'] = $post['_isMarkedAnswered'] === false && $this->canAnswerTopic($topicData) ? true : false;
$post['PermalinkUrlBit'] = '';
/* Queued */
if ($topicData['topic_firstpost'] == $post['pid'] and ($post['_isHidden'] or $topicData['_isHidden'])) {
$post['queued'] = 1;
$post['_isHidden'] = true;
}
if ($topicData['topic_queuedposts'] || $topicData['topic_deleted_posts']) {
if ($topicData['topic_queuedposts'] && $topicData['Perms']['canQueuePosts']) {
/* We have hidden data that is viewable */
$post['PermalinkUrlBit'] = '&p=' . $post['pid'];
}
if ($topicData['topic_deleted_posts'] && $post['_softDeleteSee']) {
/* We have hidden data that is viewable */
$post['PermalinkUrlBit'] = '&p=' . $post['pid'];
}
}
/* Edited stuff */
$post['edit_by'] = "";
if ($post['append_edit'] == 1 and $post['edit_time'] != "" and $post['edit_name'] != "") {
$e_time = $this->registry->class_localization->getDate($post['edit_time'], 'LONG');
$post['edit_by'] = sprintf($this->lang->words['edited_by'], $post['edit_name'], $e_time);
}
/* Now parse the post */
if (!isset($post['cache_content']) or !$post['cache_content']) {
$_NOW2 = IPSDebug::getMemoryDebugFlag();
/* Grab the parser file */
if ($this->_parser === null) {
/* Load parser */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$this->_parser = new $classToLoad();
}
/* set up parser */
$this->_parser->set(array('memberData' => array('member_id' => $post['member_id'], 'member_group_id' => $post['member_group_id'], 'mgroup_others' => $post['mgroup_others']), 'parseBBCode' => $forumData['use_ibc'], 'parseHtml' => ($forumData['use_html'] and $poster['g_dohtml'] and $post['post_htmlstate']) ? 1 : 0, 'parseEmoticons' => $post['use_emo'], 'parseArea' => 'topics'));
$post['post'] = $this->_parser->display($post['post']);
IPSDebug::setMemoryDebugFlag("topics::parsePostRow - bbcode parse - Completed", $_NOW2);
IPSContentCache::update($post['pid'], 'post', $post['post']);
} else {
$post['post'] = '<!--cached-' . gmdate('r', $post['cache_updated']) . '-->' . $post['cache_content'];
}
/* Buttons */
$post['_can_delete'] = $post['pid'] != $topicData['topic_firstpost'] ? $this->canDeletePost($post) : FALSE;
$post['_can_edit'] = $this->canEditPost($post);
$post['_show_ip'] = $this->canSeeIp();
//.........這裏部分代碼省略.........
示例15: __construct
/**
* Constructor :: Authorizes the session
*
* @param boolean $noAutoParsingSessions No auto parsing of sessions - set as true when using API-like methods
* @return @e mixed Void normally, but can print error message
*/
public function __construct($noAutoParsingSessions = false)
{
/* Make object */
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->_member = self::instance();
$this->_memberData =& self::instance()->fetchMemberData();
/* Delete immediately */
$this->_deleteNow = true;
/**
* If the sso.php file is present in this folder, we'll load it.
* This file can be used to easily integrate single-sign on in
* situations where you need to check session data
*/
if (is_file(IPS_ROOT_PATH . '/sources/classes/session/sso.php')) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/session/sso.php', 'ssoSessionExtension');
if (class_exists($classToLoad)) {
$this->sso = new $classToLoad($this->registry);
}
}
//-----------------------------------------
// INIT
//-----------------------------------------
$cookie = array();
$this->_userAgent = substr($this->_member->user_agent, 0, 200);
//-----------------------------------------
// Fix up app / section / module
//-----------------------------------------
$this->current_appcomponent = IPS_APP_COMPONENT;
$this->current_module = IPSText::alphanumericalClean($this->request['module']);
$this->current_section = IPSText::alphanumericalClean($this->request['section']);
$this->settings['session_expiration'] = $this->settings['session_expiration'] ? $this->settings['session_expiration'] : 3600;
//-----------------------------------------
// Return as guest if running a task
//-----------------------------------------
if (IPS_IS_TASK) {
self::$data_store = IPSMember::setUpGuest();
self::$data_store['last_activity'] = time();
self::$data_store['last_visit'] = time();
return true;
}
/* Not auto parsing sessions? */
if ($noAutoParsingSessions === true) {
return true;
}
//-----------------------------------------
// no new headers if we're simply viewing an attachment..
//-----------------------------------------
if ($this->request['section'] == 'attach') {
$this->settings['no_print_header'] = 1;
}
//-----------------------------------------
// no new headers if we're updating chat
//-----------------------------------------
if (IPS_IS_AJAX && ($this->request['section'] != 'login' && $this->request['section'] != 'skin') or $this->request['section'] == 'attach' or $this->request['section'] == 'captcha') {
$this->settings['no_print_header'] = 1;
$this->do_update = 0;
}
//-----------------------------------------
// IPS Connect
//-----------------------------------------
$ipsConnectEnabled = FALSE;
foreach ($this->caches['login_methods'] as $k => $data) {
if ($data['login_folder_name'] == 'ipsconnect' and $data['login_enabled']) {
$ipsConnectEnabled = TRUE;
$ipsConnectSettings = unserialize($data['login_custom_config']);
}
}
//-----------------------------------------
// Continue!
//-----------------------------------------
$cookie['session_id'] = IPSCookie::get('session_id');
$cookie['member_id'] = IPSCookie::get('member_id');
$cookie['pass_hash'] = IPSCookie::get('pass_hash');
if ($cookie['session_id'] && empty($this->request['_nsc'])) {
$this->getSession($cookie['session_id']);
$this->session_type = 'cookie';
} elseif (!empty($this->request['s'])) {
$this->getSession($this->request['s']);
$this->session_type = 'url';
} else {
$this->session_id = 0;
$this->session_type = 'url';
}
//-----------------------------------------
// Do we have a valid session ID?
//-----------------------------------------
if ($this->session_id) {
$haveMember = FALSE;
$forceNoMember = FALSE;
//.........這裏部分代碼省略.........