function __f__f9ff587963c28431eafbee59e188371c($id = null) { $_ips___x_retval = ''; $__iteratorCount = 0; foreach (array('facebook', 'twitter') as $service) { $prefs = is_array($prefs) ? $prefs : IPSMember::getFromMemberCache($this->memberData, 'postSocialPrefs'); $__iteratorCount++; $_ips___x_retval .= "\n\t\t\t\t\t\t" . (IPSMember::canSocialShare($service) ? "<li class='ipsField ipsField_checkbox left' style='margin-right: 40px'>\n\t\t\t\t<input type=\"checkbox\" name=\"{$id}share_x_{$service}\" class=\"input_check _share_x_\" value=\"yes\" id='{$id}share_x_{$service}' " . (!empty($_REQUEST['share_' . $service]) || !empty($prefs[$service]) ? "checked='checked'" : "") . " /> \n\t\t\t\t<span class='' data-tooltip='" . sprintf($this->lang->words['gbl_post_to_x_tt'], UCFirst($service)) . "'>\n\t\t\t\t\t<label for='{$id}share_x_{$service}'> <img src=\"{$this->settings['public_dir']}style_extra/sharelinks/{$service}.png\" style='vertical-align:top' alt='' /> " . sprintf($this->lang->words['gbl_post_to_x'], UCFirst($service)) . "</label>\n\t\t\t\t</span>\n\t\t\t</li>" : "") . "\n\t\t\n"; } $_ips___x_retval .= ''; unset($__iteratorCount); return $_ips___x_retval; }
/** * Returns a complete topic * * @param int Member ID * @param string Folder ID (eg: inbox, sent, etc) * @param array Array of data ( array[ sort => '', offsetStart' => '', 'offsetEnd' => '' ) * @return array Array of PMs indexed by PM ID * * <code> * Exception Codes * NO_READ_PERMISSION You do not have permission to read the topic * YOU_ARE_BANNED You have been banned * </code> */ public function fetchConversation($topicID, $readingMemberID, $filters = array()) { //----------------------------------------- // INIT //----------------------------------------- $readingMemberID = intval($readingMemberID); $topicID = intval($topicID); $oStart = intval($filters['offsetStart']); $oEnd = intval($filters['offsetEnd']); $replyData = array(); $topicData = array(); $remapData = array(); $memberData = array(); $missingMembers = array(); $whereExtra = ''; //----------------------------------------- // Figure out sort key //----------------------------------------- switch ($filters['sort']) { case 'rdate': $sortKey = 'msg.msg_date DESC'; break; default: $sortKey = 'msg.msg_date ASC'; break; } if (!$topicID) { return array('topicData' => $topicData, 'replyData' => $replyData); } else { /* Get member data */ $memberData = $this->fetchTopicParticipants($topicID, TRUE); /* Get reading member's data */ $readingMemberData = $memberData[$readingMemberID]; /* Fetch topic data */ $topicData = $this->fetchTopicData($topicID, FALSE); /* Topic deleted? Grab topic starter details, as they won't be in the participant array */ if ($topicData['mt_is_deleted'] and $topicData['mt_starter_id'] > 0) { $memberData[$topicData['mt_starter_id']] = IPSMember::load($topicData['mt_starter_id'], 'all'); $memberData[$topicData['mt_starter_id']]['_canBeBlocked'] = IPSMember::isIgnorable($memberData[$topicData['mt_starter_id']]['member_group_id'], $memberData[$topicData['mt_starter_id']]['mgroup_others'], 'pm'); $memberData[$topicData['mt_starter_id']] = IPSMember::buildDisplayData($memberData[$topicData['mt_starter_id']], array('__all__' => 1)); $memberData[$topicData['mt_starter_id']]['map_user_active'] = 1; /* Set flag for topic participant starter */ $memberData[$topicData['mt_starter_id']]['map_is_starter'] = 1; foreach ($memberData as $id => $data) { $memberData[$id]['_topicDeleted'] = 1; } } /* Can access this topic? */ if ($this->canAccessTopic($readingMemberID, $topicData, $memberData) !== TRUE) { /* Banned? */ if ($readingMemberData['map_user_banned']) { throw new Exception("YOU_ARE_BANNED"); } else { throw new Exception("NO_READ_PERMISSION"); } } /* Reply Data */ $this->DB->build(array('select' => 'msg.*', 'from' => array('message_posts' => 'msg'), 'where' => "msg.msg_topic_id=" . $topicID . $whereExtra, 'order' => $sortKey, 'limit' => array($oStart, $oEnd), 'add_join' => array(array('select' => 'iu.*', 'from' => array('ignored_users' => 'iu'), 'where' => 'iu.ignore_owner_id=' . $readingMemberID . ' AND iu.ignore_ignore_id=msg.msg_author_id', 'type' => 'left'), array('select' => 'm.member_group_id, m.mgroup_others', 'from' => array('members' => 'm'), 'where' => 'm.member_id=msg.msg_author_id', 'type' => 'left')))); $o = $this->DB->execute(); //----------------------------------------- // Get the messages //----------------------------------------- while ($msg = $this->DB->fetch($o)) { $msg['_ip_address'] = ""; /* IP Address */ if ($msg['msg_ip_address'] and $readingMemberData['g_is_supmod'] == 1) { $msg['_ip_address'] = $msg['msg_ip_address']; } /* Edit */ $msg['_canEdit'] = $this->_conversationCanEdit($msg, $topicData, $readingMemberData); /* Delete */ $msg['_canDelete'] = $this->_conversationCanDelete($msg, $topicData, $readingMemberData); /* Format Message */ $msg['msg_post'] = $this->_formatMessageForDisplay($msg['msg_post'], $msg); /* Member missing? */ if (!isset($memberData[$msg['msg_author_id']])) { if (!$msg['msg_author_id']) { $memberData[0] = array(); } else { $missingMembers[$msg['msg_author_id']] = $msg['msg_author_id']; } } else { if (!empty($memberData[$msg['msg_author_id']]['signature'])) { if (!$this->memberData['view_sigs'] || $msg['msg_author_id'] && $this->memberData['member_id'] && !empty($this->member->ignored_users[$msg['msg_author_id']]['ignore_signatures'])) { $memberData[$msg['msg_author_id']]['signature'] = ''; } } } $replyData[$msg['msg_id']] = $msg; } } /* Members who've deleted a closed conversation? */ if (count($missingMembers)) { $_members = IPSMember::load(array_keys($missingMembers), 'all'); foreach ($_members as $id => $data) { $data['_canBeBlocked'] = IPSMember::isIgnorable($memberData[$topicData['mt_starter_id']]['member_group_id'], $memberData[$topicData['mt_starter_id']]['mgroup_others'], 'pm'); $data['map_user_active'] = 0; $memberData[$data['member_id']] = IPSMember::buildDisplayData($data, array('__all__' => 1)); } } /* Update reading member's read time */ $this->DB->update('message_topic_user_map', array('map_read_time' => time(), 'map_has_unread' => 0), 'map_user_id=' . intval($readingMemberData['member_id']) . ' AND map_topic_id=' . $topicID); /* Reduce the number of 'new' messages */ $_newMsgs = intval($this->getPersonalTopicsCount($readingMemberID, 'new')); if ($memberData[$readingMemberID]['map_has_unread']) { $lastReset = intval(IPSMember::getFromMemberCache($memberData[$readingMemberID], 'msgAlertReset')); $msgAlertCount = intval($this->getPersonalTopicsCount($readingMemberID, 'new', $lastReset)); $_pc = $this->rebuildFolderCount($readingMemberID, array('new' => $_newMsgs), TRUE); IPSMember::save($readingMemberID, array('core' => array('msg_count_new' => $msgAlertCount, 'msg_show_notification' => 0))); /* is this us? */ if ($readingMemberID == $this->memberData['member_id']) { /* Reset folder data */ $this->_dirData = $this->explodeFolderData($_pc); /* Reset global new count */ $this->memberData['msg_count_new'] = $msgAlertCount; } } /* Clean up topic title */ $topicData['mt_title'] = str_replace('[attachmentid=', '[attachmentid=', $topicData['mt_title']); /* Flag externals as read */ $this->_flagAsReadForExternals(array($topicID)); /* Ensure our read time is updated */ $memberData[$readingMemberID]['map_read_time'] = time(); /* Do we have a deleted user? */ if (isset($memberData[0]) and $memberData[0]['member_id'] == 0) { $memberData[0] = IPSMember::buildDisplayData(IPSMember::setUpGuest($this->lang->words['deleted_user']), array('__all__' => 1)); } //----------------------------------------- // Attachments? //----------------------------------------- if ($topicData['mt_hasattach']) { //----------------------------------------- // INIT. Yes it is //----------------------------------------- $postHTML = array(); //----------------------------------------- // Separate out post content //----------------------------------------- foreach ($replyData as $id => $post) { $postHTML[$id] = $post['msg_post']; } 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 = 'msg'; $this->class_attach->init(); $attachHTML = $this->class_attach->renderAttachments($postHTML); /* Now parse back in the rendered posts */ foreach ($attachHTML as $id => $data) { /* Get rid of any lingering attachment tags */ if (stristr($data['html'], "[attachment=")) { $data['html'] = IPSText::stripAttachTag($data['html']); } $replyData[$id]['msg_post'] = $data['html']; $replyData[$id]['attachmentHtml'] = $data['attachmentHtml']; } } /* Check to make sure we're not the only one left with this topic */ $active = 0; foreach ($memberData as $id => $data) { if ($id !== $readingMemberID) { if ($data['map_user_active']) { $active++; break; // 1 active is enough } } } if (!$active) { $topicData['_everyoneElseHasLeft'] = 1; } /* Return */ return array('topicData' => $topicData, 'replyData' => $replyData, 'memberData' => $memberData); }
/** * View new posts since your last visit * * @return @e void */ public function viewNewContent() { IPSSearchRegistry::set('in.search_app', $this->request['search_app']); /* Fetch member cache to see if we have a value set */ $vncPrefs = IPSMember::getFromMemberCache($this->memberData, 'vncPrefs'); /* Guests */ if (!$this->memberData['member_id'] and (!$this->request['period'] or $this->request['period'] == 'unread')) { $this->request['period'] = 'today'; } /* In period */ if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or !empty($this->request['period']) and isset($this->request['change'])) { $vncPrefs[IPSSearchRegistry::get('in.search_app')]['view'] = !empty($this->request['period']) ? $this->request['period'] : $this->settings['default_vnc_method']; } /* Follow filter enabled */ if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or isset($this->request['followedItemsOnly'])) { $vncPrefs[IPSSearchRegistry::get('in.search_app')]['vncFollowFilter'] = !empty($this->request['followedItemsOnly']) ? 1 : 0; } /* User mode */ if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or isset($this->request['userMode'])) { $vncPrefs[IPSSearchRegistry::get('in.search_app')]['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : ''; } /* Set filters up */ IPSSearchRegistry::set('forums.vncForumFilters', $vncPrefs['forums']['vnc_forum_filter']); IPSSearchRegistry::set('in.period', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']); IPSSearchRegistry::set('in.vncFollowFilterOn', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['vncFollowFilter']); IPSSearchRegistry::set('in.userMode', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['userMode']); /* Update member cache */ if (isset($this->request['period']) and isset($this->request['change'])) { IPSMember::setToMemberCache($this->memberData, array('vncPrefs' => $vncPrefs)); } IPSDebug::addMessage(var_export($vncPrefs, true)); IPSDebug::addMessage('Using: ' . IPSSearchRegistry::get('in.period')); /* Can we do this? */ if (IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'vnc') || IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'active')) { /* Can't do a specific unread search, so */ if (IPSSearchRegistry::get('in.period') == 'unread' && !IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'vncWithUnreadContent')) { IPSSearchRegistry::set('in.period', 'lastvisit'); } /* Perform the search */ $this->searchController->viewNewContent(); /* Get count */ $count = $this->searchController->getResultCount(); /* Get results which will be array of IDs */ $results = $this->searchController->getResultSet(); /* Get templates to use */ $template = $this->searchController->fetchTemplates(); /* Fetch sort details */ $sortDropDown = $this->searchController->fetchSortDropDown(); /* Fetch sort details */ $sortIn = $this->searchController->fetchSortIn(); /* Reset for template */ $this->_resetRequestParameters(); if (IPSSearchRegistry::get('in.start') > 0 and !count($results)) { $new_url = 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid']; $new_url .= '&st=' . (IPSSearchRegistry::get('in.start') - IPSSearchRegistry::get('opt.search_per_page')) . '&search_app_filters[' . IPSSearchRegistry::get('in.search_app') . '][searchInKey]=' . $this->request['search_app_filters'][IPSSearchRegistry::get('in.search_app')]['searchInKey']; $this->registry->output->silentRedirect($this->settings['base_url'] . $new_url); } /* Parse result set */ $results = $this->registry->output->getTemplate($template['group'])->{$template}['template']($results, IPSSearchRegistry::get('opt.searchType') == 'titles' || IPSSearchRegistry::get('opt.noPostPreview') ? 1 : 0); /* Build pagination */ $links = $this->registry->output->generatePagination(array('totalItems' => $count, 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'), 'currentStartValue' => IPSSearchRegistry::get('in.start'), 'baseUrl' => 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . $this->_returnSearchAppFilters())); /* Showing */ $showing = array('start' => IPSSearchRegistry::get('in.start') + 1, 'end' => IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') > $count ? $count : IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page')); } else { $count = 0; $results = array(); } /* Add Debug message */ IPSDebug::addMessage("View New Content Matches: " . $count); /* Check for sortIn */ if (count($sortIn) && !$this->request['search_app_filters'][$this->request['search_app']]['searchInKey']) { $this->request['search_app_filters'][$this->request['search_app']]['searchInKey'] = $sortIn[0][0]; } /* Output */ $this->title = $this->lang->words['new_posts_title']; $this->registry->output->addNavigation($this->lang->words['new_posts_title'], ''); $this->output .= $this->registry->output->getTemplate('search')->newContentView($results, $links, $count, $sortDropDown, $sortIn, IPSSearchRegistry::get('set.resultCutToDate')); }
/** * Show the form to configure VNC forum filters * * @return @e void */ public function showForm() { $_data = $this->_getData(); $vncPrefs = IPSMember::getFromMemberCache($this->memberData, 'vncPrefs'); $fFP = $vncPrefs == null ? null : (empty($vncPrefs['forums']['vnc_forum_filter']) ? null : $vncPrefs['forums']['vnc_forum_filter']); $this->returnHtml($this->registry->output->getTemplate('search')->forumsVncFilters($_data, $fFP)); }