public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $messageinfo =& $this->content['visitormessage'][$activity['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $userinfo2 =& $this->content['user'][$messageinfo['userid']]; $messageinfo['preview'] = strip_quotes($messageinfo['pagetext']); $messageinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($messageinfo['preview'], false, true, true, true), vb::$vbulletin->options['as_snippet']))); $userinfo = $this->fetchUser($activity['userid'], $messageinfo['postusername']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_created_a_visitormessage_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_created_a_visitormessage_y_in_z'], $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('userinfo2', $userinfo2); $templater->register('linkinfo', array('vmid' => $messageinfo['vmid'])); $templater->register('linkinfo2', array('tab' => 'visitor_messaging')); $templater->register('activity', $activity); $templater->register('messageinfo', $messageinfo); return $templater->render(); } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $postinfo =& $this->content['cms_post'][$activity['contentid']]; $nodeinfo =& $this->content['cms_node'][$postinfo['nodeid']]; $articleinfo =& $this->content['cms_article'][$nodeinfo['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($postinfo['pagetext']); $articleinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); $articleinfo['fullurl'] = vB_Route::create('vBCms_Route_Content', $nodeinfo['nodeid'] . ($nodeinfo['url'] == '' ? '' : '-' . $nodeinfo['url']))->getCurrentURL(); $nodeinfo['parenturl'] = $this->fetchParentUrl($nodeinfo['parentnode']); $nodeinfo['parenttitle'] = $this->fetchParentTitle($nodeinfo['parentnode']); $userinfo = $this->fetchUser($activity['userid'], $postinfo['username']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_commented_on_an_article_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_an_article_y_in_z'], $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('postinfo', $postinfo); $templater->register('activity', $activity); $templater->register('nodeinfo', $nodeinfo); $templater->register('articleinfo', $articleinfo); return $templater->render(); } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $commentinfo =& $this->content['album_picturecomment'][$activity['contentid']]; $albuminfo =& $this->content['album'][$commentinfo['albumid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($commentinfo['pagetext']); $commentinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); $userinfo = $this->fetchUser($activity['userid'], $commentinfo['postusername']); $userinfo2 = $this->fetchUser($albuminfo['userid']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_commented_on_a_photo_in_album_y'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_a_photo_in_album_y'], $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('userinfo2', $userinfo2); $templater->register('activity', $activity); $templater->register('commentinfo', $commentinfo); $templater->register('albuminfo', $albuminfo); return $templater->render(); } }
private function strip_code($text) { $text = censor_text($text); strip_bbcode($text); $text = str_replace(array(""", "/", "\n", "\t", "\r"), ' ', $text); $text = preg_replace(array("|http(.*)jpg|isU", "@(http(s)?://)?(([a-z0-9.-]+)?[a-z0-9-]+(!?\\.[a-z]{2,4}))@"), ' ', $text); return preg_replace("/[^A-ZА-ЯЁ.,-–?]+/ui", " ", $text); }
public function test_s9e() { $phpbb_container = $this->get_test_case_helpers()->set_s9e_services(); $original = '<r><B><s>[b]</s>bold<e>[/b]</e></B></r>'; $expected = ' bold '; $actual = $original; strip_bbcode($actual); $this->assertSame($expected, $actual); }
function mobiquo_chop($string) { global $stylevar, $vbulletin; $string = preg_replace('/<br \\/\\>/', '', $string); $string = preg_replace('/(^\\s+)|(\\s+$)/', '', $string); $string = preg_replace('/\\n/', '', $string); $string = preg_replace('/\\r/', '', $string); $string = strip_quotes($string); $string = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($string, false, true), 200))); return $string; }
/** * Prepares properties for rendering. */ protected function prepareProperties() { parent::prepareProperties(); // vB_View_Content has already htmlspecialchars_uni($this->title) so we should not htmlspecialchars_uni again here. Fixed bug #29663 // $this->title = htmlspecialchars_uni($this->title); $this->css = new vB_View('vbcms_article_css'); $this->author_phrase = new vB_Phrase('vbcms', 'author'); if ($this->pagelist AND sizeof($this->pagelist) > 1) { // create a route $route = new vBCms_Route_Content(); $route->setSegments(array('node' => $this->nodesegment, 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View'))); $pagelist = $this->pagelist; $pagelist[1] = $this->title; $this->pagelist = $pagelist; $pages = array(); foreach ($this->pagelist AS $pagenum => $title) { $route->setParameter(0, $pagenum); $title = $title ? $title : new vB_Phrase('vbcms', 'page_x', $pagenum); // undo the 'stop_parse' from the [page] bbcode and strip bbcode and html $title = vbchop(strip_tags(strip_bbcode(str_replace(array('[', ']'), array('[', ']'), $title))), 75); $pages[$pagenum] = array( 'url' => $route->getCurrentURL(null, array($pagenum)), 'title' => htmlspecialchars_uni($title), 'selected' => ($pagenum == $this->current_page) ? 1 : 0 ); } if ($this->current_page > 1) { $this->prev_page_url = $pages[$this->current_page - 1]['url']; $this->prev_page_phrase = new vB_Phrase('vbcms', 'previous'); } if ($this->current_page < sizeof($pages)) { $this->next_page_url = $pages[$this->current_page + 1]['url']; $this->next_page_phrase = new vB_Phrase('vbcms', 'next'); } $this->pagelist = $pages; } else { $this->pagelist = false; } }
function get_short_content($post_id, $length = 200) { global $db; list($txt) = $db->sql_ufetchrow('SELECT post_text FROM ' . POSTS_TEXT_TABLE . ' WHERE post_id=' . $post_id); $txt = preg_replace('/\\[url.*?\\].*?\\[\\/url.*?\\]/', '[url]', $txt); $txt = preg_replace('/\\[img.*?\\].*?\\[\\/img.*?\\]/', '[img]', $txt); $txt = preg_replace('/[\\n\\r\\t]+/', ' ', $txt); strip_bbcode($txt); $txt = html_entity_decode($txt, ENT_QUOTES, 'UTF-8'); $txt = function_exists('mb_substr') ? mb_substr($txt, 0, $length) : substr($txt, 0, $length); return $txt; }
function construct_threaded_post_link($post, $imageString, $depth, $haschildren, $highlightpost = false) { global $vbulletin, $stylevar, $bgclass, $curpostid, $parent_postids, $morereplies, $threadedmode, $vbphrase, $postattach; global $threadinfo; // ugly static $lasttitle; //print_array($post); if ($threadedmode == 2 and $highlightpost) { $highlightpost = 1; } else { $highlightpost = 0; } // write 'more replies below' link if ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and $post['postid'] != $curpostid and $haschildren and ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and !strpos(' ,' . $curpostid . $parent_postids . ',', ',' . $post['postid'] . ','))) { $morereplies[$post['postid']] = 1; return "writeLink({$post['postid']}, " . fetch_statusicon_from_child_posts($post['postid']) . ", 0, 0, \"{$imageString}\", \"\", \"more\", \"\", {$highlightpost});\n"; } // get time fields $post['date'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1); $post['time'] = vbdate($vbulletin->options['timeformat'], $post['dateline']); // get status icon and paperclip $post['statusicon'] = iif($post['dateline'] > $threadinfo['threadview'], 1, 0); // get paperclip $post['paperclip'] = 0; if (is_array($postattach["{$post['postid']}"])) { foreach ($postattach["{$post['postid']}"] as $attachment) { if ($attachment['visible']) { $post['paperclip'] = 1; break; } } } // echo some text from the post if no title if ($post['isdeleted']) { $post['title'] = $vbphrase['post_deleted']; } else { if (empty($post['title'])) { $pagetext = htmlspecialchars_uni($post['pagetext']); $pagetext = strip_bbcode($pagetext, 1); if (trim($pagetext) == '') { $post['title'] = $vbphrase['reply_prefix'] . ' ' . fetch_trimmed_title($lasttitle, $vbulletin->options['threaded_trimtitle']); } else { $post['title'] = '<i>' . fetch_trimmed_title($pagetext, $vbulletin->options['threaded_trimtitle']) . '</i>'; } } else { $lasttitle = $post['title']; $post['title'] = fetch_trimmed_title($post['title'], $vbulletin->options['threaded_trimtitle']); } } ($hook = vBulletinHook::fetch_hook('showthread_threaded_construct_link')) ? eval($hook) : false; return "writeLink({$post['postid']}, {$post['statusicon']}, {$post['paperclip']}, " . intval($post['userid']) . ", \"{$imageString}\", \"" . addslashes_js($post['title'], '"') . "\", \"" . addslashes_js($post['date'], '"') . "\", \"" . addslashes_js($post['time'], '"') . "\", {$highlightpost});\n"; }
public function submit_post_vk($event) { $mode = $event['mode']; if ($mode == 'post' && !isset($_POST['vkrepost']) && !empty($this->config['vk_repost_group']) && !empty($this->config['vk_token'])) { $data = $event['data']; if (!$this->exclude_forum($data['forum_id'], $this->config['vk_repost_forum'])) { include_once $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext; $text = $data['message']; strip_bbcode($text); $this->vkRepost($text, generate_board_url() . '/viewtopic.' . $this->php_ext . '?t=' . $data['topic_id'], $event['subject']); } } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $userinfo =& $this->content['user'][$activity['userid']]; $bloginfo =& $this->content['blog'][$activity['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($bloginfo['pagetext']); $bloginfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); if ($fetchphrase) { return array('phrase' => construct_phrase($this->vbphrase['x_created_a_blog_entry_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('entry', $bloginfo), $bloginfo['title'], fetch_seo_url('blog', $bloginfo), $bloginfo['blog_title']), 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('activity', $activity); $templater->register('bloginfo', $bloginfo); return $templater->render(); } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { global $show; $postinfo =& $this->content['post'][$activity['contentid']]; $threadinfo =& $this->content['thread'][$postinfo['threadid']]; $foruminfo =& vB::$vbulletin->forumcache[$threadinfo['forumid']]; $threadinfo['prefix_plain_html'] = htmlspecialchars_uni($this->vbphrase["prefix_{$threadinfo['prefixid']}_title_plain"]); $threadinfo['prefix_rich'] = $this->vbphrase["prefix_{$threadinfo['prefixid']}_title_rich"]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($postinfo['pagetext']); $postinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); $forumperms = fetch_permissions($threadinfo['forumid']); $show['threadcontent'] = $forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads'] ? true : false; $userinfo = $this->fetchUser($activity['userid'], $postinfo['username']); if ($fetchphrase) { if ($threadinfo['pollid']) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_replied_to_a_poll_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_replied_to_a_poll_y_in_z'], $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } } else { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_replied_to_a_thread_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_replied_to_a_thread_y_in_z'], $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('activity', $activity); $templater->register('threadinfo', $threadinfo); $templater->register('postinfo', $postinfo); $templater->register('pageinfo', array('p' => $postinfo['postid'])); $templater->register('foruminfo', $foruminfo); return $templater->render(); } }
/** * Handles BBCode [media] (or whatever $tag is) * * @param object vB_BbCodeParser * @param string Media URL or attachment ID * @param string Custom media options * * @return string Rendered media HTML */ function handle_bbcode_goldbrick(vB_BbCodeParser $parser, $text, $options = '') { global $vbphrase, $vbulletin; if ($parser->registry->userinfo['permissions']['gb_permissions'] & $parser->registry->bf_ugp['gb_permissions']['canuse']) { $text = str_replace(array('[', ']'), array('[', ']'), $text); $text = strip_bbcode($text, true, true, false); if ($parser->is_wysiwyg()) { return sprintf('[%1$s%2$s]%3$s[/%1$s]', $parser->registry->options['gb_tag'], $options ? ""{$options}"" : '', $text); } require_once DIR . '/goldbrick/includes/functions_public.php'; //$goldbrick = new goldbrick_media($vbulletin); $media = goldbrick_start_delivery($text, $options); if ($media) { return $media; } else { $media = goldbrick_process_bbcode($text, $options); $info = goldbrick_start_delivery($text, $options); return $info; } } return $vbphrase['gb_no_permissions']; }
/** * Stops text being all UPPER CASE * * @param string The text to apply 'anti-shouting' to * * @return string The text with 'anti-shouting' applied * */ function fetch_no_shouting_text($text) { global $vbulletin; $effective_string = preg_replace('#[^a-z0-9\\s]#i', '\\2', strip_bbcode($text, true, false)); if ($vbulletin->options['stopshouting'] and vbstrlen($effective_string) >= $vbulletin->options['stopshouting'] and $effective_string == strtoupper($effective_string)) { return fetch_sentence_case($text); } else { return $text; } }
$forum_active_cache["{$current_forum['forumid']}"] = true; $current_forum = $vbulletin->forumcache["{$current_forum['parentid']}"]; } } if (!$forum_active_cache["{$simthread['forumid']}"]) { continue; } $fperms = fetch_permissions($simthread['forumid']); if ($fperms & $vbulletin->bf_ugp_forumpermissions['canview'] and ($fperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] or $vbulletin->userinfo['userid'] != 0 and $simthread['postuserid'] == $vbulletin->userinfo['userid'])) { // format thread preview if there is one if (isset($ignore["{$simthread['postuserid']}"])) { $simthread['preview'] = ''; } else { if (isset($simthread['preview']) and $vbulletin->options['threadpreview'] > 0) { $simthread['preview'] = strip_quotes($simthread['preview']); $simthread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($simthread['preview'], false, true), $vbulletin->options['threadpreview'])); } } $simthread['lastreplydate'] = vbdate($vbulletin->options['dateformat'], $simthread['lastpost'], true); $simthread['lastreplytime'] = vbdate($vbulletin->options['timeformat'], $simthread['lastpost']); if ($simthread['prefixid']) { $simthread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$simthread['prefixid']}_title_plain"]); $simthread['prefix_rich'] = $vbphrase["prefix_{$simthread['prefixid']}_title_rich"]; } else { $simthread['prefix_plain_html'] = ''; $simthread['prefix_rich'] = ''; } $simthread['title'] = fetch_censored_text($simthread['title']); ($hook = vBulletinHook::fetch_hook('showthread_similarthreadbit')) ? eval($hook) : false; $templater = vB_Template::create('showthread_similarthreadbit'); $templater->register('simthread', $simthread);
{ $bbcode_bitfield = $text_only_message = ''; $attach_list = array(); while ($row = $db->sql_fetchrow($result)) { // We pre-process some variables here for later usage $row['post_text'] = censor_text($row['post_text']); $text_only_message = $row['post_text']; // make list items visible as such if ($row['bbcode_uid']) { $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message); // no BBCode in text only message strip_bbcode($text_only_message, $row['bbcode_uid']); } if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) { $row['display_text_only'] = false; $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); // Does this post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) { $attach_list[$row['forum_id']][] = $row['post_id']; } } else {
$post['posticonpath'] = $vbulletin->options['showdeficon']; $post['posticontitle'] = ''; } else { $post['posticon'] = false; $post['posticonpath'] = ''; $post['posticontitle'] = ''; } } } else { $post['posticon'] = false; $post['posticonpath'] = ''; $post['posticontitle'] = ''; } $post['pagetext'] = preg_replace('#\\[quote(=("|"|\'|)??.*\\2)?\\](((?>[^\\[]*?|(?R)|.))*)\\[/quote\\]#siU', '', $post['pagetext']); // get first 200 chars of page text $post['pagetext'] = htmlspecialchars_uni(fetch_censored_text(trim(fetch_trimmed_title(strip_bbcode($post['pagetext'], 1), 200)))); // get post title if ($post['posttitle'] == '') { $post['posttitle'] = fetch_trimmed_title($post['pagetext'], 50); } else { $post['posttitle'] = fetch_censored_text($post['posttitle']); } // format post text $post['pagetext'] = nl2br($post['pagetext']); // get info from post $post = process_thread_array($post, $lastread["{$post['forumid']}"], $post['allowicons']); $show['managepost'] = (can_moderate($post['forumid'], 'candeleteposts') or can_moderate($post['forumid'], 'canremoveposts')) ? true : false; $show['approvepost'] = can_moderate($post['forumid'], 'canmoderateposts') ? true : false; $show['managethread'] = can_moderate($post['forumid'], 'canmanagethreads') ? true : false; $show['disabled'] = ($show['managethread'] or $show['managepost'] or $show['approvepost']) ? false : true; $show['moderated'] = (!$post['visible'] or !$post['thread_visible'] and $post['postid'] == $post['firstpostid']) ? true : false;
$first = $itemcount + 1; if ($db->num_rows($getevents)) { $show['haveevents'] = true; while ($event = $db->fetch_array($getevents)) { if (empty($reminders["{$event['reminder']}"])) { $event['reminder'] = 3600; } $event['reminder'] = $vbphrase[$reminders[$event['reminder']]]; $offset = $event['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset']; $event = array_merge($event, convert_bits_to_array($event['options'], $vbulletin->bf_misc_useroptions)); $event = array_merge($event, convert_bits_to_array($event['adminoptions'], $vbulletin->bf_misc_adminoptions)); cache_permissions($event, false); fetch_avatar_from_userinfo($event, true); $event['dateline_from_user'] = $event['dateline_from'] + $offset * 3600; $event['dateline_to_user'] = $event['dateline_to'] + $offset * 3600; $event['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title(strip_quotes($event['event']), 300), false, true)); $event = fetch_event_date_time($event); $event['calendar'] = $calendarcache["{$event['calendarid']}"]; $show['singleday'] = !empty($event['singleday']) ? true : false; ($hook = vBulletinHook::fetch_hook('calendar_viewreminder_event')) ? eval($hook) : false; $oppositesort = $sortorder == 'asc' ? 'desc' : 'asc'; $templater = vB_Template::create('calendar_reminder_eventbit'); $templater->register('date1', $date1); $templater->register('date2', $date2); $templater->register('daterange', $daterange); $templater->register('event', $event); $templater->register('eventdate', $eventdate); $templater->register('recurcriteria', $recurcriteria); $templater->register('time1', $time1); $templater->register('time2', $time2); $eventbits .= $templater->render();
/** * Return title string for display * * If there is no title given, we'll construct one from the post text */ public function get_display_title() { $title = $this->get_field('title'); if ($title == '') { $title = fetch_trimmed_title(strip_bbcode($this->get_field('pagetext'), true, false, true), 50); } else { $title = fetch_censored_text($title); } return $title; }
/** * Verifies the page text is valid and sets it up for saving. * * @param string Page text * * @param bool Whether the text is valid */ function verify_pagetext(&$pagetext) { if (empty($this->info['is_automated'])) { if ($this->registry->options['postmaxchars'] != 0 and ($postlength = vbstrlen($pagetext)) > $this->registry->options['postmaxchars']) { $this->error('toolong', $postlength, $this->registry->options['postmaxchars']); return false; } $this->registry->options['postminchars'] = intval($this->registry->options['postminchars']); if ($this->registry->options['postminchars'] <= 0) { $this->registry->options['postminchars'] = 1; } if (vbstrlen(strip_bbcode($pagetext, $this->registry->options['ignorequotechars'])) < $this->registry->options['postminchars']) { $this->error('tooshort', $this->registry->options['postminchars']); return false; } } return parent::verify_pagetext($pagetext); }
/** * Clean up post_text and forum_desc for non text data * * @return $text * @access private */ private function lotusjeff_socialshare_strip_code($text) { $text = censor_text($text); strip_bbcode($text); $text = str_replace(array(""", "/", "\n", "\t", "\r"), ' ', $text); $text = preg_replace(array("|http(.*)jpg|isU", "@(http(s)?://)?(([a-z0-9.-]+)?[a-z0-9-]+(!?\\.[a-z]{2,4}))@"), ' ', $text); $text = preg_replace("/[^A-ZА-ЯЁ.,-–?]+/ui", " ", $text); $text = preg_replace("/\\[(.*)?\\](.*)?\\[(.*)?\\]/", ' ', $text); if (strlen($text) > 180) { $text_ar = explode("\n", wordwrap($text, 180)); $text = $text_ar[0] . '...'; } return $text; }
// insert item as thread // insert item as thread case 'thread': default: // init thread/firstpost datamanager $itemdata =& datamanager_init('Thread_FirstPost', $vbulletin, $error_type, 'threadpost'); $itemdata->set_info('forum', fetch_foruminfo($feed['forumid'])); $itemdata->set_info('user', $feed); $itemdata->set_info('is_automated', 'rss'); $itemdata->set_info('chop_title', true); $itemdata->set('iconid', $feed['iconid']); $itemdata->set('sticky', $feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['stickthread'] ? 1 : 0); $itemdata->set('forumid', $feed['forumid']); $itemdata->set('prefixid', $feed['prefixid']); $itemdata->set('userid', $feed['userid']); $itemdata->set('title', strip_bbcode($html_parser->parse_wysiwyg_html_to_bbcode($feed['xml']->parse_template($feed['titletemplate'], $item)))); $itemdata->set('pagetext', $pagetext); $itemdata->set('visible', $feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['moderatethread'] ? 0 : 1); $itemdata->set('allowsmilie', $feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['allowsmilies'] ? 1 : 0); $itemdata->set('showsignature', $feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['showsignature'] ? 1 : 0); $itemdata->set('ipaddress', ''); $threadactiontime = $feed['threadactiondelay'] > 0 ? TIMENOW + $feed['threadactiondelay'] * 3600 : 0; if ($itemid = $itemdata->save()) { $itemtype = 'thread'; $itemtitle = $itemdata->fetch_field('title'); $itemlink = fetch_seo_url('thread|bburl', $itemdata->thread); if (defined('IN_CONTROL_PANEL')) { echo "<li><a href=\"{$itemlink}\" target=\"feed\">{$itemtitle}</a></li>"; } $rsslog_insert_sql[] = "({$item['rssfeedid']}, {$itemid}, '{$itemtype}', '" . $vbulletin->db->escape_string($uniquehash) . "', '" . $vbulletin->db->escape_string($item['contenthash']) . "', " . TIMENOW . ", {$threadactiontime})"; $cronlog_items["{$item['rssfeedid']}"][] = "\t<li>{$vbphrase[$itemtype]} <a href=\"{$itemlink}\" target=\"logview\"><em>{$itemtitle}</em></a></li>";
function view_announce($limit = 1) { global $config, $template, $phpbb_root_path, $phpEx; $sql = 'SELECT t.topic_id, t.topic_title, t.topic_time, p.post_text, p.bbcode_uid, p.bbcode_bitfield FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE t.forum_id = ' . (int) $config['top_rating_anounce'] . ' AND t.topic_first_post_id = p.post_id AND t.topic_type = ' . POST_ANNOUNCE . ' ORDER BY t.topic_time DESC'; $result = $this->db->sql_query_limit($sql, $limit); while ($row = $this->db->sql_fetchrow($result)) { // Limit chars $topic_desc = $row['post_text']; if (mb_strlen($topic_desc) >= 250) { strip_bbcode($topic_desc); $topic_desc = preg_replace("/\r\n|\r|\n/", '<br />', mb_substr($topic_desc, 0, 250)); $topic_desc .= ' <a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 't=' . $row['topic_id']) . '">[...]</a>'; } else { // Parse the message and subject $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $topic_desc = generate_text_for_display($topic_desc, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); } $template->assign_block_vars('announcerow', array('TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_DESC' => $topic_desc, 'TOPIC_TIME' => $this->user->format_date($row['topic_time']), 'TOPIC_URL' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 't=' . $row['topic_id']))); } $this->db->sql_freeresult($result); }
function update_search_index($mode, $post_id, $message, $subject = null) { global $db_type, $db; $message = utf8_strtolower($message); $subject = utf8_strtolower($subject); // Remove any bbcode that we shouldn't index $message = strip_bbcode($message); // Split old and new post/subject to obtain array of 'words' $words_message = split_words($message, true); $words_subject = $subject ? split_words($subject, true) : array(); if ($mode == 'edit') { $result = $db->query('SELECT w.id, w.word, m.subject_match FROM ' . $db->prefix . 'search_words AS w INNER JOIN ' . $db->prefix . 'search_matches AS m ON w.id=m.word_id WHERE m.post_id=' . $post_id, true) or error('Unable to fetch search index words', __FILE__, __LINE__, $db->error()); // Declare here to stop array_keys() and array_diff() from complaining if not set $cur_words['post'] = array(); $cur_words['subject'] = array(); while ($row = $db->fetch_row($result)) { $match_in = $row[2] ? 'subject' : 'post'; $cur_words[$match_in][$row[1]] = $row[0]; } $db->free_result($result); $words['add']['post'] = array_diff($words_message, array_keys($cur_words['post'])); $words['add']['subject'] = array_diff($words_subject, array_keys($cur_words['subject'])); $words['del']['post'] = array_diff(array_keys($cur_words['post']), $words_message); $words['del']['subject'] = array_diff(array_keys($cur_words['subject']), $words_subject); } else { $words['add']['post'] = $words_message; $words['add']['subject'] = $words_subject; $words['del']['post'] = array(); $words['del']['subject'] = array(); } unset($words_message); unset($words_subject); // Get unique words from the above arrays $unique_words = array_unique(array_merge($words['add']['post'], $words['add']['subject'])); if (!empty($unique_words)) { $result = $db->query('SELECT id, word FROM ' . $db->prefix . 'search_words WHERE word IN(\'' . implode('\',\'', array_map(array($db, 'escape'), $unique_words)) . '\')', true) or error('Unable to fetch search index words', __FILE__, __LINE__, $db->error()); $word_ids = array(); while ($row = $db->fetch_row($result)) { $word_ids[$row[1]] = $row[0]; } $db->free_result($result); $new_words = array_diff($unique_words, array_keys($word_ids)); unset($unique_words); if (!empty($new_words)) { switch ($db_type) { case 'mysql': case 'mysqli': case 'mysql_innodb': case 'mysqli_innodb': $db->query('INSERT INTO ' . $db->prefix . 'search_words (word) VALUES(\'' . implode('\'),(\'', array_map(array($db, 'escape'), $new_words)) . '\')'); break; default: foreach ($new_words as $word) { $db->query('INSERT INTO ' . $db->prefix . 'search_words (word) VALUES(\'' . $db->escape($word) . '\')'); } break; } } unset($new_words); } // Delete matches (only if editing a post) foreach ($words['del'] as $match_in => $wordlist) { $subject_match = $match_in == 'subject' ? 1 : 0; if (!empty($wordlist)) { $sql = ''; foreach ($wordlist as $word) { $sql .= ($sql != '' ? ',' : '') . $cur_words[$match_in][$word]; } $db->query('DELETE FROM ' . $db->prefix . 'search_matches WHERE word_id IN(' . $sql . ') AND post_id=' . $post_id . ' AND subject_match=' . $subject_match) or error('Unable to delete search index word matches', __FILE__, __LINE__, $db->error()); } } // Add new matches foreach ($words['add'] as $match_in => $wordlist) { $subject_match = $match_in == 'subject' ? 1 : 0; if (!empty($wordlist)) { $db->query('INSERT INTO ' . $db->prefix . 'search_matches (post_id, word_id, subject_match) SELECT ' . $post_id . ', id, ' . $subject_match . ' FROM ' . $db->prefix . 'search_words WHERE word IN(\'' . implode('\',\'', array_map(array($db, 'escape'), $wordlist)) . '\')') or error('Unable to insert search index word matches', __FILE__, __LINE__, $db->error()); } } unset($words); }
public function advanced_profile_system($event) { $member = $event['member']; $user_id = (int) $member['user_id']; // Get user_id of user we are viewing $username = $member['username']; $user_extra_rank_data = array('title' => null, 'img' => null, 'img_src' => null); $ranks_sql = 'SELECT * FROM ' . RANKS_TABLE . ' WHERE rank_special != 1'; $normal_ranks = $this->db->sql_query($ranks_sql); $spec_sql = 'SELECT rank_special FROM ' . RANKS_TABLE . ' WHERE rank_id = ' . $member['user_rank']; $special = $this->db->sql_query($spec_sql); if ($special !== 1) { if ($member['user_posts'] !== false) { if (!empty($normal_ranks)) { foreach ($normal_ranks as $rank) { if ($member['user_posts'] >= $rank['rank_min']) { $user_extra_rank_data['title'] = $rank['rank_title']; $user_extra_rank_data['img_src'] = !empty($rank['rank_image']) ? $this->phpbb_root_path . $this->config['ranks_path'] . '/' . $rank['rank_image'] : ''; $user_extra_rank_data['img'] = !empty($rank['rank_image']) ? '<img src="' . $user_extra_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; break; } } } } } $this->template->assign_vars(array('EXTRA_RANK_TITLE' => $user_extra_rank_data['title'], 'EXTRA_RANK_IMG' => $user_extra_rank_data['img'])); /**************** * PROFILE VIEWS * ****************/ // Make sure we have a session Make sure user is not a bot. Do not increase view count if viewing own profile. if (isset($this->user->data['session_page']) && !$this->user->data['is_bot'] && $this->user->data['user_id'] != $user_id) { $incr_profile_views = 'UPDATE ' . USERS_TABLE . ' SET user_profile_views = user_profile_views + 1 WHERE user_id = ' . $user_id; $this->db->sql_query($incr_profile_views); } /**************** * ACTIVITY FEED * ****************/ $activity_feed_ary = array('SELECT' => 'p.*, t.*, u.username, u.user_colour', 'FROM' => array(POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = p.poster_id'), array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id')), 'WHERE' => $this->db->sql_in_set('t.forum_id', array_keys($this->auth->acl_getf('f_read', true))) . ' AND t.topic_status <> ' . ITEM_MOVED . ' AND t.topic_visibility = 1 AND p.poster_id = ' . $user_id, 'ORDER_BY' => 'p.post_time DESC'); $activity_feed = $this->db->sql_build_query('SELECT', $activity_feed_ary); $activity_feed_result = $this->db->sql_query_limit($activity_feed, 5); // Only get last five posts while ($af_row = $this->db->sql_fetchrow($activity_feed_result)) { $topic_id = $af_row['topic_id']; $post_id = $af_row['post_id']; $post_date = $this->user->format_date($af_row['post_time']); $post_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->phpEx}", 't=' . $topic_id . '&p=' . $post_id) . '#p' . $post_id; // Parse the posts $af_row['bbcode_options'] = ($af_row['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($af_row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($af_row['enable_magic_url'] ? OPTION_FLAG_LINKS : 0); $text = generate_text_for_display($af_row['post_text'], $af_row['bbcode_uid'], $af_row['bbcode_bitfield'], $af_row['bbcode_options']); // Set a max length for the post to display $cutoff = ' …'; $text = strlen($text) > 200 ? mb_substr($text, 0, 200) . $cutoff : $text; // See if user is able to view posts.. $this->template->assign_block_vars('af', array('SUBJECT' => $af_row['post_subject'], 'TEXT' => $text, 'TIME' => $post_date, 'URL' => $post_url)); } $this->db->sql_freeresult($activity_feed_result); // Master gave Dobby a sock, now Dobby is free! /*************** * TOTAL TOPICS * ***************/ $tt = 'SELECT COUNT(topic_poster) AS topic_author_count FROM ' . TOPICS_TABLE . ' WHERE topic_poster = ' . $user_id; $total_topics_result = $this->db->sql_query($tt); $total_topics = (int) $this->db->sql_fetchfield('topic_author_count'); $this->db->sql_freeresult($total_topics_result); // Master gave Dobby a sock, now Dobby is free! /*************** * FRIENDS LIST * ***************/ $sql_friend = array('SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', 'FROM' => array(USERS_TABLE => 'u', ZEBRA_TABLE => 'z'), 'LEFT_JOIN' => array(array('FROM' => array(SESSIONS_TABLE => 's'), 'ON' => 's.session_user_id = z.zebra_id')), 'WHERE' => 'z.user_id = ' . $user_id . ' AND z.friend = 1 AND u.user_id = z.zebra_id', 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', 'ORDER_BY' => 'u.username_clean ASC'); $sql_friend_list = $this->db->sql_build_query('SELECT_DISTINCT', $sql_friend); $friend_result = $this->db->sql_query($sql_friend_list); while ($friend_row = $this->db->sql_fetchrow($friend_result)) { $img = phpbb_get_user_avatar($friend_row); // Use phpBB's Built in Avatar creator, for all types $has_avatar = false; if ($img == '') { $has_avatar = false; // This friend has no avatar.. } else { $has_avatar = true; // This friend has an avatar $offset = 25; //Start off the img src $end = strpos($img, '"', $offset); // Find end of img src $length = $end - $offset; // Determine src length $friend_avatar = substr($img, $offset, $length); // Grab just the src } $this->template->assign_block_vars('friends', array('USERNAME' => get_username_string('full', $friend_row['user_id'], $friend_row['username'], $friend_row['user_colour']), 'AVATAR' => $friend_avatar, 'HAS_AVATAR' => $has_avatar)); } $this->db->sql_freeresult($friend_result); // Master gave Dobby a sock, now Dobby is free! /******* * WALL * *******/ // INSERTING A WALL POST add_form_key('postwall'); $sendwall = isset($_POST['sendwall']) ? true : false; if ($sendwall) { if (check_form_key('postwall') && $this->auth->acl_get('u_wall_post')) { $msg_text = $this->request->variable('msg_text', '', true); $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage $allow_bbcode = $allow_urls = $allow_smilies = true; generate_text_for_storage($msg_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies); $msg_time = time(); $wall_ary = array('user_id' => $user_id, 'poster_id' => $this->user->data['user_id'], 'msg' => $msg_text, 'msg_time' => (int) $msg_time, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'bbcode_options' => $options); $insertwall = 'INSERT INTO ' . $this->wall_table . ' ' . $this->db->sql_build_array('INSERT', $wall_ary); $this->db->sql_query($insertwall); if ($user_id != $this->user->data['user_id']) { $msg_id = (int) $this->db->sql_nextid(); $poster_name = get_username_string('no_profile', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']); $notification_msg = $msg_text; strip_bbcode($notification_msg, $uid); $wall_notification_data = array('msg_id' => $msg_id, 'user_id' => $user_id, 'poster_name' => $poster_name, 'notification_msg' => strlen($notification_msg) > 30 ? substr($notification_msg, 0, 30) . '...' : $notification_msg); $phpbb_notifications = $this->container->get('notification_manager'); $phpbb_notifications->add_notifications('posey.aps.notification.type.wall', $wall_notification_data); } } else { trigger_error($this->user->lang['FORM_INVALID']); } } // DISPLAYING WALL POSTS $getwall_ary = array('SELECT' => 'w.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array($this->wall_table => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = w.poster_id')), 'WHERE' => 'w.user_id = ' . $user_id, 'ORDER_BY' => 'w.msg_id DESC'); $getwall = $this->db->sql_build_query('SELECT_DISTINCT', $getwall_ary); $wallresult = $this->db->sql_query_limit($getwall, 10); // Only get latest 10 wall posts while ($wall = $this->db->sql_fetchrow($wallresult)) { $wall_msg = generate_text_for_display($wall['msg'], $wall['bbcode_uid'], $wall['bbcode_bitfield'], $wall['bbcode_options']); // Parse wall message text $msg_id = $wall['msg_id']; $msg_time = $this->user->format_date($wall['msg_time']); $this->template->assign_block_vars('wall', array('MSG' => $wall_msg, 'ID' => $wall['msg_id'], 'MSG_TIME' => $msg_time, 'POSTER' => get_username_string('full', $wall['poster_id'], $wall['username'], $wall['user_colour']), 'POSTER_AVATAR' => phpbb_get_user_avatar($wall), 'S_HIDDEN_FIELDS' => build_hidden_fields(array('deletewallid' => $wall['msg_id'])))); } $this->db->sql_freeresult($wallresult); // Master gave Dobby a sock, now Dobby is free! // DELETE WALL POST $deletewall = isset($_POST['deletewall']) ? true : false; if ($deletewall) { if (confirm_box(true)) { $deletewallid = request_var('deletewallid', 0); $delete_msg = 'DELETE FROM ' . $this->wall_table . ' WHERE msg_id = ' . $deletewallid; $this->db->sql_query($delete_msg); $msg_deleted_redirect = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&u=" . $user_id . "#wall"); $message = $this->user->lang['CONFIRM_WALL_DEL'] . '<br /><br />' . sprintf($this->user->lang['RETURN_WALL'], '<a href="' . $msg_deleted_redirect . '">', $username, '</a>'); meta_refresh(3, $msg_deleted_redirect); trigger_error($message); } else { $s_hidden_fields = build_hidden_fields(array('deletewall' => true, 'deletewallid' => request_var('deletewallid', 0))); confirm_box(false, $this->user->lang['CONFIRM_WALL_DEL_EXPLAIN'], $s_hidden_fields); } } /*********************** * Let's set some links * ***********************/ $post_wall_action = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&u=" . $user_id); // Needed for wall form $total_topics_url = append_sid("{$this->phpbb_root_path}search.{$this->phpEx}", 'author_id=' . $user_id . '&sr=topics'); // Link to search URL for user's topics /**************************** * ASSIGN TEMPLATE VARIABLES * ****************************/ $this->template->assign_vars(array('TOTAL_TOPICS' => $total_topics, 'PROFILE_VIEWS' => $member['user_profile_views'], 'NO_WALL_POSTS' => sprintf($this->user->lang['FIRST_POST_WALL'], '<strong>' . $username . '</strong>'), 'USER_NO_POSTS' => sprintf($this->user->lang['USER_NO_POSTS'], '<strong>' . $username . '</strong>'), 'COVERPHOTO' => $member['user_coverphoto'], 'CP_PANEL_ID' => $this->config['cp_panel_id'] ? $this->config['cp_panel_id'] : 1, 'FL_ENABLED' => $this->config['fl_enabled'] ? true : false, 'CP_ENABLED' => $this->config['cp_enabled'] ? true : false, 'AF_ENABLED' => $this->config['af_enabled'] ? true : false, 'U_SEARCH_USER_TOPICS' => $total_topics_url, 'S_POST_WALL' => $post_wall_action, 'S_CAN_POST_WALL' => $this->auth->acl_get('u_wall_post') ? true : false, 'S_CAN_READ_WALL' => $this->auth->acl_get('u_wall_read') ? true : false, 'S_CAN_DEL_WALL' => $this->auth->acl_get('u_wall_del') ? true : false, 'S_MOD_DEL_WALL' => $this->auth->acl_get('m_wall_del') ? true : false)); }
function cache_events($range) { global $vbulletin, $calendarinfo, $vbphrase, $serveroffset; $numdays = date('j', mktime(0, 0, 0, $range['nextmonth'] + 1, 1, $range['nextyear']) - 1); $beginday = gmmktime(0, 0, 0, $range['frommonth'], 1, $range['fromyear']) + -12 * 3600; $endday = gmmktime(24, 0, 0, $range['nextmonth'], $numdays, $range['nextyear']) + 12 * 3600; $event = array(); $eventids = array(); if ($calendarinfo['showholidays']) { // Holidays show across all calendars that a user has access to. $holidays = $vbulletin->db->query_read_slave("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "holiday\n\t\t"); if ($vbulletin->db->num_rows($holidays)) { while ($ev = $vbulletin->db->fetch_array($holidays)) { $ev['visible'] = 1; $ev['title'] =& $vbphrase['holiday' . $ev['holidayid'] . '_title']; $ev['event'] =& $vbphrase['holiday' . $ev['holidayid'] . '_desc']; $ev['preview'] = strip_quotes($ev['event']); $ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true)); if ($ev['recurring'] == 6) { $event['holiday1']["{$ev['recuroption']}"][] = $ev; } else { $ev['dateline_from'] = $beginday; $ev['dateline_to'] = $endday; $offset = $vbulletin->userinfo['timezoneoffset'] ? $vbulletin->userinfo['tzoffset'] : $vbulletin->userinfo['timezoneoffset']; $ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600; $ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600; $recuroption = substr($ev['recuroption'], 2); $event['holiday2']["{$recuroption}"][] = $ev; } } } } $events = $vbulletin->db->query_read_slave("\n\t\tSELECT event.*,\n\t\tuser.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,\n\t\tIF(dateline_to = 0, 1, 0) AS singleday\n\t\t" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "\n\t\tFROM " . TABLE_PREFIX . "event AS event\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)\n\t\t" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "\n\t\tWHERE calendarid = {$calendarinfo['calendarid']} AND\n\t\t\t((dateline_to >= {$beginday} AND dateline_from < {$endday}) OR (dateline_to = 0 AND dateline_from >= {$beginday} AND dateline_from <= {$endday} ))\tAND\n\t\t\tvisible = 1\n\t\tORDER BY dateline_from\n\t"); // Cache Events if ($vbulletin->db->num_rows($events)) { while ($ev = $vbulletin->db->fetch_array($events)) { if ($ev['userid'] != $vbulletin->userinfo['userid'] and !($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'])) { continue; } $ev['preview'] = strip_quotes($ev['event']); $ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true)); $offset = $ev['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset']; $ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600; $ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600; fetch_musername($ev); if (!$ev['recurring']) { if ($ev['singleday']) { $event['singleday']["{$ev['dateline_from']}"][] = $ev; } else { $found = false; $date = explode('-', gmdate('n-j-Y', $ev['dateline_from_user'])); $beginday = gmmktime(0, 0, 0, $date[0], $date[1], $date[2]); while ($beginday <= $ev['dateline_to_user']) { if (!$found) { $event['ranged']["{$beginday}"][] = $ev; $count = count($event['ranged']["{$beginday}"]) - 1; $tempevent =& $event['ranged']["{$beginday}"]["{$count}"]; $found = true; } else { // if event ends at the start of the day, don't display it for that day if ($ev['dateline_to_user'] != $beginday) { $event['ranged']["{$beginday}"][] =& $tempevent; } } $beginday += 86400; } } } else { $event['recurring'][] = $ev; } } } return $event; }
function convert_ids_to_titles() { global $vbulletin; global $albumids, $attachmentids, $calendarids, $eventids, $forumids, $infractionids, $pmids, $postids, $searchids, $socialgroupids, $threadids, $userids; global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user; if ($attachmentids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT postid, attachmentid\n\t\t\tFROM " . TABLE_PREFIX . "attachment\n\t\t\tWHERE attachmentid IN (0{$attachmentids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $postids .= ',' . $postidqueryr['postid']; $wol_attachment["{$postidqueryr['attachmentid']}"] = $postidqueryr['postid']; } } if ($postids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT threadid, postid\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid IN (0{$postids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $threadids .= ',' . $postidqueryr['threadid']; $wol_post["{$postidqueryr['postid']}"] = $postidqueryr['threadid']; } } if ($socialgroupids) { $socialgroups = $vbulletin->db->query_read_slave("\n\t\t\tSELECT name, groupid\n\t\t\tFROM " . TABLE_PREFIX . "socialgroup\n\t\t\tWHERE groupid IN (0{$socialgroupids})\n\t\t"); while ($socialgroup = $vbulletin->db->fetch_array($socialgroups)) { $wol_socialgroup["{$socialgroup['groupid']}"]['name'] = $socialgroup['name']; } } if ($albumids) { $albums = $vbulletin->db->query_read_slave("\n\t\t\tSELECT title, albumid, state, userid\n\t\t\tFROM " . TABLE_PREFIX . "album\n\t\t\tWHERE albumid IN (0{$albumids})\n\t\t"); while ($album = $vbulletin->db->fetch_array($albums)) { $wol_album["{$album['albumid']}"] = $album; } } if ($threadids) { $threadresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT thread.title, thread.prefixid, thread.threadid, thread.forumid, thread.postuserid, thread.visible\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, ",post.pagetext AS preview") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "\n\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND canview = 1)") . "\n\t\t\tWHERE thread.threadid IN (0{$threadids})\n\t\t"); while ($threadresult = $vbulletin->db->fetch_array($threadresults)) { $wol_thread["{$threadresult['threadid']}"]['title'] = $threadresult['title']; $wol_thread["{$threadresult['threadid']}"]['prefixid'] = $threadresult['prefixid']; $wol_thread["{$threadresult['threadid']}"]['forumid'] = $threadresult['forumid']; $wol_thread["{$threadresult['threadid']}"]['postuserid'] = $threadresult['postuserid']; $wol_thread["{$threadresult['threadid']}"]['isdeleted'] = $threadresult['visible'] == 2 ? true : false; $wol_thread["{$threadresult['threadid']}"]['visible'] = $threadresult['visible'] == 1 ? true : false; $wol_thread["{$threadresult['threadid']}"]['issubscribed'] = $threadresult['issubscribed']; // format thread preview if there is one $userperms = fetch_permissions($threadresult['forumid']); if (!empty($threadresult['preview']) and $vbulletin->options['threadpreview'] > 0 and $userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) { // Get Buddy List $buddy = array(); if (trim($vbulletin->userinfo['buddylist'])) { $buddylist = preg_split('/( )+/', trim($vbulletin->userinfo['buddylist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($buddylist as $buddyuserid) { $buddy["{$buddyuserid}"] = 1; } } DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy))); // Get Ignore Users $ignore = array(); if (trim($vbulletin->userinfo['ignorelist'])) { $ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($ignorelist as $ignoreuserid) { if (!$buddy["{$ignoreuserid}"]) { $ignore["{$ignoreuserid}"] = 1; } } } DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore))); if (!$ignore["{$threadresult['postuserid']}"]) { $threadresult['preview'] = strip_quotes($threadresult['preview']); $threadresult['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($threadresult['preview'], $vbulletin->options['threadpreview']), false, true)); $wol_thread["{$threadresult['threadid']}"]['preview'] = $threadresult['preview']; } } } } if ($calendarids) { $calendarresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT calendarid, title\n\t\t\tFROM " . TABLE_PREFIX . "calendar\n\t\t\tWHERE calendarid IN (0{$calendarids})\n\t\t"); while ($calendarresult = $vbulletin->db->fetch_array($calendarresults)) { $wol_calendar["{$calendarresult['calendarid']}"] = $calendarresult['title']; } } if ($infractionids) { $infractions = $vbulletin->db->query_read_slave("\n\t\t\tSELECT infractionid, userid\n\t\t\tFROM " . TABLE_PREFIX . "infraction\n\t\t\tWHERE infractionid IN (0{$infractionids})\n\t\t"); while ($infraction = $vbulletin->db->fetch_array($infractions)) { $wol_inf["{$infraction['infractionid']}"]['userid'] = $infraction['userid']; $userids .= ',' . $infraction['userid']; } } if ($eventids) { $eventresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT eventid, title, userid, calendarid\n\t\t\tFROM " . TABLE_PREFIX . "event\n\t\t\tWHERE eventid IN (0{$eventids})\n\t\t"); while ($eventresult = $vbulletin->db->fetch_array($eventresults)) { $wol_event["{$eventresult['eventid']}"]['title'] = $eventresult['title']; $wol_event["{$eventresult['eventid']}"]['calendarid'] = $eventresult['calendarid']; $wol_event["{$eventresult['eventid']}"]['postuserid'] = $eventresult['userid']; } } if ($pmids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $pmresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT pmtext.fromuserid, pm.pmid\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pm.pmtextid = pmtext.pmtextid)\n\t\t\tWHERE pmid IN (0{$pmids})\n\t\t\t"); while ($pmresult = $vbulletin->db->fetch_array($pmresults)) { $wol_pm["{$pmresult['pmid']}"] = $pmresult['fromuserid']; $userids .= ',' . intval($pmresult['fromuserid']); } } if ($searchids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $searchresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT searchid, search.userid, query, searchuser, user.userid AS targetuserid\n\t\t\tFROM " . TABLE_PREFIX . "search AS search\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = search.searchuser)\n\t\t\tWHERE searchid IN (0{$searchids})\n\t\t"); while ($searchresult = $vbulletin->db->fetch_array($searchresults)) { if ($searchresult['searchuser']) { if (!$searchresult['targetuserid']) { $result = $vbulletin->db->query_first_slave("\n\t\t\t\t\t\tSELECT userid AS targetuserid\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user\n\t\t\t\t\t\tWHERE username = '******'searchuser'])) . "'\n\t\t\t\t\t"); } if ($result['targetuserid']) { $searchresult['targetuserid'] = $result['targetuserid']; } if ($searchresult['targetuserid']) { $userids .= ",{$searchresult['targetuserid']}"; } } $wol_search["{$searchresult['searchid']}"] = $searchresult; } } if ($userids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $userresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT userid, username, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid\n\t\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\t\tWHERE userid IN (0{$userids})\n\t\t"); while ($userresult = $vbulletin->db->fetch_array($userresults)) { fetch_musername($userresult); $wol_user["{$userresult['userid']}"] = $userresult['musername']; } } ($hook = vBulletinHook::fetch_hook('online_ids_titles')) ? eval($hook) : false; }
/** * Verifies the page text is valid and sets it up for saving. * * @param string Page text * * @param bool Whether the text is valid */ function verify_pagetext(&$pagetext) { if (empty($this->info['skip_charcount'])) { $maxchars = $this->table == 'blog' ? $this->registry->options['vbblog_entrymaxchars'] : $this->registry->options['vbblog_commentmaxchars']; if ($maxchars != 0 AND ($postlength = vbstrlen($pagetext)) > $maxchars) { $this->error('toolong', $postlength, $maxchars); return false; } $this->registry->options['postminchars'] = intval($this->registry->options['postminchars']); if ($this->registry->options['postminchars'] <= 0) { $this->registry->options['postminchars'] = 1; } if (vbstrlen(strip_bbcode($pagetext)) < $this->registry->options['postminchars']) { $this->error('tooshort', $this->registry->options['postminchars']); return false; } } return parent::verify_pagetext($pagetext, false); }
$bbcode_parser =& new vB_BbCodeParser_ImgCheck($vbulletin, fetch_tag_list()); $bbcode_parser->set_parse_userinfo($userinfo_sigpic, $vbulletin->userinfo['permissions']); $parsedsig = $bbcode_parser->parse($signature, 'signature'); $imagecount = fetch_character_count($parsedsig, '<img'); // Count the images if ($imagecount > $vbulletin->userinfo['permissions']['sigmaximages']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('toomanyimages', $imagecount, $vbulletin->userinfo['permissions']['sigmaximages']); } } // Count the raw characters in the signature if ($vbulletin->userinfo['permissions']['sigmaxrawchars'] and vbstrlen($signature) > $vbulletin->userinfo['permissions']['sigmaxrawchars']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('sigtoolong_includingbbcode', $vbulletin->userinfo['permissions']['sigmaxrawchars']); } else { if ($vbulletin->userinfo['permissions']['sigmaxchars'] and vbstrlen(strip_bbcode($signature, false, false, false)) > $vbulletin->userinfo['permissions']['sigmaxchars']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('sigtoolong_excludingbbcode', $vbulletin->userinfo['permissions']['sigmaxchars']); } } if ($vbulletin->userinfo['permissions']['sigmaxlines'] > 0) { require_once DIR . '/includes/class_sigparser_char.php'; $char_counter =& new vB_SignatureParser_CharCount($vbulletin, fetch_tag_list(), $vbulletin->userinfo['permissions'], $vbulletin->userinfo['userid']); $line_count_text = $char_counter->parse(trim($signature)); if ($vbulletin->options['softlinebreakchars'] > 0) { // implicitly wrap after X characters without a break $line_count_text = preg_replace('#([^\\r\\n]{' . $vbulletin->options['softlinebreakchars'] . '})#', "\\1\n", $line_count_text); } // + 1, since 0 linebreaks still means 1 line $line_count = substr_count($line_count_text, "\n") + 1; if ($line_count > $vbulletin->userinfo['permissions']['sigmaxlines']) {
$threadids[] = $thread['threadid']; $firstpostids[] = $thread['firstpostid']; } if (count($threads)) { # get the tags $tags = array(); $_tags = $vbulletin->db->query_read("\n\t\t\tSELECT * FROM " . TABLE_PREFIX . "zoints_tag\n\t\t\tWHERE threadid IN(" . implode(',', $threadids) . ")\n\t\t\t\tAND autogen != 1\n\t\t"); while ($tag = $vbulletin->db->fetch_array($_tags)) { $tags[$tag['threadid']][] = $tag['tag']; } # get the first posts for 30 word process $posts = array(); $_posts = $vbulletin->db->query_read("\n\t\t\tSELECT postid, pagetext FROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid IN(" . implode(',', $firstpostids) . ")\n\t\t"); while (list($postid, $post) = $vbulletin->db->fetch_row($_posts)) { # cut out first 30 words $post = strip_bbcode($post); $words = preg_split("#[\r\n\\s]+#", $post, 31, PREG_SPLIT_NO_EMPTY); if (count($words) > 30) { array_pop($words); array_push($words, '...'); } $posts[$postid] = implode(' ', $words); } # compile data $xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n\n"; $xmldata .= "<zointstags>\n"; foreach ($threads as $threadid => $thread) { #$thread['url'] = $vbulletin->options['bburl'] . '/showthread.php?t=' . $threadid; $thread['url'] = 'showthread.php?t=' . $threadid; ($hook = vBulletinHook::fetch_hook('zointstags_threadurl')) ? eval($hook) : false; if (!preg_match("#^[a-z]+://#i", $thread['url'])) {