/** * return HTML block * * @access public * @param array Member information * @return string HTML block */ public function return_html_block($member = array()) { /* Get blog API */ require_once IPS_ROOT_PATH . 'api/api_core.php'; require_once IPS_ROOT_PATH . 'api/blog/api_blog.php'; /* Create API Object */ $blog_api = new apiBlog(); /* Language */ $this->lang->loadLanguageFile(array('public_portal'), 'blog'); $content = ''; $blog_url = $blog_api->getBlogUrl($blog_api->getBlogID($member['member_id'])); $this->lang->words['visit_blog'] = "<a href=\"{$blog_url}\">{$this->lang->words['visit_blog']}</a>"; $entry_content = ''; $entries = $blog_api->lastXEntries('member', $member['member_id'], 5); if (is_array($entries) && count($entries)) { $attachments = 0; $entry_ids = array(); foreach ($entries as $row) { $row['_post_date'] = ipsRegistry::getClass('class_localization')->getDate($row['entry_date'], 'SHORT'); $row['_date_array'] = IPSTime::date_getgmdate($row['entry_date'] + ipsRegistry::getClass('class_localization')->getTimeOffset()); $entry_ids[$row['entry_id']] = $row['entry_id']; IPSText::getTextClass('bbcode')->parse_html = $row['entry_html_state'] ? 1 : 0; IPSText::getTextClass('bbcode')->parse_nl2br = $row['entry_html_state'] == 2 ? 1 : 0; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'blog'; $row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['entry']); $row['post'] = IPSText::getTextClass('bbcode')->memberViewImages($row['post']); if ($row['entry_has_attach']) { $parseAttachments = true; } $entry_content .= $this->registry->output->getTemplate('profile')->tabSingleColumn($row, $this->lang->words['readentry'], $row['entry_url'], $row['entry_name']); } //----------------------------------------- // 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 = 'blogentry'; $this->class_attach->init(); $entry_content = $this->class_attach->renderAttachments($entry_content, $entry_ids, 'blog_show'); $entry_content = $entry_content[0]['html']; } $content = $this->registry->output->getTemplate('blog_portal')->profileTabWrap($this->lang->words['visit_blog'], $entry_content); } else { $content .= $this->registry->output->getTemplate('profile')->tabNoContent('noblogentries'); } //----------------------------------------- // Return content.. //----------------------------------------- return $content; }
/** * Builds the html for the monthly events * * @param int $month Numeric value of the month to get events from * @param int $year Year to get events from * @param bool $minical Set to 1 if this is for the minicalendar * @return string Calendar HTML output */ public function getMonthEvents($month, $year, $minical = false) { //----------------------------------------- // Init //----------------------------------------- $birthdays = array(); //----------------------------------------- // Work out timestamps //----------------------------------------- $our_datestamp = gmmktime(12, 0, 0, $month, 1, $year); $_firstDay = gmdate('w', $our_datestamp); if ($this->settings['ipb_calendar_mon']) { $_firstDay = $_firstDay == 0 ? 7 : $_firstDay; } //----------------------------------------- // Get the birthdays from the database //----------------------------------------- if ($this->settings['show_bday_calendar'] and !$minical) { $birthdays = $this->_getBirthdaysForMonth($month); } //----------------------------------------- // Get the events //----------------------------------------- if (!$minical) { $this->calendarGetEventsSQL($month, $year); } //----------------------------------------- // Get events //----------------------------------------- $seen_days = array(); $seen_events = array(); $output = ""; //----------------------------------------- // Loop (42 is 7 days x 6 "weeks" potential) //----------------------------------------- for ($c = 0; $c < 42; $c++) { //----------------------------------------- // Get data for each day //----------------------------------------- list($_year, $_month, $_day) = explode('-', gmstrftime('%Y-%m-%d', $our_datestamp)); $day_array = IPSTime::date_getgmdate($our_datestamp); //----------------------------------------- // If this is a new week, reset row //----------------------------------------- if ($c % 7 == 0) { //----------------------------------------- // Kill the loop if we are no longer on our month //----------------------------------------- if ($day_array['mon'] != $month) { break; } $output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_new_row($our_datestamp, $this->calendar) : $this->registry->output->getTemplate('calendar')->cal_new_row($our_datestamp, $this->calendar); } $_c = $this->settings['ipb_calendar_mon'] ? $c + 1 : $c; //----------------------------------------- // Run out of legal days for this month? // Or have we yet to get to the first day? //----------------------------------------- if ($_c < $_firstDay or $day_array['mon'] != $month) { $output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_blank_cell() : $this->registry->output->getTemplate('calendar')->cal_blank_cell(); } else { if (isset($seen_days[$day_array['yday']])) { $our_datestamp += 86400; continue; } $seen_days[$day_array['yday']] = true; $tmp_cevents = array(); $this_day_events = ""; $_hasQueued = false; //----------------------------------------- // Get events //----------------------------------------- if (!$minical) { $events = $this->calendarGetDayEvents($_month, $_day, $_year); if (is_array($events) and count($events)) { foreach ($events as $event) { if (empty($seen_events[$_month . '-' . $_day . '-' . $_year][$event['event_id']])) { //$event = $this->calendarMakeEventHTML( $event, true ); if (isset($event['recurring'])) { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap_recurring($event, 'month'); } else { if (isset($event['ranged'])) { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap_range($event, 'month'); } else { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap($event, 'month'); } } $seen_events[$_month . '-' . $_day . '-' . $_year][$event['event_id']] = 1; //----------------------------------------- // Queued events? //----------------------------------------- if (!$event['event_approved'] and $this->memberData['g_is_supmod']) { $_hasQueued = true; } } } //----------------------------------------- // How many events? //----------------------------------------- if (count($tmp_cevents) > $this->calendar['cal_event_limit']) { $this_day_events = $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual(array('url' => "cal_id={$this->calendar['cal_id']}&do=showday&y=" . $_year . "&m=" . $_month . "&d=" . $_day, 'template' => 'cal_day', 'title' => $this->calendar['cal_title_seo']), sprintf($this->lang->words['show_n_events'], intval(count($tmp_cevents)))); } else { if (count($tmp_cevents)) { $this_day_events = implode("\n", $tmp_cevents); } } } //----------------------------------------- // Birthdays //----------------------------------------- if ($this->calendar['cal_bday_limit']) { if (isset($birthdays[$_day]) and count($birthdays[$_day]) > 0) { $no_bdays = count($birthdays[$_day]); if ($no_bdays <= $this->calendar['cal_bday_limit']) { foreach ($birthdays[$_day] as $user) { $this_day_events .= $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual(array('url' => "cal_id={$this->calendar['cal_id']}&do=showday&y=" . $_year . "&m=" . $_month . "&d=" . $_day, 'template' => 'cal_day', 'title' => $this->calendar['cal_title_seo']), $user['members_display_name'] . $this->lang->words['bd_birthday']); } } else { $this_day_events .= $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual(array('url' => "cal_id={$this->calendar['cal_id']}&do=showday&y=" . $_year . "&m=" . $_month . "&d=" . $_day, 'template' => 'cal_day', 'title' => $this->calendar['cal_title_seo']), sprintf($this->lang->words['entry_birthdays'], $no_bdays)); } } } } //----------------------------------------- // If we have events, show them //----------------------------------------- $_dateLink = ''; $_queueLink = ''; $_dateLink = array('url' => "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showday&y=" . $year . "&m=" . $month . "&d=" . $day_array['mday'], 'seotitle' => $this->calendar['cal_title_seo'], 'template' => 'cal_day', 'day' => $day_array['mday']); if ($this_day_events and !$minical) { $_queueLink = $this->registry->getClass('output')->buildSEOUrl("app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showday&y=" . $year . "&m=" . $month . "&d=" . $day_array['mday'] . "&modfilter=queued", 'public', $this->calendar['cal_title_seo'], 'cal_day'); $this_day_events = $this->registry->output->getTemplate('calendar')->eventsWrapper($this_day_events); } /* Apply TZ offset so that we show the correct 'today' */ if ($day_array['mday'] == strftime('%d', time() + $this->lang->getTimeOffset()) and $day_array['mon'] == strftime('%m', time() + $this->lang->getTimeOffset()) and $day_array['year'] == strftime('%Y', time() + $this->lang->getTimeOffset())) { $output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_date_cell_today($_dateLink) : $this->registry->output->getTemplate('calendar')->cal_date_cell_today($_dateLink, $this_day_events, $_queueLink, $_hasQueued, $this->_buildDayID($this->chosen_date['year'], $this->chosen_date['month'], $_day)); } else { $output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_date_cell($_dateLink) : $this->registry->output->getTemplate('calendar')->cal_date_cell($_dateLink, $this_day_events, $_queueLink, $_hasQueued, $this->_buildDayID($this->chosen_date['year'], $this->chosen_date['month'], $_day)); } $our_datestamp += 86400; } } return $output; }
function convert_calevents() { $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0; $lend = 50; $end = $start + $lend; //----------------------------------------- // In steps... //----------------------------------------- if (!$this->DB->checkForTable('calendar_events')) { $this->registry->output->addMessage("No calendar events found, Creating new IPB 2.1 skin..."); $this->request['workact'] = 'skin'; return FALSE; } $this->DB->build(array('select' => '*', 'from' => 'calendar_events', 'limit' => array($start, $lend))); $o = $this->DB->execute(); //----------------------------------------- // Do it... //----------------------------------------- if ($this->DB->getTotalRows($o)) { //----------------------------------------- // Got some to convert! //----------------------------------------- while ($r = $this->DB->fetch($o)) { $recur_remap = array('w' => 1, 'm' => 2, 'y' => 3); $begin_date = IPSTime::date_getgmdate($r['unix_stamp']); $end_date = IPSTime::date_getgmdate($r['end_unix_stamp']); if (!$begin_date or !$end_date) { continue; } $day = $begin_date['mday']; $month = $begin_date['mon']; $year = $begin_date['year']; $end_day = $end_date['mday']; $end_month = $end_date['mon']; $end_year = $end_date['year']; $_final_unix_from = gmmktime(0, 0, 0, $month, $day, $year); //----------------------------------------- // Recur or ranged... //----------------------------------------- if ($r['event_repeat'] or $r['event_ranged']) { $_final_unix_to = gmmktime(11, 59, 59, $end_month, $end_day, $end_year); } else { $_final_unix_to = 0; } $new_event = array('event_calendar_id' => 1, 'event_member_id' => $r['userid'], 'event_content' => $r['event_text'], 'event_title' => $r['title'], 'event_smilies' => $r['show_emoticons'], 'event_perms' => $r['read_perms'], 'event_private' => $r['priv_event'], 'event_approved' => 1, 'event_unixstamp' => $r['unix_stamp'], 'event_recurring' => $r['event_repeat'] && $recur_remap[$r['repeat_unit']] ? $recur_remap[$r['repeat_unit']] : 0, 'event_tz' => 0, 'event_unix_from' => $_final_unix_from, 'event_unix_to' => $_final_unix_to); //----------------------------------------- // INSERT //----------------------------------------- $this->DB->insert('cal_events', $new_event); } $this->registry->output->addMessage("Calendar events: {$start} to {$end} completed...."); $this->request['workact'] = 'calevents'; $this->request['st'] = $end; return FALSE; } else { $this->registry->output->addMessage("Calendar events converted, Creating new IPB 2.1 skin..."); $this->request['workact'] = 'skin'; return FALSE; } }
/** * 2.1.0 Tools: Calendar Events * * @return @e void */ public function tools210Calevents() { $start = intval($_GET['st']); $lend = 50; $end = $start + $lend; $max = intval($_GET['max']); //----------------------------------------- // Check to make sure table exists //----------------------------------------- if (!$this->DB->checkForTable('calendar_events')) { $this->registry->output->global_message = $this->lang->words['re_calremoved']; $this->toolsSplashScreen(); return; } //----------------------------------------- // Do we need to run this tool? //----------------------------------------- if (!$max) { $original = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as max', 'from' => 'calendar_events')); $new = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as max', 'from' => 'cal_events')); if ($new['max'] >= $original['max'] or !$original['max']) { $this->registry->output->global_message = $this->lang->words['re_calalready']; $this->toolsSplashScreen(); } } $max = intval($original['max']); //----------------------------------------- // In steps... //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'calendar_events', 'limit' => array($start, $lend))); $o = $this->DB->execute(); //----------------------------------------- // Do it... //----------------------------------------- if ($this->DB->getTotalRows($o)) { //----------------------------------------- // Got some to convert! //----------------------------------------- while ($r = $this->DB->fetch($o)) { $recur_remap = array('w' => 1, 'm' => 2, 'y' => 3); $begin_date = IPSTime::date_getgmdate($r['unix_stamp']); $end_date = IPSTime::date_getgmdate($r['end_unix_stamp']); if (!$begin_date or !$end_date) { continue; } $day = $begin_date['mday']; $month = $begin_date['mon']; $year = $begin_date['year']; $end_day = $end_date['mday']; $end_month = $end_date['mon']; $end_year = $end_date['year']; $_final_unix_from = gmmktime(0, 0, 0, $month, $day, $year); //----------------------------------------- // Recur or ranged... //----------------------------------------- if ($r['event_repeat'] or $r['event_ranged']) { $_final_unix_to = gmmktime(23, 59, 59, $end_month, $end_day, $end_year); } else { $_final_unix_to = 0; } $new_event = array('event_calendar_id' => 1, 'event_member_id' => $r['userid'], 'event_content' => $r['event_text'], 'event_title' => $r['title'], 'event_smilies' => $r['show_emoticons'], 'event_perms' => $r['read_perms'], 'event_private' => $r['priv_event'], 'event_approved' => 1, 'event_unixstamp' => $r['unix_stamp'], 'event_recurring' => $r['event_repeat'] && $recur_remap[$r['repeat_unit']] ? $recur_remap[$r['repeat_unit']] : 0, 'event_tz' => 0, 'event_unix_from' => $_final_unix_from, 'event_unix_to' => $_final_unix_to); //----------------------------------------- // INSERT //----------------------------------------- $this->DB->insert('cal_events', $new_event); } $this->registry->output->global_message = sprintf($this->lang->words['re_calstartto'], $start, $end); $url = "{$this->settings['base_url']}{$this->form_code}&do=" . $this->request['do'] . '&max=' . $max . '&st=' . $end; } else { $this->registry->output->global_message = $this->lang->words['re_calsconverted']; $url = "{$this->settings['base_url']}{$this->form_code}&do=tools"; } //----------------------------------------- // Bye.... //----------------------------------------- $this->registry->output->redirect($url, $this->registry->output->global_message); }
/** * 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... //----------------------------------------- $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'); }
/** * Builds the html for the monthly events * * @access public * @param int $month Numeric value of the month to get events from * @param int $year Year to get events from * @param bool $minical Set to 1 if this is for the minicalendar * @return string Calendar HTML output */ public function getMonthEvents($month, $year, $minical = 0) { //----------------------------------------- // Reset shown events //----------------------------------------- $this->shown_events = array(); //----------------------------------------- // Work out timestamps //----------------------------------------- $our_datestamp = gmmktime(0, 0, 0, $month, 1, $year); $first_day_array = IPSTime::date_getgmdate($our_datestamp); if ($this->settings['ipb_calendar_mon']) { $first_day_array['wday'] = $first_day_array['wday'] == 0 ? 7 : $first_day_array['wday']; } //----------------------------------------- // Get the birthdays from the database //----------------------------------------- if ($this->settings['show_bday_calendar']) { $birthdays = array(); $this->calendarGetBirthdaySQL($month); $birthdays = $this->query_bday_cache[$month]; } //----------------------------------------- // Get the events //----------------------------------------- $this->calendarGetEventsSQL($month, $year); //----------------------------------------- // Get events //----------------------------------------- $seen_days = array(); $seen_ids = array(); $cal_output = ""; $calendar_data = array(); for ($c = 0; $c < 42; $c++) { //----------------------------------------- // Work out timestamps //----------------------------------------- $_year = gmdate('Y', $our_datestamp); $_month = gmdate('n', $our_datestamp); $_day = gmdate('j', $our_datestamp); $day_array = IPSTime::date_getgmdate($our_datestamp); $check_against = $c; if ($this->settings['ipb_calendar_mon']) { $check_against = $c + 1; } if ($c % 7 == 0) { //----------------------------------------- // Kill the loop if we are no longer on our month //----------------------------------------- if ($day_array['mon'] != $month) { break; } if ($minical) { $cal_output .= $this->registry->output->getTemplate('calendar')->mini_cal_new_row($our_datestamp); } else { $cal_output .= $this->registry->output->getTemplate('calendar')->cal_new_row($our_datestamp); } } //----------------------------------------- // Run out of legal days for this month? // Or have we yet to get to the first day? //----------------------------------------- if ($check_against < $first_day_array['wday'] or $day_array['mon'] != $month) { $cal_output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_blank_cell() : $this->registry->output->getTemplate('calendar')->cal_blank_cell(); } else { if (isset($seen_days[$day_array['yday']]) and $seen_days[$day_array['yday']] == 1) { continue; } $seen_days[$day_array['yday']] = 1; $tmp_cevents = array(); $this_day_events = ""; $cal_date = $day_array['mday']; $queued_event = 0; $cal_date_queued = ""; //----------------------------------------- // Get events //----------------------------------------- $events = $this->calendarGetDayEvents($_month, $_day, $_year); if (is_array($events) and count($events)) { foreach ($events as $event) { if (!isset($this->shown_events[$_month . '-' . $_day . '-' . $_year][$event['event_id']]) or !$this->shown_events[$_month . '-' . $_day . '-' . $_year][$event['event_id']]) { //----------------------------------------- // Recurring //----------------------------------------- if (isset($event['recurring'])) { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap_recurring($event); } else { if (isset($event['single'])) { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap($event); } else { $tmp_cevents[$event['event_id']] = $this->registry->output->getTemplate('calendar')->cal_events_wrap_range($event); } } $this->shown_events[$_month . '-' . $_day . '-' . $_year][$event['event_id']] = 1; //----------------------------------------- // Queued events? //----------------------------------------- if (!$event['event_approved'] and $this->can_moderate) { $queued_event = 1; } } } //----------------------------------------- // How many events? //----------------------------------------- if (count($tmp_cevents) >= $this->calendar['cal_event_limit']) { $this_day_events = $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual("cal_id={$this->calendar_id}&do=showday&y=" . $day_array['year'] . "&m=" . $day_array['mon'] . "&d=" . $day_array['mday'], sprintf($this->lang->words['show_n_events'], intval(count($tmp_cevents)))); } else { if (count($tmp_cevents)) { $this_day_events = implode("\n", $tmp_cevents); } } $tmp_cevents[] = array(); } //----------------------------------------- // Birthdays //----------------------------------------- if ($this->calendar['cal_bday_limit']) { if (isset($birthdays[$day_array['mday']]) and count($birthdays[$day_array['mday']]) > 0) { $no_bdays = count($birthdays[$day_array['mday']]); if ($no_bdays) { if ($this->calendar['cal_bday_limit'] and $no_bdays <= $this->calendar['cal_bday_limit']) { foreach ($birthdays[$day_array['mday']] as $user) { $this_day_events .= $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual("cal_id={$this->calendar_id}&do=birthdays&y=" . $day_array['year'] . "&m=" . $day_array['mon'] . "&d=" . $day_array['mday'], $user['members_display_name'] . $this->lang->words['bd_birthday']); } } else { $this_day_events .= $this->registry->output->getTemplate('calendar')->cal_events_wrap_manual("cal_id={$this->calendar_id}&do=birthdays&y=" . $day_array['year'] . "&m=" . $day_array['mon'] . "&d=" . $day_array['mday'], sprintf($this->lang->words['entry_birthdays'], $no_bdays)); } } } } //----------------------------------------- // Show it //----------------------------------------- if ($this_day_events != "") { $cal_date = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("app=calendar&module=calendar&cal_id={$this->calendar_id}&do=showday&y=" . $year . "&m=" . $month . "&d=" . $day_array['mday'], 'public', 'false', 'cal_day') . "'>{$day_array['mday']}</a>"; $cal_date_queued = "" . $this->settings['base_url'] . "app=calendar&cal_id={$this->calendar_id}&modfilter=queued&do=showday&y=" . $year . "&m=" . $month . "&d=" . $day_array['mday']; $this_day_events = $this->registry->output->getTemplate('calendar')->cal_events_start() . $this_day_events . $this->registry->output->getTemplate('calendar')->cal_events_end(); } if ($day_array['mday'] == $this->now_date['mday'] and $this->now_date['mon'] == $day_array['mon'] and $this->now_date['year'] == $day_array['year']) { $cal_output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_date_cell_today($cal_date, $this_day_events) : $this->registry->output->getTemplate('calendar')->cal_date_cell_today($cal_date, $this_day_events, $cal_date_queued, $queued_event, $this->_buildDayID($this->chosen_year, $this->chosen_month, $_day)); } else { $cal_output .= $minical ? $this->registry->output->getTemplate('calendar')->mini_cal_date_cell($cal_date, $this_day_events) : $this->registry->output->getTemplate('calendar')->cal_date_cell($cal_date, $this_day_events, $cal_date_queued, $queued_event, $this->_buildDayID($this->chosen_year, $this->chosen_month, $_day)); } unset($this_day_events); $our_datestamp += 86400; } } return $cal_output; }
/** * 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'); }