function exec_strike_user($username = '') { global $vbulletin, $strikes; if (!$vbulletin->options['usestrikesystem']) { return 0; } if (!empty($username)) { $strikes_user = $vbulletin->db->query_first("\n\t\t\tSELECT COUNT(*) AS strikes\n\t\t\tFROM " . TABLE_PREFIX . "strikes\n\t\t\tWHERE strikeip = '" . $vbulletin->db->escape_string(IPADDRESS) . "'\n\t\t\t\tAND username = '******'\n\t\t"); if ($strikes_user['strikes'] == 4) { if ($user = $vbulletin->db->query_first("SELECT userid, username, email, languageid FROM " . TABLE_PREFIX . "user WHERE username = '******' AND usergroupid <> 3")) { $ip = IPADDRESS; eval(fetch_email_phrases('accountlocked', $user['languageid'])); vbmail($user['email'], $subject, $message, true); } } } /*insert query*/ $vbulletin->db->query_write("\n\t\tINSERT INTO " . TABLE_PREFIX . "strikes\n\t\t(striketime, strikeip, username)\n\t\tVALUES\n\t\t(" . TIMENOW . ", '" . $vbulletin->db->escape_string(IPADDRESS) . "', '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "')\n\t"); $strikes++; ($hook = vBulletinHook::fetch_hook('login_strikes')) ? eval($hook) : false; }
/** * Halts execution of the entire system and displays an error message * * @param string Text of the error message. Leave blank to use $this->sql as error text. * * @return integer */ function halt($errortext = '') { global $vbulletin; if ($this->connection_recent) { $this->error = $this->error($this->connection_recent); $this->errno = $this->errno($this->connection_recent); } if ($this->reporterror) { if ($errortext == '') { $this->sql = "Invalid SQL:\r\n" . chop($this->sql) . ';'; $errortext =& $this->sql; } $vboptions =& $vbulletin->options; $technicalemail =& $vbulletin->config['Database']['technicalemail']; $bbuserinfo =& $vbulletin->userinfo; $requestdate = date('l, F jS Y @ h:i:s A', TIMENOW); $date = date('l, F jS Y @ h:i:s A'); $scriptpath = str_replace('&', '&', $vbulletin->scriptpath); $referer = REFERRER; $ipaddress = IPADDRESS; $classname = get_class($this); if ($this->connection_recent) { $this->hide_errors(); list($mysqlversion) = $this->query_first("SELECT VERSION() AS version", DBARRAY_NUM); $this->show_errors(); } $display_db_error = (VB_AREA == 'Upgrade' OR VB_AREA == 'Install' OR $vbulletin->userinfo['usergroupid'] == 6 OR ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions)); // Hide the MySQL Version if its going in the source if (!$display_db_error) { $mysqlversion = ''; } eval('$message = "' . str_replace('"', '\"', file_get_contents(DIR . '/includes/database_error_message.html')) . '";'); // add a backtrace to the message if ($vbulletin->debug) { $trace = debug_backtrace(); $trace_output = "\n"; foreach ($trace AS $index => $trace_item) { $param = (in_array($trace_item['function'], array('require', 'require_once', 'include', 'include_once')) ? $trace_item['args'][0] : ''); // remove path $param = str_replace(DIR, '[path]', $param); $trace_item['file'] = str_replace(DIR, '[path]', $trace_item['file']); $trace_output .= "#$index $trace_item[class]$trace_item[type]$trace_item[function]($param) called in $trace_item[file] on line $trace_item[line]\n"; } $message .= "\n\nStack Trace:\n$trace_output\n"; } require_once(DIR . '/includes/functions_log_error.php'); if (function_exists('log_vbulletin_error')) { log_vbulletin_error($message, 'database'); } if ($technicalemail != '' AND !$vbulletin->options['disableerroremail'] AND verify_email_vbulletin_error($this->errno, 'database')) { // If vBulletinHook is defined then we know that options are loaded, so we can then use vbmail if (class_exists('vBulletinHook', false)) { @vbmail($technicalemail, $this->appshortname . ' Database Error!', $message, true, $technicalemail); } else { @mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", (@ini_get('sendmail_path') === '') ? "\r\n" : "\n", $message), "From: $technicalemail"); } } // send ajax reponse after sending error email if ($vbulletin->GPC['ajax']) { require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $error = 'Database Error'; if ($vbulletin->debug) { $error .= "\n"; $error .= $this->sql; $error .= "\n"; $error .= $error_text; } $xml->add_tag('error', $error); $xml->print_xml(); } if (!headers_sent()) { if (SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi') { header('Status: 503 Service Unavailable'); } else { header('HTTP/1.1 503 Service Unavailable'); } } if ($display_db_error) { // display error message on screen $message = '<form><textarea rows="15" cols="70" wrap="off" id="message">' . htmlspecialchars_uni($message) . '</textarea></form>'; } else { // display hidden error message $message = "\r\n<!--\r\n" . htmlspecialchars_uni($message) . "\r\n-->\r\n"; } if ($vbulletin->options['bburl']) { $imagepath = $vbulletin->options['bburl']; } else { // this might not work with too many slashes in the archive $imagepath = (VB_AREA == 'Forum' ? '.' : '..'); } eval('$message = "' . str_replace('"', '\"', file_get_contents(DIR . '/includes/database_error_page.html')) . '";'); // This is needed so IE doesn't show the pretty error messages $message .= str_repeat(' ', 512); die($message); } else if (!empty($errortext)) { $this->error = $errortext; } }
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'] = ''; } 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); } }
} $photoplog_replace_name = $photoplog_file_old; if ($photoplog_file_edit) { $photoplog_replace_name = $photoplog_file_name; } ($hook = vBulletinHook::fetch_hook('photoplog_edit_sqlreplace')) ? eval($hook) : false; if ($db->query_write("REPLACE INTO " . PHOTOPLOG_PREFIX . "photoplog_fileuploads\r\n\t\t\t(fileid, userid, username, title, description, filename, filesize, dateline, views, catid, moderate, dimensions, setid, \r\n\t\t\tfielddata, num_comments0, num_comments1, num_ratings0, num_ratings1, sum_ratings0, sum_ratings1,\r\n\t\t\tlast_comment_dateline0, last_comment_dateline1, last_comment_id0, last_comment_id1, albumids, exifinfo)\r\n\t\t\tVALUES (\r\n\t\t\t\t" . intval($photoplog_file_id) . ",\r\n\t\t\t\t" . intval($photoplog_file_userid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_username) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_title) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_description) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_replace_name) . "',\r\n\t\t\t\t" . intval($photoplog_file_size) . ",\r\n\t\t\t\t" . intval($photoplog_file_dateline) . ",\r\n\t\t\t\t" . intval($photoplog_file_views) . ",\r\n\t\t\t\t" . intval($photoplog_file_catid) . ",\r\n\t\t\t\t" . intval($photoplog_file_moderate) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog['dimensions']) . "',\r\n\t\t\t\t" . intval($photoplog_file_setid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_fielddata) . "',\r\n\t\t\t\t" . intval($photoplog_file_nc0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nc1) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci1) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_albumids) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_exifinfo) . "'\r\n\t\t\t)\r\n\t\t")) { if ($photoplog_file_catid_default >= 0 && $photoplog_file_catid != $photoplog_file_catid_default) { $db->query_write("UPDATE " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\tSET catid = " . intval($photoplog_file_catid) . "\r\n\t\t\t\t\t\tWHERE fileid = " . intval($photoplog_file_id) . "\r\n\t\t\t"); photoplog_update_counts_table($photoplog_file_catid_default); } photoplog_update_counts_table($photoplog_file_catid); if ($photoplog_file_moderate == 1 && $vbulletin->options['photoplog_admin_email']) { $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_mod_file', -1, '', 'photoplog_')); vbmail($vbulletin->options['webmasteremail'], $photoplog_subject, $photoplog_message, true); } if ($photoplog_file_old && $photoplog_file_edit) { @unlink($photoplog_directory_name . "/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/large/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/medium/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/small/" . $photoplog_file_old); } ($hook = vBulletinHook::fetch_hook('photoplog_edit_doedit_complete')) ? eval($hook) : false; $photoplog_id = intval($photoplog_file_id); $photoplog_url = $photoplog['location'] . '/index.php?' . $vbulletin->session->vars['sessionurl'] . 'n=' . $photoplog_id; exec_header_redirect($photoplog_url); exit; } else { photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_luck']); }
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 { $vbulletin->url = 'calendar.php?' . $vbulletin->session->vars['sessionurl'] . "c={$calendarinfo['calendarid']}"; print_standard_redirect('redirect_calendarmoderated', true, true); } } else { // Update event $eventdata->set_existing($eventinfo); $eventdata->save();
/** * Sends emails to a moderator regarding the report * * @param array Information regarding the moderator to send the email to * @param array Informaiton regarding the item being reported * @param array Information regarding the report * */ function send_moderator_email($moderator, $rpthreadinfo, $reportinfo) { global $vbphrase; $email_langid = $moderator['languageid'] > 0 ? $moderator['languageid'] : $this->registry->options['languageid']; ($hook = vBulletinHook::fetch_hook('report_send_email')) ? eval($hook) : false; $reportinfo['discuss'] = $rpthreadinfo ? construct_phrase($vbphrase['discussion_thread_created_x_y'], $this->registry->options['bburl'], $rpthreadinfo['threadid']) : ''; eval(fetch_email_phrases('report' . $this->phrasekey, $email_langid)); vbmail($moderator['email'], $subject, $message, true); }
} vbmail_start(); $usernames = ''; $reminderbits = ''; foreach ($eventlist as $userid => $event) { $usernames .= iif($usernames, ', '); $usernames .= $userinfo["{$userid}"]['username']; $reminderbits = ''; foreach ($event as $eventid => $hour) { $eventinfo =& $eventcache["{$eventid}"]; eval(fetch_email_phrases('reminderbit', $userinfo["{$userid}"]['languageid'])); $reminderbits .= $message; } $username = unhtmlspecialchars($userinfo["{$userid}"]['username']); eval(fetch_email_phrases('reminder', $userinfo["{$userid}"]['languageid'])); vbmail($userinfo["{$userid}"]['email'], $subject, $message, true); if ($vbulletin->debug and VB_AREA == 'AdminCP') { "<pre>"; echo $subject; echo "</pre>"; echo "<pre>"; echo $message; echo "</pre><br />"; } } vbmail_end(); if (!empty($usernames)) { log_cron_action($usernames, $nextitem, 1); } /*======================================================================*\ || ####################################################################
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; }
$uheaders .= "To: {$username} <{$email}>" . "\r\n"; $uheaders .= "From: " . $vbulletin->options['bbtitle'] . " Reminder Service <" . $vbulletin->options['webmasteremail'] . ">" . "\r\n"; eval('$subject = "' . addslashes($vbulletin->options['subject']) . '";'); $subject = stripslashes($subject); if ($vbulletin->options['reminder_emailfooter']) { $message = $message . "Email Reminder System Provided By Mished.co.uk"; } /*if(@mail($email, $subject, $message, $headers)){ print("mailing $email (done)<br/>"); } else { print("mailing $email (failed)<br/>"); }*/ if (is_valid_email($toemail)) { $sentlist .= "{$username} "; vbmail($toemail, $subject, $message, $notsubscription = false, $from = $vbulletin->options['bbtitle'], $uheaders = '', $username = ''); } else { $failedlist .= "{$username} "; } } } if ($sentlist == "") { log_cron_action("No Emails to send", $nextitem); vbmail($vbulletin->options['webmasteremail'], "Inactive User Reminder Email Report", "This email shows that the product is installed and working as it should be.\n\n\nThere were no inactive users at this time.", $notsubscription = false, $from = $vbulletin->options['bbtitle'], $uheaders = "From: " . $vbulletin->options['bbtitle'] . " Reminder Service <" . $vbulletin->options['webmasteremail'] . ">" . "\r\n", $username = ''); } else { log_cron_action("Emails sent to:{$sentlist}. We tried to email the following users, but their email address was invalid:{$failedlist}", $nextitem); vbmail($vbulletin->options['webmasteremail'], "Inactive User Reminder Email Report", "This email shows that the product is installed and working as it should be.\n\n\nEmails sent to:" . $sentlist . ". We tried to email the following users, but their email address was invalid:" . $failedlist . "", $notsubscription = false, $from = $vbulletin->options['bbtitle'], $uheaders = "From: " . $vbulletin->options['bbtitle'] . " Reminder Service <" . $vbulletin->options['webmasteremail'] . ">" . "\r\n", $username = ''); } } else { print "Product is inactive at this time!"; }
$errors[] = fetch_error($verify->fetch_error()); } } ($hook = vBulletinHook::fetch_hook('blog_dosendtofriend_start')) ? eval($hook) : false; if ($vbulletin->GPC['username'] != '') { if ($userinfo = $db->query_first_slave("\r\n\t\t\tSELECT user.*, userfield.*\r\n\t\t\tFROM " . TABLE_PREFIX . "user AS user," . TABLE_PREFIX . "userfield AS userfield\r\n\t\t\tWHERE username='******'username'])) . "'\r\n\t\t\t\tAND user.userid = userfield.userid")) { $errors[] = fetch_error('usernametaken', $vbulletin->GPC['username'], $vbulletin->session->vars['sessionurl']); } else { $postusername = htmlspecialchars_uni($vbulletin->GPC['username']); } } else { $postusername = $vbulletin->userinfo['username']; } if (empty($errors)) { eval(fetch_email_phrases('sendtofriend')); vbmail($vbulletin->GPC['sendtoemail'], $vbulletin->GPC['emailsubject'], $message); ($hook = vBulletinHook::fetch_hook('blog_dosendtofriend_complete')) ? eval($hook) : false; $sendtoname = htmlspecialchars_uni($sendtoname); $vbulletin->url = fetch_seo_url('entry', $bloginfo); eval(print_standard_redirect('redirect_blog_sentemail')); } else { $_REQUEST['do'] = 'sendtofriend'; $show['errors'] = true; foreach ($errors as $errormessage) { $templater = vB_Template::create('newpost_errormessage'); $templater->register('errormessage', $errormessage); $errormessages .= $templater->render(); } } } // ############################### start send to friend ###############################
print_stop_message('you_must_enter_the_password_token_into_the_message'); } // select affected users $result = $vbulletin->db->query("\r\n\t\tSELECT userid \r\n\t\tFROM " . TABLE_PREFIX . "user \r\n\t\tWHERE password = MD5(CONCAT(MD5(username),salt)) " . ($period ? 'AND lastvisit < ' . (TIMENOW - $period) : '') . " \r\n\t\tAND userid > {$lastuser} \r\n\t\tLIMIT 0, " . $vbulletin->GPC['quantity'] . "\r\n\t"); if ($total = $vbulletin->db->num_rows($result)) { while ($user = $vbulletin->db->fetch_array($result)) { // fetch their info $user = fetch_userinfo($user['userid']); // set last user processed $lastuser = $user['userid']; // make random password $newpassword = substr(md5(vbrand(0, 100000000)), 0, 8); // send mail to user $message = str_replace('{username}', $user['username'], $vbulletin->GPC['email']); $message = str_replace('{password}', $newpassword, $message); if (!vbmail($user['email'], $vbulletin->GPC['email_subject'], $message, true, $vbulletin->GPC['from'])) { $email_errors = true; continue; } // reset the password $userdata = datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdata->set_existing($user); $userdata->set('password', $newpassword); $userdata->save(); // check reset for errors if (sizeof($userdata->errors)) { $reset_errors = true; continue; } } $vbulletin->db->free_result($result);
/** * Halts execution of the entire system and displays an error message * * @param string Text of the error message. Leave blank to use $this->sql as error text. * * @return integer */ function halt($errortext = '') { global $vbulletin; if ($this->connection_recent) { $this->error = $this->error($this->connection_recent); $this->errno = $this->errno($this->connection_recent); } if ($this->reporterror) { if ($errortext == '') { $this->sql = "Invalid SQL:\r\n" . chop($this->sql) . ';'; $errortext =& $this->sql; } // Try and stop e-mail flooding. if (!$vbulletin->options['disableerroremail']) { if (!$vbulletin->options['safeupload']) { $tempdir = ini_get('upload_tmp_dir'); } else { $tempdir = $vbulletin->options['tmppath'] . '/'; } $unique = md5(COOKIE_SALT); $tempfile = $tempdir . "zdberr{$unique}.dat"; /* If its less than a minute since the last e-mail and the error code is the same as last time, disable e-mail */ if ($data = @file_get_contents($tempfile)) { $errc = intval(substr($data, 10)); $time = intval(substr($data, 0, 10)); if ($time and TIMENOW - $time < 60 and intval($this->errno) == $errc) { $vbulletin->options['disableerroremail'] = true; } else { $data = TIMENOW . intval($this->errno); @file_put_contents($tempfile, $data); } } else { $data = TIMENOW . intval($this->errno); @file_put_contents($tempfile, $data); } } $vboptions =& $vbulletin->options; $technicalemail =& $vbulletin->config['Database']['technicalemail']; $bbuserinfo =& $vbulletin->userinfo; $requestdate = date('l, F jS Y @ h:i:s A', TIMENOW); $date = date('l, F jS Y @ h:i:s A'); $scriptpath = str_replace('&', '&', $vbulletin->scriptpath); $referer = REFERRER; $ipaddress = IPADDRESS; $classname = get_class($this); if ($this->connection_recent) { $this->hide_errors(); list($mysqlversion) = $this->query_first("SELECT VERSION() AS version", DBARRAY_NUM); $this->show_errors(); } $display_db_error = (VB_AREA == 'Upgrade' or VB_AREA == 'Install' or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']); // Hide the MySQL Version if its going in the source if (!$display_db_error) { $mysqlversion = ''; } eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_message.html')) . '";'); // add a backtrace to the message if ($vbulletin->debug) { $trace = debug_backtrace(); $trace_output = "\n"; foreach ($trace as $index => $trace_item) { $param = in_array($trace_item['function'], array('require', 'require_once', 'include', 'include_once')) ? $trace_item['args'][0] : ''; // remove path $param = str_replace(DIR, '[path]', $param); $trace_item['file'] = str_replace(DIR, '[path]', $trace_item['file']); $trace_output .= "#{$index} {$trace_item['class']}{$trace_item['type']}{$trace_item['function']}({$param}) called in {$trace_item['file']} on line {$trace_item['line']}\n"; } $message .= "\n\nStack Trace:\n{$trace_output}\n"; } require_once DIR . '/includes/functions_log_error.php'; if (function_exists('log_vbulletin_error')) { log_vbulletin_error($message, 'database'); } if ($technicalemail != '' and !$vbulletin->options['disableerroremail'] and verify_email_vbulletin_error($this->errno, 'database')) { // If vBulletinHook is defined then we know that options are loaded, so we can then use vbmail if (class_exists('vBulletinHook', false)) { @vbmail($technicalemail, $this->appshortname . ' Database Error!', $message, true, $technicalemail); } else { @mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", @ini_get('sendmail_path') === '' ? "\r\n" : "\n", $message), "From: {$technicalemail}"); } } if (defined('STDIN')) { echo $message; exit; } // send ajax reponse after sending error email if ($vbulletin->GPC['ajax']) { require_once DIR . '/includes/class_xml.php'; $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $error = '<p>Database Error</p>'; if ($vbulletin->debug or VB_AREA == 'Upgrade') { $error .= "\r\n\r\n{$errortext}"; $error .= "\r\n\r\n{$this->error}"; } eval('$ajaxmessage = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_message_ajax.html')) . '";'); $xml->add_group('errors'); $xml->add_tag('error', $error); $xml->add_tag('error_html', $ajaxmessage); $xml->close_group('errors'); $xml->print_xml(); } if (!headers_sent()) { if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi') { header('Status: 503 Service Unavailable'); } else { header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable'); } } if ($display_db_error) { // display error message on screen $message = '<form><textarea rows="15" cols="70" wrap="off" id="message">' . htmlspecialchars_uni($message) . '</textarea></form>'; } else { if ($vbulletin->debug) { // display hidden error message $message = "\r\n<!--\r\n" . htmlspecialchars_uni($message) . "\r\n-->\r\n"; } else { $message = ''; } } if ($vbulletin->options['bburl']) { $imagepath = $vbulletin->options['bburl']; } else { // this might not work with too many slashes in the archive $imagepath = VB_AREA == 'Forum' ? '.' : '..'; } eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_page.html')) . '";'); // This is needed so IE doesn't show the pretty error messages $message .= str_repeat(' ', 512); die($message); } else { if (!empty($errortext)) { $this->error = $errortext; } } }
$pmdm->pre_save(); // process errors if there are any $errors = $pmdm->errors; if (!empty($errors)) { $error = construct_errors($errors); // this will take the preview's place eval(standard_error($error)); } else { // everything's good! $pmdm->save(); unset($pmdm); $award_send += 4; } } if (!empty($vbulletin->options['award_request_formemailaddress'])) { vbmail($vbulletin->options['award_request_formemailaddress'], $posttitle, $formsend); $award_send += 8; } if ($award_send > 0) { $errormessage = $vbphrase['award_request_completed']; } else { $errormessage = $vbphrase['award_request_incompleted']; } eval('print_output("' . fetch_template('STANDARD_ERROR') . '");'); exit; } if ($_REQUEST['do'] == 'request') { $vbulletin->input->clean_array_gpc('r', array('award_id' => TYPE_UINT)); if (empty($vbulletin->GPC['award_id'])) { $errormessage = $vbphrase['award_request_noawardid']; eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
function do_register() { global $vbulletin, $vbphrase, $db; if ($vbulletin->userinfo['userid']) { json_error(ERR_NO_PERMISSION); } if (!$vbulletin->options['forumrunner_enable_registration']) { json_error(ERR_NO_PERMISSION); } $vbulletin->input->clean_array_gpc('r', array('username' => TYPE_STR, 'email' => TYPE_STR, 'password' => TYPE_STR, 'password_md5' => TYPE_STR, 'birthday' => TYPE_STR, 'timezoneoffset' => TYPE_NUM)); // They are registering. Lets find out what fields are required. if (!$vbulletin->options['allowregistration']) { standard_error(fetch_error('noregister')); } $out = array(); if ($vbulletin->GPC['username']) { // Registering. $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); $vbulletin->GPC['coppauser'] = false; $userdata->set_info('coppauser', false); $userdata->set_info('coppapassword', $vbulletin->GPC['password']); $userdata->set_bitfield('options', 'coppauser', false); $userdata->set('parentemail', ''); if (empty($vbulletin->GPC['username']) || empty($vbulletin->GPC['email']) || empty($vbulletin->GPC['password']) && empty($vbulletin->GPC['password_md5'])) { standard_error(fetch_error('fieldmissing')); } $vbulletin->GPC['password_md5'] = strtolower($vbulletin->GPC['password_md5']); $vbulletin->GPC['passwordconfirm_md5'] = strtolower($vbulletin->GPC['password_md5']); $userdata->set('email', $vbulletin->GPC['email']); $userdata->set('username', $vbulletin->GPC['username']); $userdata->set('password', $vbulletin->GPC['password_md5'] ? $vbulletin->GPC['password_md5'] : $vbulletin->GPC['password']); $userdata->set_bitfield('options', 'adminemail', 1); if ($vbulletin->options['verifyemail']) { $newusergroupid = 3; } else { if ($vbulletin->options['moderatenewmembers'] || $vbulletin->GPC['coppauser']) { $newusergroupid = 4; } else { $newusergroupid = 2; } } $userdata->set('usergroupid', $newusergroupid); $userdata->set('languageid', $vbulletin->userinfo['languageid']); $userdata->set_usertitle('', false, $vbulletin->usergroupcache["{$newusergroupid}"], false, false); $parts = preg_split('#/#', $vbulletin->GPC['birthday']); $day = $month = $year = ''; if ($parts[1]) { $day = $parts[1]; } if ($parts[0]) { $month = $parts[0]; } if ($parts[2]) { $year = $parts[2]; } $userdata->set('showbirthday', 0); $userdata->set('birthday', array('day' => $day, 'month' => $month, 'year' => $year)); $dst = 2; $userdata->set_dst($dst); $userdata->set('timezoneoffset', $vbulletin->GPC['timezoneoffset']); // register IP address $userdata->set('ipaddress', IPADDRESS); $userdata->pre_save(); if (count($userdata->errors)) { // Just return one error for now. json_error(strip_tags($userdata->errors[0])); } $vbulletin->userinfo['userid'] = $userid = $userdata->save(); if ($userid) { $userinfo = fetch_userinfo($userid); $userdata_rank =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdata_rank->set_existing($userinfo); $userdata_rank->set('posts', 0); $userdata_rank->save(); require_once DIR . '/includes/functions_login.php'; $vbulletin->session->created = false; process_new_login('', false, ''); // send new user email if ($vbulletin->options['newuseremail'] != '') { $username = $vbulletin->GPC['username']; $email = $vbulletin->GPC['email']; if ($birthday = $userdata->fetch_field('birthday')) { $bday = explode('-', $birthday); $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); if ($year > $bday[2] and $bday[2] > 1901 and $bday[2] != '0000') { require_once DIR . '/includes/functions_misc.php'; $vbulletin->options['calformat1'] = mktimefix($vbulletin->options['calformat1'], $bday[2]); if ($bday[2] >= 1970) { $yearpass = $bday[2]; } else { $yearpass = $bday[2] + 28 * ceil((1970 - $bday[2]) / 28); } $birthday = vbdate($vbulletin->options['calformat1'], mktime(0, 0, 0, $bday[0], $bday[1], $yearpass), false, true, false); } else { $birthday = vbdate($vbulletin->options['calformat2'], mktime(0, 0, 0, $bday[0], $bday[1], 1992), false, true, false); } if ($birthday == '') { if ($bday[2] == '0000') { $birthday = "{$bday['0']}-{$bday['1']}"; } else { $birthday = "{$bday['0']}-{$bday['1']}-{$bday['2']}"; } } } if ($userdata->fetch_field('referrerid') and $vbulletin->GPC['referrername']) { $referrer = unhtmlspecialchars($vbulletin->GPC['referrername']); } else { $referrer = $vbphrase['n_a']; } $ipaddress = IPADDRESS; eval(fetch_email_phrases('newuser', 0)); $newemails = explode(' ', $vbulletin->options['newuseremail']); foreach ($newemails as $toemail) { if (trim($toemail)) { vbmail($toemail, $subject, $message); } } } $username = htmlspecialchars_uni($vbulletin->GPC['username']); $email = htmlspecialchars_uni($vbulletin->GPC['email']); // sort out emails and usergroups if ($vbulletin->options['verifyemail']) { $activateid = build_user_activation_id($userid, ($vbulletin->options['moderatenewmembers'] or $vbulletin->GPC['coppauser']) ? 4 : 2, 0); eval(fetch_email_phrases('activateaccount')); vbmail($email, $subject, $message, true); } else { if ($newusergroupid == 2) { if ($vbulletin->options['welcomemail']) { eval(fetch_email_phrases('welcomemail')); vbmail($email, $subject, $message); } } } ($hook = vBulletinHook::fetch_hook('register_addmember_complete')) ? eval($hook) : false; // Let them log in again. process_logout(); $out += array('emailverify' => $vbulletin->options['verifyemail'] ? true : false); } } else { $rules = preg_replace('/<a href=\\"(.*?)\\">(.*?)<\\/a>/', "\\2", $vbphrase['fr_register_forum_rules']); $out += array('rules' => prepare_utf8_string($rules), 'birthday' => $vbulletin->options['reqbirthday'] ? true : false); } return $out; }
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(); }
// ######################################################################## $subobj = new vB_PaidSubscription($vbulletin); $subobj->cache_user_subscriptions(); if (is_array($subobj->subscriptioncache)) { foreach ($subobj->subscriptioncache as $key => $subscription) { // disable people :) $subscribers = $vbulletin->db->query_read("\n\t\t\tSELECT userid\n\t\t\tFROM " . TABLE_PREFIX . "subscriptionlog\n\t\t\tWHERE subscriptionid = {$subscription['subscriptionid']}\n\t\t\t\tAND expirydate <= " . TIMENOW . "\n\t\t\t\tAND status = 1\n\t\t"); while ($subscriber = $vbulletin->db->fetch_array($subscribers)) { $subobj->delete_user_subscription($subscription['subscriptionid'], $subscriber['userid'], -1, true); } } // time for the reminders $subscriptions_reminders = $vbulletin->db->query_read("\n\t\tSELECT subscriptionlog.subscriptionid, subscriptionlog.userid, subscriptionlog.expirydate, user.username, user.email, user.languageid\n\t\tFROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscriptionlog.userid)\n\t\tWHERE subscriptionlog.expirydate >= " . (TIMENOW + 86400 * 2) . "\n\t\t\tAND subscriptionlog.expirydate <= " . (TIMENOW + 86400 * 3) . "\n\t\t\tAND status = 1\n\t"); vbmail_start(); while ($subscriptions_reminder = $vbulletin->db->fetch_array($subscriptions_reminders)) { require_once DIR . '/includes/functions_misc.php'; $subscription_title = fetch_phrase('sub' . $subscriptions_reminder['subscriptionid'] . '_title', 'subscription', '', true, true, $subscriptions_reminder['languageid']); $username = unhtmlspecialchars($subscriptions_reminder['username']); eval(fetch_email_phrases('paidsubscription_reminder', $subscriptions_reminder['languageid'])); vbmail($subscriptions_reminder['email'], $subject, $message); } vbmail_end(); ($hook = vBulletinHook::fetch_hook('cron_script_subscriptions')) ? eval($hook) : false; } log_cron_action('', $nextitem, 1); /*======================================================================*\ || #################################################################### || # Downloaded: 22:41, Fri Oct 10th 2008 || # CVS: $RCSfile$ - $Revision: 26358 $ || #################################################################### \*======================================================================*/
} else { if ($status == -1) { // deleted if ($vbulletin->GPC['send_deleted']) { if (!isset($evalemail_deleted["{$user['languageid']}"])) { $email_text = $db->query_first("\n\t\t\t\t\t\t\tSELECT text\n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\t\t\t\t\tWHERE fieldname = 'emailbody'\n\t\t\t\t\t\t\t\tAND varname = 'moderation_deleted'\n\t\t\t\t\t\t\t\tAND languageid IN(-1,0,{$chosenlanguage})\n\t\t\t\t\t\t\tORDER BY languageid DESC\n\t\t\t\t\t\t"); $email_subject = $db->query_first("\n\t\t\t\t\t\t\tSELECT text\n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\t\t\t\t\tWHERE fieldname = 'emailsubject'\n\t\t\t\t\t\t\t\tAND varname = 'moderation_deleted'\n\t\t\t\t\t\t\t\tAND languageid IN(-1,0,{$chosenlanguage})\n\t\t\t\t\t\t\tORDER BY languageid DESC\n\t\t\t\t\t\t"); $text_message = replace_template_variables(str_replace("\\'", "'", addslashes($email_text['text']))); $text_subject = replace_template_variables(str_replace("\\'", "'", addslashes($email_subject['text']))); $evalemail_deleted["{$user['languageid']}"] = ' $message = "' . $text_message . '"; $subject = "' . $text_subject . '"; '; } eval($evalemail_deleted["{$user['languageid']}"]); vbmail($user['email'], $subject, $message, true); } $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdm->set_existing($user); $userdm->delete(); unset($userdm); } } // else, do nothing } define('CP_REDIRECT', 'index.php?do=home'); print_stop_message('user_accounts_validated'); } } // ############################# do prune users (step 2) ######################### if ($_REQUEST['do'] == 'prune_updateposts') {
/*insert query*/ $db->query_write("\n\t\t\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "useractivation\n\t\t\t\t\t\t\t\t\t\t(userid, dateline, activationid, type, usergroupid)\n\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t({$user['userid']}, " . TIMENOW . ", '{$activate['activationid']}', 0, 2)\n\t\t\t\t\t\t\t\t"); } else { $activate['activationid'] = fetch_random_string(40); $db->query_write("\n\t\t\t\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "useractivation SET\n\t\t\t\t\t\t\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\t\t\t\t\t\t\tactivationid = '{$activate['activationid']}'\n\t\t\t\t\t\t\t\t\tWHERE userid = {$user['userid']} AND\n\t\t\t\t\t\t\t\t\t\ttype = 0\n\t\t\t\t\t\t\t\t"); } $activate['link'] = $vbulletin->options['bburl'] . "/register.php?a=act&u={$userid}&i={$activate['activationid']}"; } else { $activate = array(); } $sendmessage = str_replace(array('$activateid', '$activatelink'), array($activate['activationid'], $activate['link']), $sendmessage); } $sendmessage = str_replace(array('$bburl', '$bbtitle'), array($vbulletin->options['bburl'], $vbulletin->options['bbtitle']), $sendmessage); if (!$vbulletin->GPC['test']) { echo $vbphrase['emailing'] . " \n"; vbmail($user['email'], $vbulletin->GPC['subject'], $sendmessage, true, $vbulletin->GPC['from']); } else { echo $vbphrase['test'] . " ... \n"; } echo $vbphrase['okay'] . "<br />\n"; vbflush(); } $_REQUEST['do'] = 'donext'; } else { define('CP_REDIRECT', 'email.php?' . $vbulletin->session->vars['sessionurl']); print_stop_message('emails_sent_successfully'); } } } } // *************************** Link to next page of emails to send **********************
function check_attachment_overage() { if ($this->registry->options['attachtotalspace']) { $attachdata = $this->registry->db->query_first_slave("SELECT SUM(filesize) AS sum FROM " . TABLE_PREFIX . "attachment"); if ($attachdata['sum'] + $this->upload['filesize'] > $this->registry->options['attachtotalspace']) { $overage = vb_number_format($attachdata['sum'] + $this->upload['filesize'] - $this->registry->options['attachtotalspace'], 1, true); $admincpdir = $this->registry->config['Misc']['admincpdir']; eval(fetch_email_phrases('attachfull', 0)); vbmail($this->registry->options['webmasteremail'], $subject, $message); $this->set_error('upload_attachfull_total', $overage); return false; } } if ($this->userinfo['permissions']['attachlimit']) { // Get forums that allow canview access if (!isset($this->userinfo['forumpermissions'])) { cache_permissions($this->userinfo, true); } $forumids = ''; foreach ($this->userinfo['forumpermissions'] as $forumid => $fperm) { if ($fperm & $this->registry->bf_ugp_forumpermissions['canview'] and $fperm & $this->registry->bf_ugp_forumpermissions['canviewthreads'] and $fperm & $this->registry->bf_ugp_forumpermissions['cangetattachment']) { $forumids .= ",{$forumid}"; } } $attachdata = $this->registry->db->query_first_slave("\n\t\t\t\tSELECT SUM(attachment.filesize) AS sum\n\t\t\t\tFROM " . TABLE_PREFIX . "attachment AS attachment\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\t\tWHERE attachment.userid = " . $this->userinfo['userid'] . "\n\t\t\t\t\tAND\t((thread.forumid IN (0{$forumids}) AND post.visible <> 2 AND thread.visible <> 2) OR attachment.postid = 0)\n\t\t\t"); if ($attachdata['sum'] + $this->upload['filesize'] > $this->userinfo['permissions']['attachlimit']) { $overage = vb_number_format($attachdata['sum'] + $this->upload['filesize'] - $this->userinfo['permissions']['attachlimit'], 1, true); $this->set_error('upload_attachfull_user', $overage, $this->registry->session->vars['sessionurl']); return false; } } if ($this->userinfo['userid'] and !$this->registry->options['allowduplicates']) { // read file $filehash = empty($this->upload['filestuff']) ? md5_file($this->upload['location']) : md5($this->upload['filestuff']); if (!isset($this->userinfo['forumpermissions'])) { cache_permissions($this->userinfo, true); } $forumids = ''; foreach ($this->userinfo['forumpermissions'] as $forumid => $perm) { if ($perm & $this->registry->bf_ugp_forumpermissions['canview'] and $perm & $this->registry->bf_ugp_forumpermissions['canviewthreads'] and $perm & $this->registry->bf_ugp_forumpermissions['cangetattachment']) { $forumids .= ",{$forumid}"; } } if ($threadresult = $this->registry->db->query_first_slave("\n\t\t\t\tSELECT post.postid, post.threadid, thread.title, posthash, attachment.filename\n\t\t\t\tFROM " . TABLE_PREFIX . "attachment AS attachment\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)\n\t\t\t\tWHERE attachment.userid = " . $this->userinfo['userid'] . "\n\t\t\t\t\tAND attachment.filehash = '" . $this->registry->db->escape_string($filehash) . "'\n\t\t\t\t\tAND ((thread.forumid IN (0{$forumids}) AND post.visible = 1 AND thread.visible = 1) OR attachment.postid = 0)\n\t\t\t\tLIMIT 1\n\t\t\t")) { // Attachment of an existing post if ($threadresult['postid']) { if ($this->postinfo['postid'] != $threadresult['postid'] or $this->upload['filename'] != $threadresult['filename']) { // doesn't belong to our post or the filename differs so it won't be overwritten $this->set_error('upload_attachexists', $this->registry->session->vars['sessionurl'], $threadresult['threadid'], $threadresult['title']); return false; } } else { // Attachment currently being added or abandoned if ($threadresult['posthash'] != $this->postinfo['posthash']) { // Doesn't belong to our post if ($this->userinfo['userid'] == $this->registry->userinfo['userid']) { $this->set_error('upload_attach_in_progress_delete_here', $this->registry->session->vars['sessionurl']); } else { $this->set_error('upload_attach_in_progress', $this->registry->session->vars['sessionurl']); } return false; } else { if ($this->upload['filename'] != $threadresult['filename']) { // Belongs to our post but has a different filename //-> won't be overwritten so don't allow $this->set_error('upload_attach_exists_this_post'); return false; } } } } } return true; }
/** * Additional data to update after a save call (such as denormalized values in other tables). * * @param boolean Do the query? */ function post_save_each($doquery = true) { $userid = $this->fetch_field('userid'); if (!$userid or !$doquery) { return; } $usergroups_changed = $this->usergroups_changed(); $wasadmin = $this->is_admin($this->existing['usergroupid'], $this->existing['membergroupids']); $isadmin = $this->is_admin($this->fetch_field('usergroupid'), $this->fetch_field('membergroupids')); $wassupermod = $this->is_supermod($this->existing['usergroupid'], $this->existing['membergroupids']); $issupermod = $this->is_supermod($this->fetch_field('usergroupid'), $this->fetch_field('membergroupids')); if (!$this->condition) { // save user count and new user id to template require_once DIR . '/includes/functions_databuild.php'; build_user_statistics(); } else { // update denormalized username field in various tables $this->update_username($userid); // if usergroup membership has changed... if ($usergroups_changed) { // update subscriptions $this->update_subscriptions($userid, $doquery); // update ban status $this->update_ban_status($userid, $doquery); // recache permissions if the userid is the current browsing user if ($userid == $this->registry->userinfo['userid']) { $this->registry->userinfo['usergroupid'] = $this->fetch_field('usergroupid'); $this->registry->userinfo['membergroupids'] = $this->fetch_field('membergroupids'); cache_permissions($this->registry->userinfo); } } // if the primary user group has been changed, we need to update any user activation records if (!empty($this->user['usergroupid']) and $this->user['usergroupid'] != $this->existing['usergroupid']) { $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "useractivation\n\t\t\t\t\tSET usergroupid = " . $this->user['usergroupid'] . "\n\t\t\t\t\tWHERE userid = {$userid}\n\t\t\t\t\t\tAND type = 0\n\t\t\t\t"); } if (isset($this->usertextfield['signature'])) { // edited the signature, need to kill any parsed versions $this->dbobject->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "sigparsed\n\t\t\t\t\tWHERE userid = {$userid}\n\t\t\t\t"); } } // admin stuff $this->set_admin($userid, $usergroups_changed, $isadmin, $wasadmin); // super moderator stuff $this->set_supermod($userid, $usergroups_changed, $issupermod, $wasssupermod); // update birthday datastore $this->update_birthday_datastore($userid); // update password history $this->update_password_history($userid); // reset style cookie $this->update_style_cookie($userid); // reset threadedmode cookie $this->update_threadedmode_cookie($userid); // reset languageid cookie $this->update_language_cookie($userid); // Send parent email if ($this->info['coppauser'] and $username = $this->fetch_field('username') and $parentemail = $this->fetch_field('parentemail')) { if ($password = $this->info['coppapassword']) { eval(fetch_email_phrases('parentcoppa_register')); } else { eval(fetch_email_phrases('parentcoppa_profile')); } vbmail($parentemail, $subject, $message, true); } ($hook = vBulletinHook::fetch_hook('userdata_postsave')) ? eval($hook) : false; }
/** * Halts execution of the entire system and displays an error message * * @param string Text of the error message. Leave blank to use $this->sql as error text. * * @return integer */ function halt($errortext = '') { global $vbulletin; if ($this->connection_recent) { $this->error = $this->error($this->connection_recent); $this->errno = $this->errno($this->connection_recent); } if ($this->reporterror) { if ($errortext == '') { $this->sql = "Invalid SQL:\r\n" . chop($this->sql) . ';'; $errortext =& $this->sql; } if (!headers_sent()) { if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi') { header('Status: 503 Service Unavailable'); } else { header('HTTP/1.1 503 Service Unavailable'); } } $vboptions =& $vbulletin->options; $technicalemail =& $vbulletin->config['Database']['technicalemail']; $bbuserinfo =& $vbulletin->userinfo; $requestdate = date('l, F jS Y @ h:i:s A', TIMENOW); $date = date('l, F jS Y @ h:i:s A'); $scriptpath = str_replace('&', '&', $vbulletin->scriptpath); $referer = REFERRER; $ipaddress = IPADDRESS; $classname = get_class($this); if ($this->connection_recent) { $this->hide_errors(); list($mysqlversion) = $this->query_first("SELECT VERSION() AS version", DBARRAY_NUM); $this->show_errors(); } $display_db_error = (VB_AREA == 'Upgrade' or VB_AREA == 'Install' or $vbulletin->userinfo['usergroupid'] == 6 or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions); // Hide the MySQL Version if its going in the source if (!$display_db_error) { $mysqlversion = ''; } eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_message.html')) . '";'); require_once DIR . '/includes/functions_log_error.php'; if (function_exists('log_vbulletin_error')) { log_vbulletin_error($message, 'database'); } if ($technicalemail != '' and !$vbulletin->options['disableerroremail'] and verify_email_vbulletin_error($this->errno, 'database')) { // If vBulletinHook is defined then we know that options are loaded, so we can then use vbmail if (class_exists('vBulletinHook')) { @vbmail($technicalemail, $this->appshortname . ' Database Error!', $message, true, $technicalemail); } else { @mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", @ini_get('sendmail_path') === '' ? "\r\n" : "\n", $message), "From: {$technicalemail}"); } } if ($display_db_error) { // display error message on screen $message = '<form><textarea rows="15" cols="70" wrap="off" id="message">' . htmlspecialchars_uni($message) . '</textarea></form>'; } else { // display hidden error message $message = "\r\n<!--\r\n" . htmlspecialchars_uni($message) . "\r\n-->\r\n"; } if ($vbulletin->options['bburl']) { $imagepath = $vbulletin->options['bburl']; } else { // this might not work with too many slashes in the archive $imagepath = VB_AREA == 'Forum' ? '.' : '..'; } eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_page.html')) . '";'); // This is needed so IE doesn't show the pretty error messages $message .= str_repeat(' ', 512); die($message); } else { if (!empty($errortext)) { $this->error = $errortext; } } }
function post_save_each($doquery = true) { $pmtextid = $this->existing['pmtextid'] ? $this->existing['pmtextid'] : $this->pmtext['pmtextid']; $fromuserid = intval($this->fetch_field('fromuserid')); $fromusername = $this->fetch_field('fromusername'); if (!$this->condition) { // save a copy in the sent items folder if ($this->info['savecopy']) { /*insert query*/ $this->dbobject->query_write("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid, folderid, messageread) VALUES ({$pmtextid}, {$fromuserid}, -1, 1)"); $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); } 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*/ $this->dbobject->query_write("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid) VALUES ({$pmtextid}, {$user['userid']})"); 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_read("\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['parentpmid'])) { $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 = " . $this->info['parentpmid']); } } ($hook = vBulletinHook::fetch_hook('pmdata_postsave')) ? eval($hook) : false; }
/** * protected void associateAccount(array $user, int $vbnexus_userid) * Forces GFC users to choose a password (and a valid email too for * users of vbnexus3). The change is then flagged in the database with * field vbnexus_user.associated set to 2. * * @param array $user * @param int $vbnexus_userid * @return void */ protected function associateAccount($user, $vbnexus_userid) { global $vbulletin, $vboptions, $vbphrase, $stylevar, $vbnexus_loc; if (!intval($user['userid'])) { return false; } // If the user is submitting email and/or password, process it if (isset($_POST['vbnexus_gfc_fix'])) { // Validate input if (empty($_POST['email'])) { $vbnexus_error = "A valid email is required"; } elseif (empty($_POST['password'])) { $vbnexus_error = "A valid password is required"; } elseif (empty($_POST['password2']) || $_POST['password'] != $_POST['password2']) { $vbnexus_error = "Passwords do not match"; } else { $require_activation = $vbulletin->options['verifyemail'] && $user['email'] != $_POST['email']; $userdata =& datamanager_init('user', $vbulletin, ERRTYPE_SILENT); $userdata->set_existing(fetch_userinfo($user['userid'])); $userdata->set('password', $_POST['password']); // We can ignore validation of the email if it wasn't changed $user['email'] == $_POST['email'] || $userdata->set('email', $_POST['email']); if ($require_activation) { $userdata->set('usergroupid', 3); } if ($userdata->has_errors(false)) { $vbnexus_error = join('</li><li>', $userdata->errors); } elseif ($userdata->save()) { if ($require_activation) { // Email phrase 'activateaccount' expects vars called $userid, $username // and $activateid to be defined and meaningfull $userid = $user['userid']; $username = $user['username']; $activateid = build_user_activation_id($userid, $user['usergroupid'], 0); eval(fetch_email_phrases('activateaccount', $languageid)); // After eval'ing activateaccount we have vars $subject and $message set vbmail($_POST['email'], $subject, $message, true); } // The user was updated, there's now a valid password and email, so let's flag it $sql = "UPDATE `" . TABLE_PREFIX . "vbnexus_user`\r\n SET `associated` = 2\r\n WHERE `nonvbid` = '{$vbnexus_userid}'\r\n AND `service` = 'gfc'"; $vbulletin->db->query_write($sql); if ($vbulletin->db->query_write($sql)) { // Returning since we're done here and execution should go on normally return; } else { // This should never happen, it's mostly for debugging if something goes wrong $errmsg = "An error occurred trying to update your GFC information. Please try again." . " If the problem persists please report it to an admin."; return eval(standard_error($errmsg)); // Prints and exits } } else { // This should never happen, it's mostly for debugging if something goes wrong $errmsg = "An error occurred trying to update the account information. Please try again." . " If the problem persists please report it to an admin."; return eval(standard_error($errmsg)); // Prints and exits } } $user['email'] = $_POST['email']; } $vBNexusUser = $user; // No need to show mock emails from old vbnexus (< 3) if (empty($_POST['email']) && preg_match("/apps\\+|{$vbnexus_userid}[@\\.]/", $user['email'])) { $vBNexusUser['email'] = ''; } $vbnexus_loc = $_GET['loc']; // This will print a Message box (not really an error, but the actual form) and exit eval('$html = "' . fetch_template('vbnexus_3_gfc_invalid_email') . '";'); eval(standard_error($html)); }
$photoplog_category_options["{$photoplog_key}"] = intval(trim(strval($photoplog_val))); } require_once DIR . '/includes/functions_misc.php'; $photoplog_category_bitopts = convert_array_to_bits($photoplog_category_options, $photoplog_categoryoptions, 1); if (photoplog_insert_category($photoplog_category_title, $photoplog_category_description, $photoplog_category_displayorder, $photoplog_category_parentid, $photoplog_category_bitopts, $photoplog_ds_catopts, $photoplog_suggestid)) { if ($photoplog_suggestid) { if ($vbulletin->options['photoplog_user_email']) { $photoplog_moderate_cat = $db->query_first("SELECT userid, title\r\n\t\t\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_suggestedcats\r\n\t\t\t\t\tWHERE suggestid = " . intval($photoplog_suggestid) . "\r\n\t\t\t\t"); if ($photoplog_moderate_cat) { $photoplog_fetch_userinfo = $db->query_first("SELECT username,email\r\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user\r\n\t\t\t\t\t\tWHERE userid = " . intval($photoplog_moderate_cat['userid']) . "\r\n\t\t\t\t\t\tAND (options & " . intval($vbulletin->bf_misc_useroptions['adminemail']) . ")\r\n\t\t\t\t\t"); if ($photoplog_fetch_userinfo) { $photoplog_category = strval($photoplog_moderate_cat['title']); $photoplog_username = unhtmlspecialchars($photoplog_fetch_userinfo['username']); $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_approved_category', -1, '', 'photoplog_')); vbmail($photoplog_fetch_userinfo['email'], $photoplog_subject, $photoplog_message, true); } $db->free_result($photoplog_fetch_userinfo); } } } print_cp_redirect("photoplog_category.php?" . $vbulletin->session->vars['sessionurl'] . "do=modify", 1); } else { print_stop_message('generic_error_x', $vbphrase['photoplog_bad_cat_insert']); } } if ($_REQUEST['do'] == 'edit' || $_REQUEST['do'] == 'review') { if ($_REQUEST['do'] == 'edit') { $vbulletin->input->clean_array_gpc('g', array('catid' => TYPE_UINT)); $photoplog_catid = $vbulletin->GPC['catid']; $photoplog_category_info = $db->query_first("SELECT title,\r\n\t\t\t\tdescription, displayorder, parentid, options\r\n\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_categories\r\n\t\t\tWHERE catid = " . intval($photoplog_catid) . "\r\n\t\t");
/** * For registration without existing account, create a new vb user * If a user is successfully created, her userid is written to $userid */ private function createUser($data, &$userid) { global $vbulletin; $moderated = $vbulletin->options['moderatenewmembers']; $languageid = $vbulletin->userinfo['languageid']; $require_activation = $vbulletin->options['verifyemail'] && $data['default_email'] != $data['coded_email']; // Create a vB user with default permissions -- code from register.php if (!$vbulletin->options['allowregistration']) { eval(standard_error(fetch_error('noregister'))); } // Init user datamanager class $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdata->set_info('coppauser', false); $userdata->set_info('coppapassword', ''); $userdata->set_bitfield('options', 'coppauser', ''); $userdata->set('username', $data['username']); $userdata->set('password', md5($this->genPasswd())); $userdata->set('email', $data['email']); $userdata->set('languageid', $languageid); $userdata->set('ipaddress', IPADDRESS); // UserGroupId: Registered Users (2) or Users Awaiting Email Confirmation (3) $userdata->set('usergroupid', $require_activation ? 3 : 2); $userdata->set_usertitle('', false, $vbulletin->usergroupcache["{$newusergroupid}"], false, false); $userdata->presave_called = true; // If any error happened, we abort and return the error message(s) if ($userdata->has_errors(false)) { // $die := false return join('</li><li>', $userdata->errors); } // Save the data $userid = $userdata->save(); // Did we get a valid vb userid? if (!$userid) { return 'vbnexus_registration_failed'; } // If the user changed the email given by the external service, we follow // the regular steps for email activation if ($require_activation) { // Email phrase 'activateaccount' expects vars called $userid, $username // and $activateid to be defined and meaningfull $username = $data['username']; $activateid = build_user_activation_id($userid, $moderated ? 4 : 2, 0); eval(fetch_email_phrases('activateaccount', $languageid)); // After eval'ing activateaccount we have vars $subject and $message set vbmail($data['email'], $subject, $message, true); } // Force a new session to prevent potential issues with guests from the same IP, see bug #2459 $vbulletin->session->created = false; return true; }
/** * 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("\n\t\t\tSELECT MAX(gmid) AS gmid\n\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage\n\t\t\tWHERE discussionid = {$discussion['discussionid']}\n\t\t\t\tAND state = 'visible'\n\t\t"); $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("\n\t\t\tSELECT MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage\n\t\t\tWHERE discussionid = {$discussion['discussionid']}\n\t\t\t\tAND dateline < {$gmessage['dateline']}\n\t\t\t\tAND state = 'visible'\n\t")) ? $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("\n\t\tSELECT user.*, subscribediscussion.emailupdate, subscribediscussion.subscribediscussionid, IF(socialgroupmember.userid IS NOT NULL,1,0) ismember\n\t\tFROM " . TABLE_PREFIX . "subscribediscussion AS subscribediscussion\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribediscussion.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\tLEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = user.userid AND socialgroupmember.groupid = {$group['groupid']})\n\t\tWHERE subscribediscussion.discussionid = {$discussion['discussionid']}\n\t\t AND subscribediscussion.emailupdate = 1\n\t\t AND " . ($gmessage['postuserid'] ? " CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE ' " . intval($userid) . " '" : '') . "\n\t\t AND user.usergroupid <> 3\n\t\t AND user.userid <> " . intval($userid) . "\n\t\t AND user.lastactivity >= " . intval($lastposttime) . "\n\t\t AND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t"); 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("\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_discussion'\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($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(); }
/** * 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; $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'] = ''; } ($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(); }
require_once(DIR . '/includes/class_floodcheck.php'); $floodcheck = new vB_FloodCheck($vbulletin, 'user', 'emailstamp'); $floodcheck->commit_key($vbulletin->userinfo['userid'], TIMENOW, TIMENOW - $vbulletin->options['emailfloodtime']); if ($floodcheck->is_flooding()) { eval(standard_error(fetch_error('emailfloodcheck', $vbulletin->options['emailfloodtime'], $floodcheck->flood_wait()))); } } ($hook = vBulletinHook::fetch_hook('sendmessage_domailmember')) ? eval($hook) : false; $message = fetch_censored_text($vbulletin->GPC['message']); eval(fetch_email_phrases('usermessage', $userinfo['languageid'])); vbmail($userinfo['email'], fetch_censored_text($vbulletin->GPC['emailsubject']), $message , false, $vbulletin->userinfo['email'], '', $vbulletin->userinfo['username']); // parse this next line with eval: $sendtoname = $userinfo['username']; eval(print_standard_redirect('redirect_sentemail')); } } /*======================================================================*\ || #################################################################### || # || # CVS: $RCSfile$ - $Revision: 35508 $ || #################################################################### \*======================================================================*/ ?>
if (isset($pendingcache['buddy']["{$userid}"]) and $pendingcache['buddy']["{$userid}"]['friend'] == 'denied') { // If they were denied last time you must have changed your mind, remove the block so its just a buddy $db->query_write("UPDATE " . TABLE_PREFIX . "userlist set friend = 'no' WHERE userid = {$userid} AND relationid = " . $vbulletin->userinfo['userid']); } $db->query_write("\n\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "userlist\n\t\t\t\t\t\t(userid, relationid, type, friend)\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . $vbulletin->userinfo['userid'] . ", " . intval($userinfo['userid']) . ", 'buddy', 'pending')\n\t\t\t\t\t"); ($hook = vBulletinHook::fetch_hook('profile_updatelist_addfriend')) ? eval($hook) : false; // Send notification to user that a friend request has been made for them if ($cansendemail and $userinfo['options'] & $vbulletin->bf_misc_useroptions['receivefriendemailrequest'] and !isset($usercache['ignore']["{$userid}"])) { $fromuserinfo =& $vbulletin->userinfo; $touserinfo =& $userinfo; eval(fetch_email_phrases('friendship_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); } $rebuild_friendreqcount[$userid] = true; } } else { if (!empty($add['buddy'])) { // We only want a record if one doesn't exist foreach ($add['buddy'] as $userid => $touserinfo) { if (isset($usercache['buddy']["{$userid}"])) { continue; } $db->query_write("\n\t\t\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "userlist\n\t\t\t\t\t\t\t(userid, relationid, type, friend)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(" . $vbulletin->userinfo['userid'] . ", " . intval($userid) . ", 'buddy', 'no')\n\t\t\t\t\t"); } } else { if (!empty($add['ignore'])) { // Adding someone to the ignore again is fine
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; } 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 = ''; $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.*,attachment.filename\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\tLEFT JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid = post.postid)\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']) { $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']); ($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 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, 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\t"); while ($thread = $vbulletin->db->fetch_array($threads)) { $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'] = ''; } ($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 eval(fetch_email_phrases('digestforum', $forum['languageid'])); vbmail($forum['email'], $subject, $message); } } vbmail_end(); }