$eventdata->set('visible', 1); $visible = 1; } } $eventdata->set('userid', $vbulletin->userinfo['userid']); $eventdata->set('calendarid', $calendarinfo['calendarid']); $eventid = $eventdata->save(); clear_autosave_text('vBForum_Calendar', 0, 0, $vbulletin->userinfo['userid']); if ($calendarinfo['neweventemail']) { $calemails = unserialize($calendarinfo['neweventemail']); $calendarinfo['title'] = unhtmlspecialchars($calendarinfo['title']); $title =& $vbulletin->GPC['title']; $vbulletin->userinfo['username'] = unhtmlspecialchars($vbulletin->userinfo['username']); //for emails require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language(0); // email addresses don't have a language ID $eventmessage = $plaintext_parser->parse($message, 'calendar'); foreach ($calemails as $index => $toemail) { if (trim($toemail)) { eval(fetch_email_phrases('newevent', 0)); vbmail($toemail, $subject, $message, true); } } } ($hook = vBulletinHook::fetch_hook('calendar_update_complete')) ? eval($hook) : false; if ($visible) { $vbulletin->url = 'calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getinfo&e={$eventid}&day=" . $eventdata->info['occurdate']; print_standard_redirect('redirect_calendaraddevent'); } else {
/** * Sends Thread subscription Notifications * * @param integer The Thread ID * @param integer The User ID making the Post * @param integer The Post ID of the new post * */ function exec_send_notification($threadid, $userid, $postid) { // $threadid = threadid to send from; // $userid = userid of who made the post // $postid = only sent if post is moderated -- used to get username correctly global $vbulletin, $message, $postusername; if (!$vbulletin->options['enableemail']) { return; } // include for fetch_phrase require_once DIR . '/includes/functions_misc.php'; $threadinfo = fetch_threadinfo($threadid); $foruminfo = fetch_foruminfo($threadinfo['forumid']); // get last reply time if ($postid) { $dateline = $vbulletin->db->query_first("\n\t\t\tSELECT dateline, pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$postid}\n\t\t"); $pagetext_orig = $dateline['pagetext']; $lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND dateline < {$dateline['dateline']}\n\t\t\t\tAND visible = 1\n\t\t"); } else { $lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(postid) AS postid, MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND visible = 1\n\t\t"); $pagetext = $vbulletin->db->query_first("\n\t\t\tSELECT pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$lastposttime['postid']}\n\t\t"); $pagetext_orig = $pagetext['pagetext']; unset($pagetext); } $threadinfo['title'] = unhtmlspecialchars($threadinfo['title']); $foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']); $temp = $vbulletin->userinfo['username']; if ($postid) { $postinfo = fetch_postinfo($postid); $vbulletin->userinfo['username'] = unhtmlspecialchars($postinfo['username']); } else { $vbulletin->userinfo['username'] = unhtmlspecialchars(!$vbulletin->userinfo['userid'] ? $postusername : $vbulletin->userinfo['username']); } require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $pagetext_cache = array(); // used to cache the results per languageid for speed $mod_emails = fetch_moderator_newpost_emails('newpostemail', $foruminfo['parentlist'], $language_info); ($hook = vBulletinHook::fetch_hook('newpost_notification_start')) ? eval($hook) : false; //If the target user's location is the same as the current user, then don't send them //a notification. $useremails = $vbulletin->db->query_read_slave("\n\t\tSELECT user.*, subscribethread.emailupdate, subscribethread.subscribethreadid\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribethread.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\n\t\tWHERE subscribethread.threadid = {$threadid} AND\n\t\t\tsubscribethread.emailupdate IN (1, 4) AND\n\t\t\tsubscribethread.canview = 1 AND\n\t\t\t" . ($userid ? "CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE '% " . intval($userid) . " %' AND" : '') . "\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\tuser.userid <> " . intval($userid) . " AND\n\t\t\tuser.lastactivity >= " . intval($lastposttime['dateline']) . " AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t"); vbmail_start(); $evalemail = array(); while ($touser = $vbulletin->db->fetch_array($useremails)) { if (!($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) { continue; } else { if (in_array($touser['email'], $mod_emails)) { // this user already received an email about this post via // a new post email for mods -- don't send another continue; } } $touser['username'] = unhtmlspecialchars($touser['username']); $touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']); $touser['auth'] = md5($touser['userid'] . $touser['subscribethreadid'] . $touser['salt'] . COOKIE_SALT); if (empty($evalemail)) { $email_texts = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT text, languageid, fieldname\n\t\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\t\tWHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify'\n\t\t\t"); while ($email_text = $vbulletin->db->fetch_array($email_texts)) { $emails["{$email_text['languageid']}"]["{$email_text['fieldname']}"] = $email_text['text']; } require_once DIR . '/includes/functions_misc.php'; foreach ($emails as $languageid => $email_text) { // lets cycle through our array of notify phrases $text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody']))); $text_message = replace_template_variables($text_message); $text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject']))); $text_subject = replace_template_variables($text_subject); $evalemail["{$languageid}"] = ' $message = "' . $text_message . '"; $subject = "' . $text_subject . '"; '; } } // parse the page text into plain text, taking selected language into account if (!isset($pagetext_cache["{$touser['languageid']}"])) { $plaintext_parser->set_parsing_language($touser['languageid']); $pagetext_cache["{$touser['languageid']}"] = $plaintext_parser->parse($pagetext_orig, $foruminfo['forumid']); } $pagetext = $pagetext_cache["{$touser['languageid']}"]; if ($threadinfo['prefixid']) { // need prefix in correct language $threadinfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, $touser['languageid'], false) . ' '; } else { $threadinfo['prefix_plain'] = ''; } //magic phrases for thread eval below. $threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $threadinfo['threadid'], 'title' => htmlspecialchars_uni($threadinfo['title'])), array('goto' => 'newpost')); $unsubscribelink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'removesubscription', 'type' => 'thread', 'subscriptionid' => $touser['subscribethreadid'], 'auth' => $touser['auth'])); $managesubscriptionslink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'viewsubscription', 'folderid' => 'all')); ($hook = vBulletinHook::fetch_hook('newpost_notification_message')) ? eval($hook) : false; eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"])); if ($touser['emailupdate'] == 4 and !empty($touser['icq'])) { // instant notification by ICQ $touser['email'] = $touser['icq'] . '@pager.icq.com'; } vbmail($touser['email'], $subject, $message); } unset($plaintext_parser, $pagetext_cache); $vbulletin->userinfo['username'] = $temp; vbmail_end(); }
function post_save_each($doquery = true) { $blogid = intval($this->fetch_field('blogid')); $userid = intval($this->fetch_field('userid')); $blogtextid = $this->fetch_field('blogtextid'); $postedby_userid = intval($this->fetch_field('postedby_userid')); require_once(DIR . '/vb/search/indexcontroller/queue.php'); vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogEntry', 'index', $blogid); vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogComment', 'group_data_change', $blogid); if (!$condition AND $this->info['addtags']) { // invalidate users tag cloud $dataman =& datamanager_init('Blog_User', $this->registry, ERRTYPE_SILENT); $info = array('bloguserid' => $userid); $dataman->set_existing($info); $dataman->set('tagcloud', ''); $dataman->save(); } $this->build_category_counters(); build_blog_stats(); // Insert entry for moderation if ($this->fetch_field('state') == 'moderation') { /*insert query*/ $this->dbobject->query_write(" INSERT IGNORE INTO " . TABLE_PREFIX . "blog_moderation (primaryid, type, dateline) VALUES ($blogid, 'blogid', " . TIMENOW . ") "); } // Insert entry for moderation if (!$this->condition AND ($this->fetch_field('state') == 'moderation' OR $this->fetch_field('state') == 'draft') OR $this->fetch_field('pending')) { $userinfo = array('bloguserid' => $userid); $userdata =& datamanager_init('Blog_user', $this->registry, ERRTYPE_SILENT); $userdata->set_existing($userinfo); if ($this->fetch_field('state') == 'moderation' OR $this->fetch_field('state') == 'draft') { $userdata->set($this->fetch_field('state'), $this->fetch_field('state') . ' + 1', false); } if ($this->fetch_field('pending')) { $userdata->set('pending', 'pending + 1', false); } $userdata->save(); } // Send Email Notification if (((!$this->condition AND !$this->fetch_field('pending')) OR $this->info['send_notification']) AND ($this->fetch_field('state') == 'visible' OR $this->fetch_field('state') == 'moderation') AND $this->registry->options['enableemail']) { $lastposttime = $this->dbobject->query_first(" SELECT MAX(dateline) AS dateline FROM " . TABLE_PREFIX . "blog AS blog WHERE blogid = $blogid AND dateline < " . $this->fetch_field('dateline') . " AND state = 'visible' "); $entrytitle = unhtmlspecialchars($this->fetch_field('title')); if (defined('VBBLOG_PERMS') AND $this->registry->userinfo['userid'] == $this->fetch_field('userid')) { $blogtitle = unhtmlspecialchars($this->registry->userinfo['blog_title']); $username = unhtmlspecialchars($this->registry->userinfo['username']); $userinfo =& $this->registry->userinfo; } else { if (!defined('VBBLOG_PERMS')) { // Tell the fetch_userinfo plugin that we need the blog fields in case this class is being called by a non blog script define('VBBLOG_PERMS', true); } $userinfo = fetch_userinfo($this->fetch_field('userid'), 1); cache_permissions($userinfo, false); $blogtitle = unhtmlspecialchars($userinfo['blog_title']); if ($userinfo['userid'] != $this->fetch_field('userid')) { $userinfo2 = fetch_userinfo($this->fetch_field('userid'), 1); $username = unhtmlspecialchars($userinfo2['username']); } else { $username = unhtmlspecialchars($userinfo['username']); } } require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list()); $pagetext_cache = array(); // used to cache the results per languageid for speed $pagetext_orig =& $this->fetch_field('pagetext', 'blog_text'); ($hook = vBulletinHook::fetch_hook('blog_user_notification_start')) ? eval($hook) : false; $useremails = $this->dbobject->query_read_slave(" SELECT user.*, blog_subscribeuser.blogsubscribeuserid, bm.blogmoderatorid, ignored.relationid AS ignoreid, buddy.relationid AS buddyid, bu.isblogmoderator, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "blog_subscribeuser AS blog_subscribeuser INNER JOIN " . TABLE_PREFIX . "user AS user ON (blog_subscribeuser.userid = user.userid) LEFT JOIN " . TABLE_PREFIX . "blog_moderator AS bm ON (bm.userid = user.userid) LEFT JOIN " . TABLE_PREFIX . "userlist AS buddy ON (buddy.userid = $userid AND buddy.relationid = user.userid AND buddy.type = 'buddy') LEFT JOIN " . TABLE_PREFIX . "userlist AS ignored ON (ignored.userid = $userid AND ignored.relationid = user.userid AND ignored.type = 'ignore') LEFT JOIN " . TABLE_PREFIX . "blog_user AS bu ON (bu.bloguserid = user.userid) WHERE blog_subscribeuser.bloguserid = $userid AND " . ($userid == $postedby_userid ? "blog_subscribeuser.userid <> $userid AND" : "") . " blog_subscribeuser.type = 'email' AND user.usergroupid <> 3 AND user.lastactivity >= " . intval($lastposttime['dateline']) . " "); vbmail_start(); $setoptions = $this->fetch_field('options'); $evalemail = array(); while ($touser = $this->dbobject->fetch_array($useremails)) { cache_permissions($touser, false); // only send private entries to contacts and moderators if ($setoptions["{$this->bitfields['options']['private']}"] AND !$touser['buddyid'] AND !$touser['blogmoderatorid'] AND !is_member_of_blog($touser, $userinfo)) { continue; } if (!($this->registry->usergroupcache["$touser[usergroupid]"]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup'])) { continue; } if ($this->fetch_field('state') == 'moderation') { if ($touser['userid'] != $userid AND !can_moderate_blog('canmoderateentries', $touser)) { continue; } } if (!empty($this->info['categories'])) { prepare_blog_category_permissions($touser); if (array_intersect($touser['blogcategorypermissions']['cantview'], $this->info['categories']) AND $userinfo['userid'] != $touser['userid']) { continue; } } if (!($touser['permissions']['vbblog_general_permissions'] & $this->registry->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) { continue; } else if ( !$touser['blogmoderatorid'] AND !($touser['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel']) AND !($touser['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['ismoderator']) AND (!$userinfo['ignore_canviewmyblog'] OR !$touser['ignoreid']) AND (!$userinfo['buddy_canviewmyblog'] OR !$touser['buddyid']) AND (!$userinfo['member_canviewmyblog'] OR (!$userinfo['buddy_canviewmyblog'] AND $touser['budyid']) OR (!$userinfo['ignore_canviewmyblog'] AND $touser['ignoreid'])) AND !is_member_of_blog($touser, $userinfo) ) { continue; } $touser['username'] = unhtmlspecialchars($touser['username']); $touser['languageid'] = iif($touser['languageid'] == 0, $this->registry->options['languageid'], $touser['languageid']); $touser['auth'] = md5($touser['userid'] . $touser['blogsubscribeuserid'] . $touser['salt'] . COOKIE_SALT); if (empty($evalemail)) { $email_texts = $this->dbobject->query_read_slave(" SELECT text, languageid, fieldname FROM " . TABLE_PREFIX . "phrase WHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'blog_user_notify' "); while ($email_text = $this->dbobject->fetch_array($email_texts)) { $emails["$email_text[languageid]"]["$email_text[fieldname]"] = $email_text['text']; } require_once(DIR . '/includes/functions_misc.php'); foreach ($emails AS $languageid => $email_text) { // lets cycle through our array of notify phrases $text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody']))); $text_message = replace_template_variables($text_message); $text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject']))); $text_subject = replace_template_variables($text_subject); $evalemail["$languageid"] = ' $message = "' . $text_message . '"; $subject = "' . $text_subject . '"; '; } } // parse the page text into plain text, taking selected language into account if (!isset($pagetext_cache["$touser[languageid]"])) { $plaintext_parser->set_parsing_language($touser['languageid']); $pagetext_cache["$touser[languageid]"] = $plaintext_parser->parse($pagetext_orig); } $pagetext = $pagetext_cache["$touser[languageid]"]; ($hook = vBulletinHook::fetch_hook('blog_user_notification_message')) ? eval($hook) : false; eval(iif(empty($evalemail["$touser[languageid]"]), $evalemail["-1"], $evalemail["$touser[languageid]"])); vbmail($touser['email'], $subject, $message); } unset($plaintext_parser, $pagetext_cache); vbmail_end(); } $this->post_save_each_blogtext($doquery); if ($this->fetch_field('dateline') <= TIMENOW) { $this->insert_dupehash($this->fetch_field('blogid')); } if ($this->condition AND $this->info['emailupdate'] == 'none' AND ($userid != $this->registry->userinfo['userid'] OR ($userid == $this->registry->userinfo['userid'] AND $this->existing['entrysubscribed']))) { $this->dbobject->query_write(" DELETE FROM " . TABLE_PREFIX . "blog_subscribeentry WHERE blogid = $blogid AND userid = $userid "); } else if ($this->info['emailupdate'] == 'email' OR $this->info['emailupdate'] == 'usercp') { $this->dbobject->query_write(" REPLACE INTO " . TABLE_PREFIX . "blog_subscribeentry (blogid, dateline, type, userid) VALUES ($blogid, " . TIMENOW . ", '" . $this->info['emailupdate'] . "', $userid) "); } ($hook = vBulletinHook::fetch_hook('blog_fpdata_postsave')) ? eval($hook) : false; }
function post_save_each($doquery = true, $result = false) { $pmtextid = $this->existing['pmtextid'] ? $this->existing['pmtextid'] : $this->pmtext['pmtextid']; $fromuserid = intval($this->fetch_field('fromuserid')); $fromusername = $this->fetch_field('fromusername'); $parentpmid = intval($this->info['parentpmid']); if (!$this->condition) { if (is_array($this->info['recipients'])) { $receipt_sql = array(); $popupusers = array(); $warningusers = array(); require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list()); $plaintext_title = unhtmlspecialchars($this->fetch_field('title')); // insert records for recipients foreach ($this->info['recipients'] as $userid => $user) { /*insert query*/ $query = $this->dbobject->query_write($sql = "INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid, parentpmid) VALUES ({$pmtextid}, {$user['userid']}, {$parentpmid})"); // ensure all subsequent pm's use a common parentpmid if (!$parentpmid) { $parentpmid = $this->info['parentpmid'] = $this->dbobject->insert_id(); } if ($this->info['receipt']) { $receipt_sql[] = "(" . $this->dbobject->insert_id() . ", {$fromuserid}, {$user['userid']},\n\t\t\t\t\t\t\t'" . $this->dbobject->escape_string($user['username']) . "', '" . $this->dbobject->escape_string($this->pmtext['title']) . "', " . TIMENOW . ")"; } if ($user['pmpopup']) { $popupusers[] = $user['userid']; } $email_phrases = array('pmreceived' => 'pmreceived', 'pmboxalmostfull' => 'pmboxalmostfull'); ($hook = vBulletinHook::fetch_hook('pmdata_postsave_recipient')) ? eval($hook) : false; if ($user['options'] & $this->registry->bf_misc_useroptions['emailonpm'] and $user['usergroupid'] != 3 and $user['usergroupid'] != 4) { $touserinfo =& $user; $plaintext_parser->set_parsing_language($touserinfo['languageid']); $plaintext_message = $plaintext_parser->parse($this->fetch_field('message'), 'privatemessage'); eval(fetch_email_phrases($email_phrases['pmreceived'], $touserinfo['languageid'], '', 'email')); vbmail($touserinfo['email'], $emailsubject, $emailmessage); } if (!empty($this->info['pmwarning']["{$user['userid']}"]) and !($user['options'] & $this->registry->bf_misc_useroptions['pmboxwarning'])) { // email user about pm box nearly being full $warningusers[] = $user['userid']; $touserinfo =& $user; eval(fetch_email_phrases($email_phrases['pmboxalmostfull'], $touserinfo['languageid'], '', 'email')); vbmail($touserinfo['email'], $emailsubject, $emailmessage, true); } } // insert receipts if (!empty($receipt_sql) and $this->info['cantrackpm']) { /*insert query*/ $this->dbobject->query_write("INSERT INTO " . TABLE_PREFIX . "pmreceipt\n\t(pmid, userid, touserid, tousername, title, sendtime)\nVALUES\n\t" . implode(",\n\t", $receipt_sql)); } $querysql = array("pmtotal = pmtotal + 1", "pmunread = pmunread + 1"); if (!empty($warningusers)) { $querysql[] = "\n\t\t\t\t\toptions =\n\t\t\t\t\tCASE\n\t\t\t\t\t\tWHEN userid IN(" . implode(', ', $warningusers) . ") THEN options | " . $this->registry->bf_misc_useroptions['pmboxwarning'] . "\n\t\t\t\t\tELSE options\n\t\t\t\t\tEND\n\t\t\t\t\t"; } if (!empty($popupusers)) { $querysql[] = "\n\t\t\t\t\tpmpopup =\n\t\t\t\t\tCASE\n\t\t\t\t\t\tWHEN userid IN(" . implode(', ', $popupusers) . ") THEN 2\n\t\t\t\t\tELSE pmpopup\n\t\t\t\t\tEND\n\t\t\t\t\t"; } $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\t\tSET " . implode(', ', $querysql) . "\n\t\t\t\t\tWHERE userid IN(" . implode(', ', array_keys($this->info['recipients'])) . ")\n\t\t\t\t"); } // update replied to / forwarded message 'messageread' status if (!empty($this->info['replypmid'])) { $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "pm SET\n\t\t\t\t\t\tmessageread = " . ($this->info['forward'] ? 3 : 2) . "\n\t\t\t\t\tWHERE userid = {$fromuserid} AND pmid = " . intval($this->info['replypmid'])); // mark receipt as read $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "pmreceipt\n\t\t\t\t\tSET readtime = " . TIMENOW . ",\n\t\t\t\t\t\tdenied = 0\n\t\t\t\t\tWHERE pmid = " . intval($this->info['replypmid']) . "\n\t\t\t\t\tAND touserid = " . $fromuserid . "\n\t\t\t\t\tAND readtime = 0\n\t\t\t\t"); } // save a copy in the sent items folder if ($this->info['savecopy']) { /*insert query*/ $this->dbobject->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "pm\n\t\t\t\t\t\t(pmtextid, userid, folderid, messageread, parentpmid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$pmtextid}, {$fromuserid}, -1, 1, {$parentpmid})\n\t\t\t\t"); $user = fetch_userinfo($fromuserid); $userdm =& datamanager_init('User', $this->registry, ERRTYPE_SILENT); $userdm->set_existing($user); $userdm->set('pmtotal', 'pmtotal + 1', false); $userdm->save(); unset($userdm); } // log message for throttling $frompermissions = fetch_permissions(0, $fromuserid); if ($this->registry->options['pmthrottleperiod'] and $frompermissions['pmthrottlequantity']) { $throttle_sql = array(); foreach ($this->info['recipients'] as $user) { $throttle_sql[] = "({$fromuserid}, " . TIMENOW . ")"; } if (!empty($throttle_sql)) { $this->registry->db->query_write("\n\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "pmthrottle (userid, dateline) VALUES " . implode(",\n\t", $throttle_sql)); } } } ($hook = vBulletinHook::fetch_hook('pmdata_postsave')) ? eval($hook) : false; }
$message = $postbit_obj->construct_postbit($thread); $xml->add_tag('content:encoded', $message); } $xml->add_tag('dc:date', gmdate('Y-m-d\TH:i:s', $thread['dateline']) . 'Z'); $xml->add_tag('dc:creator', unhtmlspecialchars($thread['postusername'])); $xml->add_tag('dc:subject', unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean'])); $xml->close_group('item'); break; case 'RSS2': $xml->add_group('item'); $xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title'])); $xml->add_tag('link', $vbulletin->options['bburl'] . '/' . fetch_seo_url('thread|nosession|js', $thread, array('goto' => 'newpost')), array(), false, true); $xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $thread['dateline']) . ' GMT'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list($vbulletin->options['bburl'] . '/')); $plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']); unset($plaintext_parser); if ($vbulletin->GPC['fulldesc']) { $xml->add_tag('description', $plainmessage); } else { $xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview'])); } if (!$vbulletin->GPC['nohtml']) { $thread['attachments'] = $attachmentcache["$thread[postid]"];
{ $ignorelist = preg_split('/( )+/', trim($userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); } if (!in_array($vbulletin->userinfo['userid'], $ignorelist)) { // Send pm/email $cansendemail = (($userinfo['adminemail'] OR $userinfo['showemail']) AND $vbulletin->options['enableemail'] AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canemailmember']); if ($cansendemail) { $touserinfo =& $userinfo; $fromuserinfo =& $vbulletin->userinfo; eval(fetch_email_phrases('blog_group_request_email', $touserinfo['languageid'])); require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language($touserinfo['languageid']); $message = $plaintext_parser->parse($message, 'privatemessage'); vbmail($touserinfo['email'], $subject, $message); } $pending = 'pending'; } else { $pending = 'ignored'; } $db->query_write(" REPLACE INTO " . TABLE_PREFIX . "blog_groupmembership (bloguserid, userid, state, dateline)
function exec_digest($type = 2) { // type = 2 : daily // type = 3 : weekly $lastdate = mktime(0, 0); // midnight today if ($type == 2) { // daily // yesterday midnight $lastdate -= 24 * 60 * 60; } else { // weekly // last week midnight $lastdate -= 7 * 24 * 60 * 60; } if (trim(vB::getDatastore()->getOption('globalignore')) != '') { $coventry = preg_split('#\\s+#s', vB::getDatastore()->getOption('globalignore'), -1, PREG_SPLIT_NO_EMPTY); } else { $coventry = array(); } require_once DIR . '/includes/class_bbcode_alt.php'; $vbulletin =& vB::get_registry(); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); vB_Mail::vbmailStart(); $bf_misc_useroptions = vB::get_datastore()->get_value('bf_misc_useroptions'); $bf_ugp_genericoptions = vB::get_datastore()->get_value('bf_ugp_genericoptions'); $bf_ugp_forumpermissions = vB::get_datastore()->get_value('bf_ugp_forumpermissions'); // we want to fetch all language records at once and using cache if possible $defaultLanguage = false; $languageIds = array(); // get new threads (Topic Subscription) $threads = vB::getDbAssertor()->getRows('getNewThreads', array('dstonoff' => $bf_misc_useroptions['dstonoff'], 'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'], 'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup'], 'lastdate' => intval($lastdate))); // grab all forums / subforums for given subscription (Channel Subscription) $forums = vB::getDbAssertor()->assertQuery('getNewForums', array('dstonoff' => $bf_misc_useroptions['dstonoff'], 'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'], 'type' => intval($type), 'lastdate' => intval($lastdate), 'channelcontenttype' => vB_Api::instanceInternal('contenttype')->fetchContentTypeIdFromClass('Channel'), 'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup'])); // Let's see which languageids we wanna fetch foreach ($threads as $thread) { if ($thread['languageid'] == 0) { if (!$defaultLanguage) { $defaultLanguage = intval(vB::getDatastore()->getOption('languageid')); $languageIds[] = $defaultLanguage; } } else { $languageIds[] = $thread['languageid']; } } foreach ($forums as $forum) { if ($forum['languageid'] == 0) { if (!$defaultLanguage) { $defaultLanguage = intval(vB::getDatastore()->getOption('languageid')); $languageIds[] = $defaultLanguage; } } else { $languageIds[] = $forum['languageid']; } } // fetch languages $languages = vB_Library::instance('language')->fetchLanguages($languageIds); // process threads foreach ($threads as $thread) { $postbits = ''; // Make sure user have correct email notification settings. if ($thread['emailnotification'] != $type) { continue; } if ($thread['lastauthorid'] != $thread['userid'] and in_array($thread['lastauthorid'], $coventry)) { continue; } $usercontext = vB::getUserContext($thread['userid']); if (!$usercontext->getChannelPermission('forumpermissions', 'canview', $thread['nodeid']) or !$usercontext->getChannelPermission('forumpermissions', 'canviewthreads', $thread['nodeid']) or $thread['lastauthorid'] != $thread['userid'] and !$usercontext->getChannelPermission('forumpermissions', 'canviewothers', $thread['nodeid'])) { continue; } $langInfo =& $languages[$thread['languageid']]; $userinfo = array('lang_locale' => $langInfo['locale'], 'dstonoff' => $thread['dstonoff'], 'timezoneoffset' => $thread['timezoneoffset']); $thread['lastreplydate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $thread['lastcontent'], false, true, true, false, $userinfo); $thread['lastreplytime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $thread['lastcontent'], false, true, true, false, $userinfo); $thread['htmltitle'] = unhtmlspecialchars($thread['htmltitle']); $thread['username'] = unhtmlspecialchars($thread['username']); $thread['postusername'] = unhtmlspecialchars($thread['authorname']); $thread['lastposter'] = unhtmlspecialchars($thread['lastcontentauthor']); $thread['newposts'] = 0; //not currently used and probably needs rethinking, but don't want to remove until this code gets rewritten //$thread['auth'] = md5($thread['userid'] . $thread['subscribediscussionid'] . $thread['secret'] . vB_Request_Web::$COOKIE_SALT); if ($thread['prefixid']) { // need prefix in correct language $phraseAux = vB_Api::instanceInternal('phrase')->fetch(array("prefix_{$thread['prefixid']}_title_plain")); $thread['prefix_plain'] = $phraseAux["prefix_{$thread['prefixid']}_title_plain"] . ' '; } else { $thread['prefix_plain'] = ''; } // Note: closure.depth = 1 on the where clause means getNewPosts only grabs replies, not comments. // get posts $posts = vB::getDbAssertor()->getRows('getNewPosts', array('threadid' => intval($thread['nodeid']), 'lastdate' => intval($lastdate))); // compile $haveothers = false; foreach ($posts as $post) { if ($post['userid'] != $thread['userid'] and in_array($post['userid'], $coventry)) { continue; } if ($post['userid'] != $thread['userid']) { $haveothers = true; } $thread['newposts']++; $post['htmltitle'] = unhtmlspecialchars($post['htmltitle']); $post['postdate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $post['publishdate'], false, true, true, false, $userinfo); $post['posttime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $post['publishdate'], false, true, true, false, $userinfo); $post['postusername'] = unhtmlspecialchars($post['authorname']); $plaintext_parser->set_parsing_language($thread['languageid']); $contentAPI = vB_Library_Content::getContentApi($post['contenttypeid']); $contents = $contentAPI->getContent($post['nodeid']); $post['pagetext'] = $plaintext_parser->parse($contents[$post['nodeid']]['rawtext'], $thread['parentid']); $postlink = vB5_Route::buildUrl($post['routeid'] . '|bburl', array('nodeid' => $post['nodeid'])); /*$postlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['nodeid'], 'title' => htmlspecialchars_uni($thread['title']))) . "#post$post[nodeid]";*/ // Legacy Hook 'digest_thread_post' Removed // $phrases = vB_Api::instanceInternal('phrase')->fetch('digestpostbit', $thread['languageid']); $postbits .= sprintf($phrases['digestpostbit'], $post['htmltitle'], $postlink, $post['postusername'], $post['postdate'], $post['posttime'], $post['pagetext']); } // Legacy Hook 'digest_thread_process' Removed // // Don't send an update if the subscriber is the only one who posted in the thread. if ($haveothers) { // make email // magic vars used by the phrase eval $threadlink = vB5_Route::buildUrl($thread['routeid'] . '|fullurl', array('nodeid' => $thread['nodeid'])); //$threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title']))); //this link probably doesn't do what the author thinks it does, need to validate. $unsubscribelink = vB5_Route::buildUrl('subscription|fullurl', array('tab' => 'subscriptions', 'userid' => $thread['userid'])); $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestthread', array($thread['username'], $thread['prefix_plain'], $thread['htmltitle'], $thread['postusername'], $thread['newposts'], $thread['lastposter'], $threadlink, $postbits, vB::getDatastore()->getOption('bbtitle'), $unsubscribelink), array($thread['prefix_plain'], $thread['htmltitle']), $thread['languageid']); vB_Mail::vbmail($thread['email'], $maildata['subject'], $maildata['message']); } } unset($plaintext_parser); // process forums foreach ($forums as $forum) { $langInfo =& $languages[$forum['languageid']]; $userinfo = array('lang_locale' => $langInfo['locale'], 'dstonoff' => $forum['dstonoff'], 'timezoneoffset' => $forum['timezoneoffset']); $newthreadbits = ''; $newthreads = 0; $updatedthreadbits = ''; $updatedthreads = 0; $forum['username'] = unhtmlspecialchars($forum['username']); $forum['title_clean'] = unhtmlspecialchars($forum['title_clean']); //not currently used and probably needs rethinking, but don't want to remove until this code gets rewritten //$forum['auth'] = md5($forum['userid'] . $forum['subscribeforumid'] . $forum['secret'] . vB_Request_Web::$COOKIE_SALT); $threads = vB::getDbAssertor()->assertQuery('fetchForumThreads', array('forumid' => intval($forum['forumid']), 'lastdate' => intval($lastdate))); foreach ($threads as $thread) { if ($thread['postuserid'] != $forum['userid'] and in_array($thread['postuserid'], $coventry)) { continue; } // allow those without canviewthreads to subscribe/receive forum updates as they contain not post content $usercontext = vB::getUserContext($thread['userid']); if (!$usercontext->getChannelPermission('forumpermissions', 'canview', $thread['nodeid']) or $thread['lastauthorid'] != $thread['userid'] and !$usercontext->getChannelPermission('forumpermissions', 'canviewothers', $thread['nodeid'])) { continue; } $thread['forumhtmltitle'] = unhtmlspecialchars($thread['forumhtmltitle']); $thread['lastreplydate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $thread['lastpost'], false, true, true, false, $userinfo); $thread['lastreplytime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $thread['lastpost'], false, true, true, false, $userinfo); $thread['htmltitle'] = unhtmlspecialchars($thread['htmltitle']); $thread['postusername'] = unhtmlspecialchars($thread['postusername']); $thread['lastposter'] = unhtmlspecialchars($thread['lastposter']); if ($thread['prefixid']) { // need prefix in correct language $phraseAux = vB_Api::instanceInternal('phrase')->fetch(array("prefix_{$thread['prefixid']}_title_plain")); $thread['prefix_plain'] = $phraseAux["prefix_{$thread['prefixid']}_title_plain"] . ' '; } else { $thread['prefix_plain'] = ''; } $threadlink = vB5_Route::buildUrl($thread['routeid'] . '|fullurl', array('nodeid' => $thread['threadid'])); // Legacy Hook 'digest_forum_thread' Removed // $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestthreadbit', array($thread['prefix_plain'], $thread['htmltitle'], $threadlink, $thread['forumhtmltitle'], $thread['postusername'], $thread['lastreplydate'], $thread['lastreplytime']), array(), $forum['languageid']); if ($thread['dateline'] > $lastdate) { // new thread $newthreads++; $newthreadbits .= $maildata['message']; } else { $updatedthreads++; $updatedthreadbits .= $maildata['message']; } } // Legacy Hook 'digest_forum_process' Removed // if (!empty($newthreads) or !empty($updatedthreadbits)) { // make email // magic vars used by the phrase eval //$forumlink = fetch_seo_url('forum|nosession|bburl', $forum); $forumlink = vB5_Route::buildUrl($forum['routeid'] . '|fullurl', array('nodeid' => $forum['forumid'])); //this link probably doesn't do what the author thinks it does. Need to validate. $unsubscribelink = vB5_Route::buildUrl('subscription|fullurl', array('tab' => 'subscriptions', 'userid' => $forum['userid'])); $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestforum', array($forum['username'], $forum['title_clean'], $newthreads, $updatedthreads, $forumlink, $newthreadbits, $updatedthreadbits, vB::getDatastore()->getOption('bbtitle'), $unsubscribelink), array($forum['title_clean']), $forum['languageid']); vB_Mail::vbmail($forum['email'], $maildata['subject'], $maildata['message'], true); } } // ******* Social Group Digests ********** $bf_misc_socnet = vB::get_datastore()->get_value('bf_misc_socnet'); if (vB::getDatastore()->getOption('socnet') & $bf_misc_socnet['enable_groups']) { require_once DIR . '/includes/functions_socialgroup.php'; /** @todo review this part*/ /** @todo if we reenable this code, we need to prefetch language records as for threads and forums */ /* $groups = vB::getDbAssertor()->assertQuery('fetchSocialGroupDigests', array( 'dstonoff' => $bf_misc_useroptions['dstonoff'], 'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'], 'languageid' => intval(vB::getDatastore()->getOption('languageid')), 'type' => $type == 2 ? 'daily' : 'weekly', 'lastdate' => intval($lastdate), 'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup'] )); foreach ($groups as $group) { $userperms = cache_permissions($group, false); if (!($userperms['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) ) { continue; } if ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view'] AND $vbulletin->options['sg_allow_join_to_view']) { if ($group['membertype'] != 'member' AND !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage']) AND !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwascreatediscussion']) ) { continue; } } $userinfo = array( 'lang_locale' => $group['lang_locale'], 'dstonoff' => $group['dstonoff'], 'timezoneoffset' => $group['timezoneoffset'], ); $new_discussion_bits = ''; $new_discussions = 0; $updated_discussion_bits = ''; $updated_discussions = 0; $group['username'] = unhtmlspecialchars($group['username']); $group['name'] = unhtmlspecialchars($group['name']); $discussions = vB::getDbAssertor()->assertQuery('fetchGroupDiscussions', array( 'groupid' => $group['groupid'], 'lastdate' => intval($lastdate) )); foreach ($discussions as $discussion) { $discussion['lastreplydate'] = vbdate($group['lang_dateoverride'] ? $group['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $discussion['lastpost'], false, true, true, false, $userinfo); $discussion['lastreplytime'] = vbdate($group['lang_timeoverride'] ? $group['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $discussion['lastpost'], false, true, true, false, $userinfo); $discussion['title'] = unhtmlspecialchars($discussion['title']); $discussion['postusername'] = unhtmlspecialchars($discussion['postusername']); $discussion['lastposter'] = unhtmlspecialchars($discussion['lastposter']); // Legacy Hook 'digest_group_discussion' Removed // //magic variables that will be picked up by the phrase eval $discussionlink = fetch_seo_url('groupdiscussion', $discussion); $maildata = vB_Api::instanceInternal('phrase') ->fetchEmailPhrases('digestgroupbit', array($discussion['htmltitle'], $discussionlink, $group['name'], $discussion['postusername'], $discussion['lastreplydate'], $discussion['lastreplytime']), array(), $group['languageid']); if ($discussion['dateline'] > $lastdate) { // new discussion $new_discussions++; $new_discussion_bits .= $maildata['message']; } else { $updated_discussions++; $updated_discussion_bits .= $maildata['message']; } } // Legacy Hook 'digest_group_process' Removed // if (!empty($new_discussion_bits) OR !empty($updated_discussion_bits)) { //magic variables that will be picked up by the phrase eval $grouplink = fetch_seo_url('group|nosession|bburl', $group); // make email $maildata = vB_Api::instanceInternal('phrase') ->fetchEmailPhrases('digestgroup', array($group['username'], $group['name'], $new_discussions, $updated_discussions, $grouplink, $new_discussion_bits, $updated_discussion_bits, $vbulletin->options['bbtitle']), array($group['name']), $group['languageid']); vB_Mail::vbmail($group['email'], $maildata['subject'], $maildata['message']); } } */ } vB_Mail::vbmailEnd(); }
/** * Sends email notifications for discussions. * * @param int $discussion - The discussion being updated * @param int $messageid - Id of the message that triggered the update * @param string $postusername - Optional username displayed on post */ function exec_send_sg_notification($discussionid, $gmid = false, $postusername = false) { global $vbulletin; if (!$vbulletin->options['enableemail']) { return; } $discussion = fetch_socialdiscussioninfo($discussionid); // if there are no subscribers, no need to send notifications if (!$discussion['subscribers']) { return; } // if the discussion is moderated or deleted, don't send notification if ('deleted' == $discussion['state'] OR 'moderation' == $discussion['state']) { return; } $group = fetch_socialgroupinfo($discussion['groupid']); if (!$gmid) { // get last gmid from discussion $gmid = $vbulletin->db->query_first(" SELECT MAX(gmid) AS gmid FROM " . TABLE_PREFIX . "groupmessage AS groupmessage WHERE discussionid = $discussion[discussionid] AND state = 'visible' "); $gmid = $gmid['gmid']; } // get message details $gmessage = fetch_groupmessageinfo($gmid); if (!$gmessage) { return; } // get post time of previous message - if a user hasn't been active since then we won't resend a notification $lastposttime = (($lastposttime = $vbulletin->db->query_first(" SELECT MAX(dateline) AS dateline FROM " . TABLE_PREFIX . "groupmessage AS groupmessage WHERE discussionid = $discussion[discussionid] AND dateline < $gmessage[dateline] AND state = 'visible' ")) ? $lastposttime['dateline'] : $gmessage['dateline']); $discussion['title'] = unhtmlspecialchars($discussion['title']); $group['name'] = unhtmlspecialchars($group['name']); // temporarily use postusername in userinfo if (!$postusername) { // get current user name if user exists if ($gmessage['postuserid'] AND ($userinfo = fetch_userinfo($gmessage['postuserid']))) { $postusername = $userinfo['username']; } else { $postusername = $gmessage['postusername']; } } $postusername = unhtmlspecialchars($postusername); $userid = $gmessage['postuserid']; ($hook = vBulletinHook::fetch_hook('newpost_sg_notification_start')) ? eval($hook) : false; $useremails = $vbulletin->db->query_read_slave(" SELECT user.*, subscribediscussion.emailupdate, subscribediscussion.subscribediscussionid, IF(socialgroupmember.userid IS NOT NULL,1,0) ismember FROM " . TABLE_PREFIX . "subscribediscussion AS subscribediscussion INNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribediscussion.userid = user.userid) LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid) LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) LEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = user.userid AND socialgroupmember.groupid = $group[groupid]) WHERE subscribediscussion.discussionid = $discussion[discussionid] AND subscribediscussion.emailupdate = 1 AND " . ($gmessage['postuserid'] ? " CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE ' " . intval($userid) . " '" : '') . " AND user.usergroupid <> 3 AND user.userid <> " . intval($userid) . " AND user.lastactivity >= " . intval($lastposttime) . " AND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ") "); vbmail_start(); // parser for plaintexting the message pagetext require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $pagetext_cache = array(); // used to cache the results per languageid for speed $evalemail = array(); while ($touser = $vbulletin->db->fetch_array($useremails)) { // check user can view discussion $permissions = cache_permissions($touser, false); if (!($vbulletin->usergroupcache["$touser[usergroupid]"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup']) OR !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) OR (($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) AND !$touser['ismember'] AND !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayscreatediscussion']) AND !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage']))) { continue; } $touser['username'] = unhtmlspecialchars($touser['username']); $touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']); $touser['auth'] = md5($touser['userid'] . $touser['subscribediscussionid'] . $touser['salt'] . COOKIE_SALT); if (empty($evalemail)) { $email_texts = $vbulletin->db->query_read_slave(" SELECT text, languageid, fieldname FROM " . TABLE_PREFIX . "phrase WHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify_discussion' "); while ($email_text = $vbulletin->db->fetch_array($email_texts)) { $emails["$email_text[languageid]"]["$email_text[fieldname]"] = $email_text['text']; } require_once(DIR . '/includes/functions_misc.php'); foreach ($emails AS $languageid => $email_text) { // lets cycle through our array of notify phrases $text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody']))); $text_message = replace_template_variables($text_message); $text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject']))); $text_subject = replace_template_variables($text_subject); $evalemail["$languageid"] = ' $message = "' . $text_message . '"; $subject = "' . $text_subject . '"; '; } } // parse the page text into plain text, taking selected language into account if (!isset($pagetext_cache["$touser[languageid]"])) { $plaintext_parser->set_parsing_language($touser['languageid']); $pagetext_cache["$touser[languageid]"] = $plaintext_parser->parse($gmessage['pagetext']); } $pagetext = $pagetext_cache["$touser[languageid]"]; ($hook = vBulletinHook::fetch_hook('new_sg_message_notification_message')) ? eval($hook) : false; eval(iif(empty($evalemail["$touser[languageid]"]), $evalemail["-1"], $evalemail["$touser[languageid]"])); vbmail($touser['email'], $subject, $message); } $vbulletin->db->free_result($useremails); unset($plaintext_parser, $pagetext_cache); vbmail_end(); }
function email_moderators($fields) { if ($this->info['skip_moderator_email'] or !$this->info['forum'] or in_coventry($this->fetch_field('userid', 'post'), true)) { return; } $mod_emails = fetch_moderator_newpost_emails($fields, $this->info['forum']['parentlist'], $newpost_lang); if (!empty($mod_emails)) { $foruminfo = $this->info['forum']; $foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']); $threadinfo = fetch_threadinfo($this->fetch_field('threadid')); require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list()); $email = $this->info['user']['email'] ? $this->info['user']['email'] : $this->registry->userinfo['email']; $browsing_user = $this->registry->userinfo['username']; // ugly hack -- should be fixed in the future $this->registry->userinfo['username'] = unhtmlspecialchars($this->info['user']['username'] ? $this->info['user']['username'] : $this->registry->userinfo['username']); $post = array_merge($this->existing, $this->post); if (!$post['postid']) { $post['postid'] = $this->thread['firstpostid']; } require_once DIR . '/includes/functions_misc.php'; foreach ($mod_emails as $toemail) { if ($toemail != $email) { $plaintext_parser->set_parsing_language(isset($newpost_lang["{$toemail}"]) ? $newpost_lang["{$toemail}"] : 0); $post['message'] = $plaintext_parser->parse($this->post['pagetext'], $foruminfo['forumid']); if ($threadinfo['prefixid']) { // need prefix in correct language $threadinfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, isset($newpost_lang["{$toemail}"]) ? $newpost_lang["{$toemail}"] : 0, false) . ' '; } else { $threadinfo['prefix_plain'] = ''; } $threadlink = fetch_seo_url('thread|nosession|bburl', $threadinfo); eval(fetch_email_phrases('moderator', iif(isset($newpost_lang["{$toemail}"]), $newpost_lang["{$toemail}"], 0))); vbmail($toemail, $subject, $message); } } // back to normal $this->registry->userinfo['username'] = htmlspecialchars_uni($browsing_user); } }
function exec_digest($type = 2) { global $vbulletin; // for fetch_phrase require_once DIR . '/includes/functions_misc.php'; // type = 2 : daily // type = 3 : weekly $lastdate = mktime(0, 0); // midnight today if ($type == 2) { // daily // yesterday midnight $lastdate -= 24 * 60 * 60; } else { // weekly // last week midnight $lastdate -= 7 * 24 * 60 * 60; } if (trim($vbulletin->options['globalignore']) != '') { $coventry = preg_split('#\\s+#s', $vbulletin->options['globalignore'], -1, PREG_SPLIT_NO_EMPTY); } else { $coventry = array(); } require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); vbmail_start(); // get new threads $threads = $vbulletin->db->query_read_slave("\n\t\tSELECT\n\t\tuser.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\tthread.threadid, thread.title, thread.prefixid, thread.dateline, thread.forumid, thread.lastpost, pollid,\n\t\topen, replycount, postusername, postuserid, lastposter, thread.dateline, views, subscribethreadid,\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = subscribethread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscribethread.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\n\t\tWHERE subscribethread.emailupdate = " . intval($type) . " AND\n\t\t\tthread.lastpost > " . intval($lastdate) . " AND\n\t\t\tthread.visible = 1 AND\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t"); while ($thread = $vbulletin->db->fetch_array($threads)) { $postbits = ''; if ($thread['postuserid'] != $thread['userid'] and in_array($thread['postuserid'], $coventry)) { continue; } $userperms = fetch_permissions($thread['forumid'], $thread['userid'], $thread); if (!($userperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or $thread['postuserid'] != $thread['userid'] and !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) { continue; } $userinfo = array('lang_locale' => $thread['lang_locale'], 'dstonoff' => $thread['dstonoff'], 'timezoneoffset' => $thread['timezoneoffset']); $thread['lastreplydate'] = vbdate($thread['lang_dateoverride'] ? $thread['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $thread['lastpost'], false, true, true, false, $userinfo); $thread['lastreplytime'] = vbdate($thread['lang_timeoverride'] ? $thread['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $thread['lastpost'], false, true, true, false, $userinfo); $thread['title'] = unhtmlspecialchars($thread['title']); $thread['username'] = unhtmlspecialchars($thread['username']); $thread['postusername'] = unhtmlspecialchars($thread['postusername']); $thread['lastposter'] = unhtmlspecialchars($thread['lastposter']); $thread['newposts'] = 0; $thread['auth'] = md5($thread['userid'] . $thread['subscribethreadid'] . $thread['salt'] . COOKIE_SALT); if ($thread['prefixid']) { // need prefix in correct language $thread['prefix_plain'] = fetch_phrase("prefix_{$thread['prefixid']}_title_plain", 'global', '', false, true, $thread['languageid'], false) . ' '; } else { $thread['prefix_plain'] = ''; } // get posts $posts = $vbulletin->db->query_read_slave("SELECT\n\t\t\tpost.*, IFNULL(user.username,post.username) AS postusername,\n\t\t\tuser.*\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)\n\t\t\tWHERE threadid = " . intval($thread['threadid']) . " AND\n\t\t\t\tpost.visible = 1 AND\n\t\t\t\tuser.usergroupid <> 3 AND\n\t\t\t\tpost.dateline > " . intval($lastdate) . "\n\t\t\tORDER BY post.dateline\n\t\t"); // compile $haveothers = false; while ($post = $vbulletin->db->fetch_array($posts)) { if ($post['userid'] != $thread['userid'] and in_array($post['userid'], $coventry)) { continue; } if ($post['userid'] != $thread['userid']) { $haveothers = true; } $thread['newposts']++; $post['postdate'] = vbdate($thread['lang_dateoverride'] ? $thread['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $post['dateline'], false, true, true, false, $userinfo); $post['posttime'] = vbdate($thread['lang_timeoverride'] ? $thread['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $post['dateline'], false, true, true, false, $userinfo); $post['postusername'] = unhtmlspecialchars($post['postusername']); $plaintext_parser->set_parsing_language($thread['languageid']); $post['pagetext'] = $plaintext_parser->parse($post['pagetext'], $thread['forumid']); $postlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title'])), array('p' => $post['postid'])) . "#post{$post['postid']}"; ($hook = vBulletinHook::fetch_hook('digest_thread_post')) ? eval($hook) : false; eval(fetch_email_phrases('digestpostbit', $thread['languageid'])); $postbits .= $message; } ($hook = vBulletinHook::fetch_hook('digest_thread_process')) ? eval($hook) : false; // Don't send an update if the subscriber is the only one who posted in the thread. if ($haveothers) { // make email // magic vars used by the phrase eval $threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title']))); $unsubscribelink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'removesubscription', 'type' => 'thread', 'subscriptionid' => $thread['subscribethreadid'], 'auth' => $thread['auth'])); eval(fetch_email_phrases('digestthread', $thread['languageid'])); vbmail($thread['email'], $subject, $message); } } unset($plaintext_parser); // get new forums $forums = $vbulletin->db->query_read_slave("\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\t\tforum.forumid, forum.title_clean, forum.title, subscribeforum.subscribeforumid,\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\n\t\tFROM " . TABLE_PREFIX . "subscribeforum AS subscribeforum\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = subscribeforum.forumid)\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscribeforum.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\n\t\tWHERE subscribeforum.emailupdate = " . intval($type) . " AND\n\t\t\tforum.lastpost > " . intval($lastdate) . " AND\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t"); while ($forum = $vbulletin->db->fetch_array($forums)) { $userinfo = array('lang_locale' => $forum['lang_locale'], 'dstonoff' => $forum['dstonoff'], 'timezoneoffset' => $forum['timezoneoffset']); $newthreadbits = ''; $newthreads = 0; $updatedthreadbits = ''; $updatedthreads = 0; $forum['username'] = unhtmlspecialchars($forum['username']); $forum['title_clean'] = unhtmlspecialchars($forum['title_clean']); $forum['auth'] = md5($forum['userid'] . $forum['subscribeforumid'] . $forum['salt'] . COOKIE_SALT); $threads = $vbulletin->db->query_read_slave("\n\t\t\tSELECT forum.title_clean AS forumtitle, thread.threadid, thread.title, thread.prefixid,\n\t\t\t\tthread.dateline, thread.forumid, thread.lastpost, pollid, open, thread.replycount,\n\t\t\t\tpostusername, postuserid, thread.lastposter, thread.dateline, views\n\t\t\tFROM " . TABLE_PREFIX . "forum AS forum\n\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread USING(forumid)\n\t\t\tWHERE FIND_IN_SET('" . intval($forum['forumid']) . "', forum.parentlist) AND\n\t\t\t\tthread.lastpost > " . intval($lastdate) . " AND\n\t\t\t\tthread.visible = 1\n\t\t"); while ($thread = $vbulletin->db->fetch_array($threads)) { if ($thread['postuserid'] != $forum['userid'] and in_array($thread['postuserid'], $coventry)) { continue; } $userperms = fetch_permissions($thread['forumid'], $forum['userid'], $forum); // allow those without canviewthreads to subscribe/receive forum updates as they contain not post content if (!($userperms & $vbulletin->bf_ugp_forumpermissions['canview']) or $thread['postuserid'] != $forum['userid'] and !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) { continue; } $thread['forumtitle'] = unhtmlspecialchars($thread['forumtitle']); $thread['lastreplydate'] = vbdate($forum['lang_dateoverride'] ? $forum['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $thread['lastpost'], false, true, true, false, $userinfo); $thread['lastreplytime'] = vbdate($forum['lang_timeoverride'] ? $forum['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $thread['lastpost'], false, true, true, false, $userinfo); $thread['title'] = unhtmlspecialchars($thread['title']); $thread['postusername'] = unhtmlspecialchars($thread['postusername']); $thread['lastposter'] = unhtmlspecialchars($thread['lastposter']); if ($thread['prefixid']) { // need prefix in correct language $thread['prefix_plain'] = fetch_phrase("prefix_{$thread['prefixid']}_title_plain", 'global', '', false, true, $forum['languageid'], false) . ' '; } else { $thread['prefix_plain'] = ''; } $threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title']))); ($hook = vBulletinHook::fetch_hook('digest_forum_thread')) ? eval($hook) : false; eval(fetch_email_phrases('digestthreadbit', $forum['languageid'])); if ($thread['dateline'] > $lastdate) { // new thread $newthreads++; $newthreadbits .= $message; } else { $updatedthreads++; $updatedthreadbits .= $message; } } ($hook = vBulletinHook::fetch_hook('digest_forum_process')) ? eval($hook) : false; if (!empty($newthreads) or !empty($updatedthreadbits)) { // make email // magic vars used by the phrase eval $forumlink = fetch_seo_url('forum|nosession|bburl', $forum); $unsubscribelink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'removesubscription', 'type' => 'forum', 'subscriptionid' => $forum['subscribeforumid'], 'auth' => $forum['auth'])); eval(fetch_email_phrases('digestforum', $forum['languageid'])); vbmail($forum['email'], $subject, $message); } } // ******* Social Group Digests ********** if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups']) { require_once DIR . '/includes/functions_socialgroup.php'; $groups = $vbulletin->db->query_read_slave("\n\t\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\n\t\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\n\t\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\t\t\tsocialgroup.groupid, socialgroup.name, socialgroup.options, socialgroupmember.type AS membertype, \n\t\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\n\t\t\tFROM " . TABLE_PREFIX . "subscribegroup AS subscribegroup\n\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = subscribegroup.groupid)\n\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscribegroup.userid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t\t(socialgroupmember.userid = user.userid AND socialgroupmember.groupid = socialgroup.groupid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\n\t\t\tWHERE subscribegroup.emailupdate = '" . ($type == 2 ? 'daily' : 'weekly') . "' AND\n\t\t\t\tsocialgroup.lastpost > " . intval($lastdate) . " AND\n\t\t\t\tuser.usergroupid <> 3 AND\n\t\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t\t"); while ($group = $vbulletin->db->fetch_array($groups)) { $userperms = cache_permissions($group, false); if (!($userperms['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'])) { continue; } if ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view'] and $vbulletin->options['sg_allow_join_to_view']) { if ($group['membertype'] != 'member' and !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage']) and !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwascreatediscussion'])) { continue; } } $userinfo = array('lang_locale' => $group['lang_locale'], 'dstonoff' => $group['dstonoff'], 'timezoneoffset' => $group['timezoneoffset']); $new_discussion_bits = ''; $new_discussions = 0; $updated_discussion_bits = ''; $updated_discussions = 0; $group['username'] = unhtmlspecialchars($group['username']); $group['name'] = unhtmlspecialchars($group['name']); $discussions = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT discussion.*, firstmessage.dateline,\n\t\t\t\t\tfirstmessage.title, firstmessage.postuserid, firstmessage.postusername\n\t\t\t\tFROM " . TABLE_PREFIX . "discussion AS discussion\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "groupmessage AS firstmessage ON\n\t\t\t\t\t(firstmessage.gmid = discussion.firstpostid)\n\t\t\t\tWHERE discussion.groupid = {$group['groupid']}\n\t\t\t\t\tAND discussion.lastpost > " . intval($lastdate) . "\n\t\t\t\t\tAND firstmessage.state = 'visible'\n\t\t\t"); while ($discussion = $vbulletin->db->fetch_array($discussions)) { $discussion['lastreplydate'] = vbdate($group['lang_dateoverride'] ? $group['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $discussion['lastpost'], false, true, true, false, $userinfo); $discussion['lastreplytime'] = vbdate($group['lang_timeoverride'] ? $group['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $discussion['lastpost'], false, true, true, false, $userinfo); $discussion['title'] = unhtmlspecialchars($discussion['title']); $discussion['postusername'] = unhtmlspecialchars($discussion['postusername']); $discussion['lastposter'] = unhtmlspecialchars($discussion['lastposter']); ($hook = vBulletinHook::fetch_hook('digest_group_discussion')) ? eval($hook) : false; //magic variables that will be picked up by the phrase eval $discussionlink = fetch_seo_url('groupdiscussion', $discussion); eval(fetch_email_phrases('digestgroupbit', $group['languageid'])); if ($discussion['dateline'] > $lastdate) { // new discussion $new_discussions++; $new_discussion_bits .= $message; } else { $updated_discussions++; $updated_discussion_bits .= $message; } } ($hook = vBulletinHook::fetch_hook('digest_group_process')) ? eval($hook) : false; if (!empty($new_discussion_bits) or !empty($updated_discussion_bits)) { //magic variables that will be picked up by the phrase eval $grouplink = fetch_seo_url('group|nosession|bburl', $group); // make email eval(fetch_email_phrases('digestgroup', $group['languageid'])); vbmail($group['email'], $subject, $message); } } } vbmail_end(); }
} $eventdata->set('userid', $vbulletin->userinfo['userid']); $eventdata->set('calendarid', $calendarinfo['calendarid']); $eventid = $eventdata->save(); if ($calendarinfo['neweventemail']) { $calemails = unserialize($calendarinfo['neweventemail']); $calendarinfo['title'] = unhtmlspecialchars($calendarinfo['title']); $title =& $vbulletin->GPC['title']; $vbulletin->userinfo['username'] = unhtmlspecialchars($vbulletin->userinfo['username']); //for emails require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language(0); // email addresses don't have a language ID $eventmessage = $plaintext_parser->parse($message, 'calendar'); foreach ($calemails AS $index => $toemail) { if (trim($toemail)) { eval(fetch_email_phrases('newevent', 0)); vbmail($toemail, $subject, $message, true); } } } ($hook = vBulletinHook::fetch_hook('calendar_update_complete')) ? eval($hook) : false;
$attachthumbs = $vbulletin->options['attachthumbs']; // list returned blog entries $perm_cache = array(); foreach($blogcache AS $blog_post) { $xml->add_group('item'); $xml->add_tag('title', unhtmlspecialchars($blog_post['title'])); $xml->add_tag('link', $vbulletin->options['bburl'] . "/blog.php?b=$blog_post[blogid]", array(), false, true); $xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $blog_post['dateline']) . ' GMT'); if (!isset($perm_cache["$blog_post[userid]"])) { $perm_cache["$blog_post[userid]"] = cache_permissions($blog_post, false); } $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parse_userinfo($blog_post, $perm_cache["$blog_post[userid]"]); $plainmessage = $plaintext_parser->parse($blog_post['pagetext'], 'blog_comment'); unset($plaintext_parser); if ($vbulletin->GPC['fulldesc']) { $xml->add_tag('description', $plainmessage); } else { $xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview'])); } if (!$vbulletin->GPC['nohtml'])