本文整理匯總了PHP中IPSMember::checkPermissions方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::checkPermissions方法的具體用法?PHP IPSMember::checkPermissions怎麽用?PHP IPSMember::checkPermissions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::checkPermissions方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _multiMergePost
/**
* Post multi-mod: Merge posts
*
* @return @e void [Outputs to screen]
*/
protected function _multiMergePost()
{
$this->_resetModerator($this->topic['forum_id']);
$this->_genericPermissionCheck('split_merge');
if (count($this->pids) < 2) {
$this->_showError('mod_only_one_pid', 10383);
}
//-----------------------------------------
// Form or print?
//-----------------------------------------
if (!$this->request['checked']) {
//-----------------------------------------
// Get post data
//-----------------------------------------
$master_post = "";
$dropdown = array();
$authors = array();
$seen_author = array();
$upload_html = "";
$seoTitle = '';
//-----------------------------------------
// Grab teh posts
//-----------------------------------------
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN (" . implode(",", $this->pids) . ")", 'add_join' => array(array('select' => 't.forum_id, t.title_seo', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($p = $this->DB->fetch($outer)) {
if (IPSMember::checkPermissions('read', $p['forum_id']) == TRUE) {
$master_post .= $p['post'] . "<br /><br />";
$dropdown[] = array($p['pid'], ipsRegistry::getClass('class_localization')->getDate($p['post_date'], 'LONG') . " (#{$p['pid']})");
if (!in_array($p['author_id'], $seen_author)) {
$authors[] = array($p['author_id'], "{$p['author_name']} (#{$p['pid']})");
$seen_author[] = $p['author_id'];
}
$seoTitle = $p['title_seo'];
}
}
//-----------------------------------------
// Get Attachment Data
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode(",", $this->pids) . ")"));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$row['image'] = $this->caches['attachtypes'][$row['attach_ext']]['atype_img'];
$row['size'] = IPSLib::sizeFormat($row['attach_filesize']);
$row['attach_file'] = IPSText::truncate($row['attach_file'], 50);
$attachments[] = $row;
}
//-----------------------------------------
// Print form
//-----------------------------------------
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$_editor = new $classToLoad();
$_editor->setContent(trim($master_post));
$editor = $_editor->show('Post', array('autoSaveKey' => md5('merge-' . $this->topic['tid']), 'height' => 350));
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergePostForm($editor, $dropdown, $authors, $attachments, $seoTitle);
if ($this->topic['tid']) {
$this->registry->getClass('output')->addNavigation($this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic');
}
$this->registry->getClass('output')->addNavigation($this->lang->words['cm_title'], '');
$this->registry->getClass('output')->setTitle($this->lang->words['cm_title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent($this->output);
$this->registry->getClass('output')->sendOutput();
} else {
//-----------------------------------------
// DO THE THING, WITH THE THING!!
//-----------------------------------------
$this->request['postdate'] = intval($this->request['postdate']);
if (empty($this->request['selectedpids']) || empty($this->request['postdate']) || empty($this->request['Post'])) {
$this->_showError('mod_merge_posts', 10384);
}
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$_editor = new $classToLoad();
/* remove saved content */
if ($this->memberData['member_id']) {
$_editor->removeAutoSavedContent(array('member_id' => $this->memberData['member_id'], 'autoSaveKey' => md5('merge-' . $this->topic['tid'])));
}
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
$post = $_editor->process($_POST['Post']);
$post = IPSText::getTextClass('bbcode')->preDbParse($post);
//-----------------------------------------
// Post to keep...
//-----------------------------------------
$posts = array();
$author = array();
$post_to_delete = array();
$new_post_key = md5(time());
$topics = array();
$forums = array();
$append_edit = 0;
//-----------------------------------------
//.........這裏部分代碼省略.........
示例2: doExecute
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute(ipsRegistry $registry)
{
$announceID = intval($this->request['announce_id']);
if (!$announceID) {
$this->registry->getClass('output')->showError('announcement_id_missing', 10327);
}
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_topic'));
//-----------------------------------------
// Get the announcement
//-----------------------------------------
$announce = $this->DB->buildAndFetch(array('select' => 'a.*', 'from' => array('announcements' => 'a'), 'where' => 'a.announce_id=' . $announceID, 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.announce_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'), array('select' => 'pc.*', 'from' => array('pfields_content' => 'pc'), 'where' => 'pc.member_id=m.member_id', 'type' => 'left'))));
if (!$announce['announce_id'] or !$announce['announce_forum']) {
$this->registry->getClass('output')->showError('announcement_id_missing', 10328);
}
//-----------------------------------------
// Permission to see it?
//-----------------------------------------
$pass = 0;
if ($announce['announce_forum'] == '*') {
$pass = 1;
} else {
$tmp = explode(",", $announce['announce_forum']);
if (!is_array($tmp) and !count($tmp)) {
$pass = 0;
} else {
foreach ($tmp as $id) {
if ($this->registry->getClass('class_forums')->forum_by_id[$id]['id']) {
if (IPSMember::checkPermissions('read', $id)) {
$pass = 1;
break;
}
}
}
}
}
if ($pass != 1) {
$this->registry->getClass('output')->showError('announcement_no_perms', 2035, true);
}
if (!$announce['announce_active'] and !$this->memberData['g_is_supmod']) {
$this->registry->getClass('output')->showError('announcement_no_perms', 2036, true);
}
//-----------------------------------------
// Parsey parsey!
//-----------------------------------------
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = $announce['announce_html_enabled'] ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_nl2br = $announce['announce_nlbr_enabled'];
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'announcements';
IPSText::getTextClass('bbcode')->parsing_mgroup = $announce['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $announce['mgroup_others'];
$announce['announce_post'] = IPSText::getTextClass('bbcode')->preDisplayParse($announce['announce_post']);
$member = IPSMember::buildDisplayData($announce, array('signature' => 1, 'customFields' => 1, 'checkFormat' => 1, 'cfLocation' => 'topic'));
if ($member['member_id']) {
$member['_members_display_name'] = "<a href='{$this->settings['_base_url']}showuser={$member['member_id']}'>{$member['members_display_name_short']}</a>";
}
if ($announce['announce_start'] and $announce['announce_end']) {
$announce['running_date'] = sprintf($this->lang->words['announce_both'], gmstrftime('%x', $announce['announce_start']), gmstrftime('%x', $announce['announce_end']));
} else {
if ($announce['announce_start'] and !$announce['announce_end']) {
$announce['running_date'] = sprintf($this->lang->words['announce_start'], gmstrftime('%x', $announce['announce_start']));
} else {
if (!$announce['announce_start'] and $announce['announce_end']) {
$announce['running_date'] = sprintf($this->lang->words['announce_end'], gmstrftime('%x', $announce['announce_end']));
} else {
$announce['running_date'] = '';
}
}
}
$template = $this->registry->getClass('output')->getTemplate('topic')->announcement_show($announce, $member);
//-----------------------------------------
// Update hits
//-----------------------------------------
$this->DB->build(array('update' => 'announcements', 'set' => 'announce_views=announce_views+1', 'where' => "announce_id=" . $announceID));
$this->DB->execute();
if ($this->request['f']) {
$nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav($this->request['f']);
}
$nav[] = array($announce['announce_title'], "");
foreach ($nav as $_id => $_nav) {
$this->registry->getClass('output')->addNavigation($_nav[0], $_nav[1], $_nav[2], $_nav[3]);
}
$this->registry->getClass('output')->setTitle($this->settings['board_name'] . " -> " . $announce['announce_title']);
$this->registry->getClass('output')->addContent($template);
$this->registry->getClass('output')->sendOutput();
}
示例3: getSpaceAllowance
/**
* Returns an array of the allowed upload sizes in bytes.
* Return 'space_allowed' as -1 to not allow uploads.
* Return 'space_allowed' as 0 to allow unlimited uploads
* Return 'max_single_upload' as 0 to not set a limit
*
* @param string MD5 post key
* @param id Member ID
* @return array [ 'space_used', 'space_left', 'space_allowed', 'max_single_upload' ]
*/
public function getSpaceAllowance($post_key = '', $member_id = '')
{
$max_php_size = IPSLib::getMaxPostSize();
$member_id = intval($member_id ? $member_id : $this->memberData['member_id']);
$forum_id = intval(ipsRegistry::$request['forum_id'] ? ipsRegistry::$request['forum_id'] : ipsRegistry::$request['f']);
$space_left = 0;
$space_used = 0;
$space_allowed = 0;
$max_single_upload = 0;
$space_calculated = 0;
if ($post_key) {
//-----------------------------------------
// Check to make sure we're not attempting
// to upload to another's post...
//-----------------------------------------
if (!$this->memberData['g_is_supmod'] and !$this->memberData['is_mod']) {
$post = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'posts', 'where' => "post_key='{$post_key}'"));
if ($post['post_key'] and $post['author_id'] != $member_id) {
$space_allowed = -1;
$space_calculated = 1;
}
}
}
//-----------------------------------------
// Generate total space allowed
//-----------------------------------------
$total_space_allowed = ($this->memberData['g_attach_per_post'] ? $this->memberData['g_attach_per_post'] : $this->memberData['g_attach_max']) * 1024;
//-----------------------------------------
// Allowed to attach?
//-----------------------------------------
if (!$member_id or !$forum_id) {
$space_allowed = -1;
}
if (IPSMember::checkPermissions('upload', $forum_id) !== TRUE) {
$space_allowed = -1;
} else {
if (!$space_calculated) {
//-----------------------------------------
// Generate space allowed figure
//-----------------------------------------
if ($this->memberData['g_attach_per_post']) {
//-----------------------------------------
// Per post limit...
//-----------------------------------------
$_space_used = $this->DB->buildAndFetch(array('select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => "attach_post_key='{$post_key}'"));
$space_used = $_space_used['figure'] ? $_space_used['figure'] : 0;
} else {
//-----------------------------------------
// Global limit...
//-----------------------------------------
$_space_used = $this->DB->buildAndFetch(array('select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => "attach_member_id={$member_id} AND attach_rel_module IN( 'post', 'msg' )"));
$space_used = $_space_used['figure'] ? $_space_used['figure'] : 0;
}
if ($this->memberData['g_attach_max'] > 0) {
if ($this->memberData['g_attach_per_post']) {
$_g_space_used = $this->DB->buildAndFetch(array('select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => "attach_member_id={$member_id} AND attach_rel_module IN( 'post', 'msg' )"));
$g_space_used = $_g_space_used['figure'] ? $_g_space_used['figure'] : 0;
if ($this->memberData['g_attach_max'] * 1024 - $g_space_used < 0) {
$space_used = $g_space_used;
$total_space_allowed = $this->memberData['g_attach_max'] * 1024;
$space_allowed = $this->memberData['g_attach_max'] * 1024 - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
} else {
$space_allowed = $this->memberData['g_attach_per_post'] * 1024 - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
} else {
$space_allowed = $this->memberData['g_attach_max'] * 1024 - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
} else {
if ($this->memberData['g_attach_per_post']) {
$space_allowed = $this->memberData['g_attach_per_post'] * 1024 - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
} else {
# Unlimited
$space_allowed = 0;
}
}
//-----------------------------------------
// Generate space left figure
//-----------------------------------------
$space_left = $space_allowed ? $space_allowed : 0;
$space_left = $space_left < 0 ? -1 : $space_left;
//-----------------------------------------
// Generate max upload size
//-----------------------------------------
if (!$max_single_upload) {
if ($space_left > 0 and $space_left < $max_php_size) {
$max_single_upload = $space_left;
//.........這裏部分代碼省略.........
示例4: return_html_block
/**
* Feturn HTML block
*
* @param array Member information
* @return string HTML block
*/
public function return_html_block($member = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$last_x = 5;
$forumIdsOk = array(0 => 0);
$date_cut = '';
//-----------------------------------------
// Got a member?
//-----------------------------------------
if (!is_array($member) or !count($member)) {
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_posts_to_show');
}
//-----------------------------------------
// Some words
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_topic'), 'forums');
//-----------------------------------------
// Can view other member's topics?
//-----------------------------------------
if (!$this->memberData['g_other_topics'] and $this->memberData['member_id'] != $member['member_id']) {
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_posts_to_show');
}
/* Get list of good forum IDs */
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
//-----------------------------------------
// Get last X posts
//-----------------------------------------
if (is_array($forumIdsOk) and count($forumIdsOk)) {
/* Init vars */
$pids = array();
$parseAttachments = false;
/* Set up joins */
$_post_joins = array(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('select' => 'm.member_group_id, m.mgroup_others', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'));
/* Cache? */
if (IPSContentCache::isEnabled()) {
if (IPSContentCache::fetchSettingValue('post')) {
$_post_joins[] = IPSContentCache::join('post', 'p.pid');
}
}
if ($this->settings['search_ucontent_days']) {
$_date_cut = ($member['last_post'] ? $member['last_post'] : time()) - 86400 * intval($this->settings['search_ucontent_days']);
$date_cut = ' AND p.post_date > ' . $_date_cut;
}
$_queued = $this->registry->class_forums->fetchPostHiddenQuery(array('visible'), 'p.');
$_approved = $this->registry->getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
/* Let's just run this if the member has posted within the cutoff period */
if ($member['last_post'] > $_date_cut) {
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => $_queued . " AND " . $_approved . " AND p.author_id={$member['member_id']} AND p.new_topic=0 AND t.forum_id IN (" . implode(",", $forumIdsOk) . ") " . $date_cut, 'order' => 'p.pid DESC', 'limit' => array(0, $last_x), 'add_join' => $_post_joins));
$o = $this->DB->execute();
while ($row = $this->DB->fetch($o)) {
$pids[$row['pid']] = $row['pid'];
if ($row['topic_hasattach']) {
$parseAttachments = true;
}
if (!$row['cache_content']) {
IPSText::getTextClass('bbcode')->parse_smilies = $row['use_emo'];
IPSText::getTextClass('bbcode')->parse_html = ($row['use_html'] and $this->caches['group_cache'][$row['member_group_id']]['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 = $row['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $row['mgroup_others'];
$row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['post']);
IPSContentCache::update($row['pid'], 'post', $row['post']);
} else {
$row['post'] = $row['cache_content'];
}
$row['_post_date'] = ipsRegistry::getClass('class_localization')->getDate($row['post_date'], 'SHORT');
$row['_raw_date'] = $row['post_date'];
$row['_date_array'] = IPSTime::date_getgmdate($row['post_date'] + ipsRegistry::getClass('class_localization')->getTimeOffset());
$row['post'] .= "\n<!--IBF.ATTACHMENT_" . $row['pid'] . "-->";
$url = $this->registry->output->buildSEOUrl("showtopic={$row['topic_id']}&view=findpost&p={$row['pid']}", 'public', $row['title_seo'], 'showtopic');
$content .= $this->registry->getClass('output')->getTemplate('profile')->tabSingleColumn($row, $this->lang->words['profile_read_topic'], $url, $this->lang->words['profile_in_topic'] . $row['title']);
}
//-----------------------------------------
// Attachments (but only if necessary)
//-----------------------------------------
if ($parseAttachments and !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();
if (IPSMember::checkPermissions('download') === false) {
$this->settings['show_img_upload'] = 0;
}
$content = $this->class_attach->renderAttachments($content, $pids);
$content = $content[0]['html'];
}
//-----------------------------------------
// Macros...
//-----------------------------------------
//.........這裏部分代碼省略.........
示例5: _customEvent_watch
/**
* Custom Event: Watch A Topic
*
* @access private
* @author Matt Mecham
* @param bool Whether to save it or not
* @return void
*/
private function _customEvent_watch($saveIt = FALSE)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$watch = $this->request['watch'] == 'forum' ? 'forum' : 'topic';
$topicID = intval($this->request['tid']);
$forumID = intval($this->request['fid']);
$forum = array();
$topic = array();
if ($watch == 'topic') {
//-----------------------------------------
// Get the details from the DB (TOPIC)
//-----------------------------------------
$topic = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topicID));
if (!$topic['tid']) {
$this->registry->getClass('output')->showError('usercp_forums_no_topic', 1030);
}
$forum = $this->registry->getClass('class_forums')->forum_by_id[$topic['forum_id']];
$forumID = $topic['forum_id'];
} else {
//-----------------------------------------
// Get the details (FORUM)
//-----------------------------------------
$forum = $this->registry->getClass('class_forums')->forum_by_id[$forumID];
}
//-----------------------------------------
// Permy check
//-----------------------------------------
if (IPSMember::checkPermissions('read', $forumID) !== TRUE) {
$this->registry->getClass('output')->showError('usercp_forums_no_perms', 1031);
}
//-----------------------------------------
// Passy check
//-----------------------------------------
if (!in_array($this->memberData['member_group_id'], explode(",", $forum['password_override'])) and (isset($forum['password']) and $forum['password'] != "")) {
if ($this->registry->getClass('class_forums')->forumsComparePassword($forum['id']) != TRUE) {
$this->registry->getClass('output')->showError('usercp_forums_must_login', 1032);
}
}
//-----------------------------------------
// Have we already subscribed?
//-----------------------------------------
if ($watch == 'forum') {
$tmp = $this->DB->buildAndFetch(array('select' => 'frid as tmpid', 'from' => 'forum_tracker', 'where' => "forum_id={$forumID} AND member_id=" . $this->memberData['member_id']));
} else {
$tmp = $this->DB->buildAndFetch(array('select' => 'trid as tmpid', 'from' => 'tracker', 'where' => "topic_id={$topicID} AND member_id=" . $this->memberData['member_id']));
}
if ($tmp['tmpid']) {
$this->registry->getClass('output')->showError('forum_already_subscribed', 1033);
}
//-----------------------------------------
// What to do...
//-----------------------------------------
if (!$saveIt) {
//-----------------------------------------
// Okay, lets do the HTML
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('ucp')->watchChoices($forum, $topic, $watch);
} else {
//-----------------------------------------
// Auth check
//-----------------------------------------
if ($this->request['auth_key'] != $this->member->form_hash) {
$this->registry->getClass('output')->showError('usercp_forums_bad_key', 2033, true);
}
//-----------------------------------------
// Method..
//-----------------------------------------
switch ($this->request['emailtype']) {
case 'immediate':
$_method = 'immediate';
break;
case 'delayed':
$_method = 'delayed';
break;
case 'none':
$_method = 'none';
break;
case 'daily':
$_method = 'daily';
break;
case 'weekly':
$_method = 'weekly';
break;
default:
$_method = 'delayed';
break;
}
//-----------------------------------------
// Add it to the DB
//-----------------------------------------
//.........這裏部分代碼省略.........
示例6: recent_topics_last_x
//.........這裏部分代碼省略.........
return;
}
$this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => "t.tid IN (" . implode(",", array_values($all)) . ")", 'add_join' => array(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => 'p.pid=t.topic_firstpost', 'type' => 'left'), array('select' => 'f.use_html', 'from' => array('forums' => 'f'), 'where' => "f.id=t.forum_id", 'type' => 'left'), array('select' => 'm.member_id, m.members_display_name, m.member_group_id, m.members_seo_name, m.mgroup_others, m.login_anonymous, m.last_visit, m.last_activity', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
$outer = $this->DB->execute();
//-----------------------------------------
// Loop through..
//-----------------------------------------
while ($row = $this->DB->fetch($outer)) {
$data[$row['tid']] = $row;
}
krsort($unpinned);
krsort($pinned);
foreach ($unpinned as $date => $tid) {
if (count($pinned) < $limit) {
$pinned[$date] = $tid;
} else {
break;
}
$count++;
}
/* Now put it altogether */
foreach ($pinned as $date => $tid) {
//-----------------------------------------
// INIT
//-----------------------------------------
$entry = $data[$tid];
$bottom_string = "";
$read_more = "";
$top_string = "";
$got_these_attach = 0;
if ($entry['topic_hasattach']) {
$parseAttachments = true;
}
//-----------------------------------------
// Parse the post
//-----------------------------------------
IPSText::getTextClass('bbcode')->parse_smilies = $entry['use_emo'];
IPSText::getTextClass('bbcode')->parse_html = ($entry['use_html'] and $entry['post_htmlstate']) ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_nl2br = $entry['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
IPSText::getTextClass('bbcode')->parsing_mgroup = $entry['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $entry['mgroup_others'];
$entry['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($entry['post']);
//-----------------------------------------
// BASIC INFO
//-----------------------------------------
$real_posts = $entry['posts'];
$entry['posts'] = ipsRegistry::getClass('class_localization')->formatNumber(intval($entry['posts']));
if (!$entry['author_id']) {
$entry['members_display_name'] = $this->settings['guest_name_pre'] . $entry['author_name'] . $this->settings['guest_name_suf'];
$entry['member_id'] = 0;
} else {
$entry = IPSMember::buildDisplayData($entry);
}
//-----------------------------------------
// Get Date
//-----------------------------------------
$entry['date'] = $this->registry->class_localization->getDate($entry['post_date'], "manual{" . $this->settings['csite_article_date'] . "}");
//-----------------------------------------
// Attachments?
//-----------------------------------------
if ($entry['pid']) {
$attach_pids[$entry['pid']] = $entry['pid'];
}
//-----------------------------------------
// Avatar
//-----------------------------------------
$entry['avatar'] = IPSMember::buildAvatar($entry);
if (IPSMember::checkPermissions('download', $entry['forum_id']) === FALSE) {
$this->settings['show_img_upload'] = 0;
}
//-----------------------------------------
// View image...
//-----------------------------------------
$entry['post'] = IPSText::getTextClass('bbcode')->memberViewImages($entry['post']);
$rows[] = $entry;
}
$output = $this->registry->getClass('output')->getTemplate('portal')->articles($rows);
//-----------------------------------------
// Process Attachments
//-----------------------------------------
if ($parseAttachments and count($attach_pids)) {
if (!is_object($this->class_attach)) {
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php';
$this->class_attach = new class_attach($this->registry);
$this->class_attach->attach_post_key = '';
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_topic'), 'forums');
}
$this->class_attach->attach_post_key = '';
$this->class_attach->type = 'post';
$this->class_attach->init();
$output = $this->class_attach->renderAttachments($output, $attach_pids);
$output = $output[0]['html'];
}
return $output;
}
示例7: getAttachments
/**
* Get the actual output.
* This is abstracted so that the AJAX routine can load and execute this function
*
* @param array Topic and attachment data
* @return string HTML output
*/
public function getAttachments($topic)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$attach_cache = ipsRegistry::cache()->getCache('attachtypes');
//-----------------------------------------
// Get forum skin and lang
//-----------------------------------------
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_forums', 'public_topic'), 'forums');
//-----------------------------------------
// aight.....
//-----------------------------------------
$_queued = !$this->registry->getClass('class_forums')->canQueuePosts($topic['forum_id']) ? ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible'), 'p.') : '';
$_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
$_limit = 50;
$_pages = '';
$_count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as attachments', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'add_join' => array(array('from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
if ($_count['attachments'] > $_limit) {
$_pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $_count['attachments'], 'itemsPerPage' => $_limit, 'currentStartValue' => $_st, 'baseUrl' => "app=forums&module=forums&section=attach&tid={$topic['tid']}"));
}
$this->DB->build(array('select' => 'p.pid, p.topic_id', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'order' => 'p.pid ASC, a.attach_id ASC', 'limit' => array($_st, $_limit), 'add_join' => array(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
if (IPSMember::checkPermissions('read', $topic['forum_id']) != TRUE) {
continue;
}
if (!$row['attach_id']) {
continue;
}
$row['image'] = str_replace('folder_mime_types', 'mime_types', $attach_cache[$row['attach_ext']]['atype_img']);
$row['short_name'] = IPSText::truncate($row['attach_file'], 30);
$row['attach_date'] = $this->registry->getClass('class_localization')->getDate($row['attach_date'], 'SHORT');
$row['real_size'] = IPSLib::sizeFormat($row['attach_filesize']);
$rows[] = $row;
}
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->forumAttachments($topic['title'], $rows, $_pages);
return $this->output;
}
示例8: customEvent_modIPAddresses
/**
* Custom Event: Run the IP tool
*
* @access public
* @return string HTML
*/
public function customEvent_modIPAddresses()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$exactMatch = 1;
$finalIPString = trim($this->request['ip']);
$startVal = intval($this->request['st']);
$ipTool = $this->request['iptool'];
$content = "";
//-----------------------------------------
// Have permission to match?
//-----------------------------------------
if (!$this->memberData['g_is_supmod']) {
$this->registry->getClass('output')->showError('members_tool_supmod', 2020);
}
//-----------------------------------------
// Remove trailing periods
//-----------------------------------------
if (strstr($finalIPString, '*')) {
$exactMatch = 0;
$finalIPString = preg_replace("/^(.+?)\\*(.+?)?\$/", "\\1", $finalIPString) . '%';
}
//-----------------------------------------
// H'okay, what have we been asked to do?
// (that's a metaphorical "we" in a rhetorical question)
//-----------------------------------------
if ($ipTool == 'resolve') {
$resolved = @gethostbyaddr($finalIPString);
if ($resolved == "") {
return $this->formIPAddresses($this->registry->output->getTemplate('ucp')->inlineModIPMessage($this->lang->words['cp_no_matches']));
} else {
return $this->formIPAddresses($this->registry->output->getTemplate('ucp')->inlineModIPMessage(sprintf($this->lang->words['ip_resolve_result'], $finalIPString, $resolved)));
}
} else {
if ($ipTool == 'members') {
if ($exactMatch == 0) {
$sql = "ip_address LIKE '{$finalIPString}'";
} else {
$sql = "ip_address='{$finalIPString}'";
}
$this->DB->build(array('select' => 'count(member_id) as max', 'from' => 'members', 'where' => $sql));
$this->DB->execute();
$total_possible = $this->DB->fetch();
if ($total_possible['max'] < 1) {
return $this->formIPAddresses($this->registry->output->getTemplate('ucp')->inlineModIPMessage($this->lang->words['cp_no_matches']));
}
$pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $total_possible['max'], 'itemsPerPage' => 20, 'currentStartValue' => $startVal, 'baseUrl' => "app=core&module=usercp&tab=members&area=mod_ipaddress&iptool=members&ip=" . $this->request['ip'] . ""));
if (!$this->memberData['g_access_cp']) {
$sql .= "AND g.g_access_cp != 1";
}
$this->DB->build(array('select' => 'm.name, m.members_display_name, m.members_seo_name, m.member_id, m.ip_address, m.posts, m.joined, m.member_group_id', 'from' => array('members' => 'm'), 'where' => 'm.' . $sql, 'order' => "m.joined DESC", 'limit' => array($startVal, 20), 'add_join' => array(array('select' => 'g.g_access_cp', 'from' => array('groups' => 'g'), 'type' => 'left', 'where' => 'g.g_id=m.member_group_id'))));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$row['joined'] = $this->registry->getClass('class_localization')->getDate($row['joined'], 'JOINED');
$row['groupname'] = IPSLib::makeNameFormatted($this->caches['group_cache'][$row['member_group_id']]['g_title'], $row['member_group_id']);
$members[$row['member_id']] = $row;
}
return $this->formIPAddresses($this->registry->getClass('output')->getTemplate('ucp')->membersModIPFormMembers($pages, $members));
} else {
// Find posts then!
if ($exactMatch == 0) {
$sql = "p.ip_address LIKE '{$finalIPString}'";
} else {
$sql = "p.ip_address='{$finalIPString}'";
}
// Get forums we're allowed to view
$aforum = array();
foreach ($this->registry->getClass('class_forums')->forum_by_id as $data) {
if (IPSMember::checkPermissions('read', $data['id']) == TRUE) {
$aforum[] = $data['id'];
}
}
if (count($aforum) < 1) {
$this->formIPAddresses($this->registry->output->getTemplate('ucp')->inlineModIPMessage($this->lang->words['cp_no_matches']));
return;
}
$the_forums = implode(",", $aforum);
$st = intval($this->request['st']);
$count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => array('posts' => 'p'), 'where' => "t.forum_id IN({$the_forums}) AND {$sql}", 'add_join' => array(array('from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'))));
//-----------------------------------------
// Do we have any results?
//-----------------------------------------
if (!$count['total']) {
return $this->formIPAddresses($this->registry->output->getTemplate('ucp')->inlineModIPMessage($this->lang->words['cp_no_matches']));
}
//-----------------------------------------
// Get forum class as we'll need it
//-----------------------------------------
require_once IPSLib::getAppDir('forums') . '/app_class_forums.php';
$appclassforums = new app_class_forums($this->registry);
//-----------------------------------------
// Pages
//-----------------------------------------
//.........這裏部分代碼省略.........
示例9: return_html_block
/**
* Feturn HTML block
*
* @access public
* @param array Member information
* @return string HTML block
*/
public function return_html_block($member = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$last_x = 5;
$forum_ids = array();
//-----------------------------------------
// Got a member?
//-----------------------------------------
if (!is_array($member) or !count($member)) {
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_posts_to_show');
}
//-----------------------------------------
// Some words
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_topic'), 'forums');
//-----------------------------------------
// Can view other member's topics?
//-----------------------------------------
if (!$this->memberData['g_other_topics'] and $this->memberData['member_id'] != $member['member_id']) {
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_posts_to_show');
}
//-----------------------------------------
// Remove trash can...
//-----------------------------------------
$trash_can_remove = '';
if ($this->settings['forum_trash_can_id']) {
$trash_can_remove = ' AND i.perm_type_id <> ' . $this->settings['forum_trash_can_id'];
}
$pids = array();
//-----------------------------------------
// And limit by post count...
//-----------------------------------------
$posts = intval($this->memberData['posts']);
$trash_can_remove .= " AND f.min_posts_view <= {$posts}";
//-----------------------------------------
// And "can view others"
//-----------------------------------------
$trash_can_remove .= " AND f.can_view_others=1";
//-----------------------------------------
// Will we need to parse attachments?
//-----------------------------------------
$parseAttachments = false;
//-----------------------------------------
// Get last X posts
//-----------------------------------------
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.queued=0 AND t.approved=1 AND p.author_id={$member['member_id']} AND p.new_topic=0 AND {$this->registry->permissions->buildPermQuery('i')} AND {$this->registry->permissions->buildPermQuery('i', 'perm_2')} {$trash_can_remove} AND (f.password='' OR f.password" . $this->DB->buildIsNull() . ")", 'order' => 'p.post_date DESC', 'limit' => array(0, $last_x), 'add_join' => array(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('from' => array('permission_index' => 'i'), 'where' => "i.perm_type='forum' AND i.perm_type_id=t.forum_id", 'type' => 'left'), array('select' => 'f.use_html', 'from' => array('forums' => 'f'), 'where' => 'f.id=t.forum_id', 'type' => 'left'), array('select' => 'm.member_group_id, m.mgroup_others', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'))));
$o = $this->DB->execute();
while ($row = $this->DB->fetch($o)) {
$pids[$row['pid']] = $row['pid'];
if ($row['topic_hasattach']) {
$parseAttachments = true;
}
IPSText::getTextClass('bbcode')->parse_smilies = $row['use_emo'];
IPSText::getTextClass('bbcode')->parse_html = ($row['use_html'] and $this->memberData['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 = $row['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $row['mgroup_others'];
$row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['post']);
$row['post'] = IPSText::getTextClass('bbcode')->memberViewImages($row['post']);
$row['_post_date'] = ipsRegistry::getClass('class_localization')->getDate($row['post_date'], 'SHORT');
$row['_date_array'] = IPSTime::date_getgmdate($row['post_date'] + ipsRegistry::getClass('class_localization')->getTimeOffset());
$row['post'] .= "\n<!--IBF.ATTACHMENT_" . $row['pid'] . "-->";
$content .= $this->registry->getClass('output')->getTemplate('profile')->tabSingleColumn($row, $this->lang->words['profile_read_topic'], $this->settings['base_url'] . 'app=forums&module=forums&section=findpost&pid=' . $row['pid'], $this->lang->words['profile_in_topic'] . $row['title']);
}
//-----------------------------------------
// Attachments (but only if necessary)
//-----------------------------------------
if ($parseAttachments and !is_object($this->class_attach)) {
require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php';
$this->class_attach = new class_attach($this->registry);
$this->class_attach->type = 'post';
$this->class_attach->init();
if (IPSMember::checkPermissions('download') === false) {
$this->settings['show_img_upload'] = 0;
}
$content = $this->class_attach->renderAttachments($content, $pids);
$content = $content[0]['html'];
}
//-----------------------------------------
// Macros...
//-----------------------------------------
$content = $this->registry->output->replaceMacros($content);
//-----------------------------------------
// Return content..
//-----------------------------------------
return $content ? $this->registry->getClass('output')->getTemplate('profile')->tabPosts($content) : $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_posts_to_show');
}
示例10: _showLeaders
//.........這裏部分代碼省略.........
$r = IPSMember::buildDisplayData($r);
$r = IPSMember::getLocation($r);
$members[strtolower($r['members_display_name'])] = $r;
}
}
//-----------------------------------------
// Get all groups.. (two is more eff. than 1)
//-----------------------------------------
$this->DB->build(array('select' => 'm.*, m.member_id as user_member_id', 'from' => array('members' => 'm'), 'where' => "m.member_group_id IN(" . implode(',', $group_ids) . ")", 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 's.*', 'from' => array('sessions' => 's'), 'where' => 's.member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$r['member_id'] = $r['user_member_id'];
$r = IPSMember::buildDisplayData($r);
if (substr($r['login_anonymous'], 0, 1)) {
$r['online_extra'] = '';
} else {
$r = IPSMember::getLocation($r);
}
$members[strtolower($r['members_display_name'])] = $r;
}
ksort($members);
//-----------------------------------------
// PRINT: Admins
//-----------------------------------------
$admins = array();
$supmods = array();
foreach ($members as $member) {
if ($this->caches['group_cache'][$member['member_group_id']]['g_access_cp']) {
$member['forums'] = $this->lang->words['leader_all_forums'];
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $member['member_id'];
$admins[] = $member;
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['leader_admins'], $admins);
//-----------------------------------------
// PRINT: Super Moderators
//-----------------------------------------
foreach ($members as $member) {
if ($this->caches['group_cache'][$member['member_group_id']]['g_is_supmod'] and !in_array($member['member_id'], $used_ids)) {
$member['forums'] = $this->lang->words['leader_all_forums'];
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $member['member_id'];
$supmods[] = $member;
}
}
if (count($supmods)) {
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['leader_global'], $supmods);
}
//-----------------------------------------
// GET MODERATORS: Normal
//-----------------------------------------
$tmp_html = "";
foreach ($members as $member) {
if (!in_array($member['member_id'], $used_ids)) {
foreach ($this->cache->getCache('moderators') as $data) {
if ($data['is_group'] and $data['group_id'] == $member['member_group_id']) {
if (IPSMember::checkPermissions('read', $data['forum_id']) == TRUE) {
$moderators[] = array_merge($member, array('forum_id' => $data['forum_id']));
}
$used_ids[] = $member['member_id'];
} else {
if ($data['member_id'] == $member['member_id']) {
if (IPSMember::checkPermissions('read', $data['forum_id']) == TRUE) {
$moderators[] = array_merge($member, array('forum_id' => $data['forum_id']));
}
$used_ids[] = $member['member_id'];
}
}
}
}
}
//-----------------------------------------
// Parse moderators
//-----------------------------------------
if (count($moderators) > 0) {
$mod_array = array();
foreach ($moderators as $i) {
if (!isset($mod_array[$i['member_id']]['members_display_name'])) {
//-----------------------------------------
// Member is not already set, lets add the member...
//-----------------------------------------
$mod_array[$i['member_id']] = $i;
}
//-----------------------------------------
// Add forum..
//-----------------------------------------
$mod_array[$i['member_id']]['forums'][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
}
if (count($mod_array)) {
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['leader_mods'], $mod_array);
}
}
$this->registry->output->setTitle($this->lang->words['forum_leaders']);
$this->registry->output->addNavigation($this->lang->words['forum_leaders'], '');
}
示例11: showFormAttachments
/**
* Show the attachments form
*
* @access public
* @author Matt Mecham
* @return string Processed HTML
*/
public function showFormAttachments()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$start = intval($this->request['st']);
$perpage = 15;
$sort_key = "";
$attachments = array();
$this->hide_form_and_save_button = 1;
//-----------------------------------------
// Sort it
//-----------------------------------------
switch ($this->request['sort']) {
case 'date':
$sort_key = 'a.attach_date ASC';
$info['date_order'] = 'rdate';
$info['size_order'] = 'size';
break;
case 'rdate':
$sort_key = 'a.attach_date DESC';
$info['date_order'] = 'date';
$info['size_order'] = 'size';
break;
case 'size':
$sort_key = 'a.attach_filesize DESC';
$info['date_order'] = 'date';
$info['size_order'] = 'rsize';
break;
case 'rsize':
$sort_key = 'a.attach_filesize ASC';
$info['date_order'] = 'date';
$info['size_order'] = 'size';
break;
default:
$sort_key = 'a.attach_date DESC';
$info['date_order'] = 'date';
$info['size_order'] = 'size';
break;
}
//-----------------------------------------
// Get some stats...
//-----------------------------------------
$maxspace = intval($this->memberData['g_attach_max']);
if ($this->memberData['g_attach_max'] == -1) {
$this->registry->getClass('output')->showError('no_permission_to_attach', 1010);
}
//-----------------------------------------
// Limit by forums
//-----------------------------------------
$stats = $this->DB->buildAndFetch(array('select' => 'count(*) as count, sum(attach_filesize) as sum', 'from' => 'attachments', 'where' => 'attach_member_id=' . $this->memberData['member_id'] . " AND attach_rel_module IN( 'post', 'msg' )"));
if ($maxspace > 0) {
//-----------------------------------------
// Figure out percentage used
//-----------------------------------------
$info['has_limit'] = 1;
$info['full_percent'] = $stats['sum'] ? sprintf("%.0f", $stats['sum'] / ($maxspace * 1024) * 100) : 0;
if ($info['full_percent'] > 100) {
$info['full_percent'] = 100;
} else {
if ($info['full_percent'] < 1 and $stats['count'] > 0) {
$info['full_percent'] = 1;
}
}
$info['attach_space_count'] = sprintf($this->lang->words['attach_space_count'], intval($stats['count']), intval($info['full_percent']));
$info['attach_space_used'] = sprintf($this->lang->words['attach_space_used'], IPSLib::sizeFormat(intval($stats['sum'])), IPSLib::sizeFormat($maxspace * 1024));
} else {
$info['has_limit'] = 0;
$info['attach_space_used'] = sprintf($this->lang->words['attach_space_unl'], IPSLib::sizeFormat(intval($stats['sum'])));
}
//-----------------------------------------
// Pages
//-----------------------------------------
$pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $stats['count'], 'itemsPerPage' => $perpage, 'currentStartValue' => $start, 'baseUrl' => "app=core&module=usercp&tab=core&area=attachments&sort=" . $this->request['sort'] . ""));
//-----------------------------------------
// Get attachments...
//-----------------------------------------
$this->DB->build(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "a.attach_member_id=" . $this->memberData['member_id'] . " AND a.attach_rel_module IN( 'post', 'msg' )", 'order' => $sort_key, 'limit' => array($start, $perpage), 'add_join' => array(array('select' => 'p.topic_id', 'from' => array('posts' => 'p'), 'where' => 'p.pid=a.attach_rel_id', 'type' => 'left'), array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'))));
$outer = $this->DB->execute();
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_topic'), 'forums');
$cache = $this->cache->getCache('attachtypes');
while ($row = $this->DB->fetch($outer)) {
if (IPSMember::checkPermissions('read', $row['forum_id']) != TRUE) {
$row['title'] = $this->lang->words['attach_topicmoved'];
}
//-----------------------------------------
// Full attachment thingy
//-----------------------------------------
if ($row['attach_rel_module'] == 'post') {
$row['_type'] = 'post';
} else {
if ($row['attach_rel_module'] == 'msg') {
//.........這裏部分代碼省略.........
示例12: _multiMergePost
/**
* Post multi-mod: Merge posts
*
* @access private
* @return void [Outputs to screen]
*/
private function _multiMergePost()
{
$this->_resetModerator($this->topic['forum_id']);
$this->_genericPermissionCheck('delete_post');
if (count($this->pids) < 2) {
$this->_showError('mod_only_one_pid', 10383);
}
//-----------------------------------------
// Form or print?
//-----------------------------------------
if (!$this->request['checked']) {
//-----------------------------------------
// Get post data
//-----------------------------------------
$master_post = "";
$dropdown = array();
$authors = array();
$seen_author = array();
$upload_html = "";
$seoTitle = '';
//-----------------------------------------
// Grab teh posts
//-----------------------------------------
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN (" . implode(",", $this->pids) . ")", 'add_join' => array(array('select' => 't.forum_id, t.title_seo', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($p = $this->DB->fetch($outer)) {
if (IPSMember::checkPermissions('read', $p['forum_id']) == TRUE) {
$master_post .= "<br /><br />" . $p['post'];
$dropdown[] = array($p['pid'], ipsRegistry::getClass('class_localization')->getDate($p['post_date'], 'LONG') . " (#{$p['pid']})");
if (!in_array($p['author_id'], $seen_author)) {
$authors[] = array($p['author_id'], "{$p['author_name']} (#{$p['pid']})");
$seen_author[] = $p['author_id'];
}
$seoTitle = $p['title_seo'];
}
}
//-----------------------------------------
// Get Attachment Data
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode(",", $this->pids) . ")"));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$row['image'] = $this->caches['attachtypes'][$row['attach_ext']]['atype_img'];
$row['size'] = IPSLib::sizeFormat($row['attach_filesize']);
$row['attach_file'] = IPSText::truncate($row['attach_file'], 50);
$attachments[] = $row;
}
//-----------------------------------------
// Print form
//-----------------------------------------
if (IPSText::getTextClass('editor')->method == 'rte') {
IPSText::getTextClass('bbcode')->parse_wordwrap = 0;
IPSText::getTextClass('bbcode')->parse_html = 0;
$master_post = IPSText::getTextClass('bbcode')->convertForRTE(trim($master_post));
} else {
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_nl2br = 0;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
if (IPSText::getTextClass('bbcode')->parse_html) {
if (!IPSText::getTextClass('bbcode')->parse_nl2br) {
$master_post = str_replace(array('<br />', '<br>'), "", trim($master_post));
}
}
$master_post = IPSText::getTextClass('bbcode')->preEditParse($master_post);
}
$editor = IPSText::getTextClass('editor')->showEditor($master_post, 'Post');
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergePostForm($editor, $dropdown, $authors, $attachments, $seoTitle);
if ($this->topic['tid']) {
$this->registry->getClass('output')->addNavigation($this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}");
}
$this->registry->getClass('output')->addNavigation($this->lang->words['cm_title'], '');
$this->registry->getClass('output')->setTitle($this->lang->words['cm_title']);
$this->registry->output->addContent($this->output);
$this->registry->getClass('output')->sendOutput();
} else {
//-----------------------------------------
// DO THE THING, WITH THE THING!!
//-----------------------------------------
$this->request['postdate'] = intval($this->request['postdate']);
if (!$this->request['selectedpids'] or !$this->request['postdate'] or !$this->request['postauthor'] or !$this->request['Post']) {
$this->_showError('mod_merge_posts', 10384);
}
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
$post = IPSText::getTextClass('editor')->processRawPost('Post');
$post = IPSText::getTextClass('bbcode')->preDbParse($post);
//-----------------------------------------
// Post to keep...
//-----------------------------------------
$posts = array();
//.........這裏部分代碼省略.........