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; }
/** * Sends assignment notification when a user is assigned * * @param integer Issueid to send notification for * @param integer User who is being assigned this issue * @param integer User who assigned this issue */ function send_issue_assignment_notification($issueid, $assignee, $assigner) { global $vbulletin, $vbphrase; $issue = fetch_issue_info($issueid); // invalid issue if (!$issue) { return; } // no need for notification to yourself if ($assignee == $assigner) { return; } $project = fetch_project_info($issue['projectid']); $assignee_userinfo = fetch_userinfo($assignee); if (verify_issue_perms($issue, $assignee_userinfo) === false) { return; } $assigner_userinfo = fetch_userinfo($assigner); $issue['title'] = unhtmlspecialchars($issue['title']); $project['title'] = unhtmlspecialchars($project['title']); $assignee_userinfo['username'] = unhtmlspecialchars($assignee_userinfo['username']); $assigner_userinfo['username'] = unhtmlspecialchars($assigner_userinfo['username']); eval(fetch_email_phrases('pt_issueassignment', $assignee_userinfo['languageid'])); vbmail($assignee_userinfo['email'], $subject, $message, true); }
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); } }
/** * 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; }
// Email User 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']); $infraction = array('username' => unhtmlspecialchars($userinfo['username']), 'reason' => $infractionlevel['infractionlevelid'] ? fetch_phrase('infractionlevel' . $infractionlevel['infractionlevelid'] . '_title', 'infractionlevel', '', true, true, $userinfo['languageid']) : $vbulletin->GPC['customreason'], 'message' => &$vbulletin->GPC['message'], 'points' => $infdata->fetch_field('points')); $emailsubphrase = $infraction['points'] > 0 ? 'infraction_received' : 'warning_received'; // if we have a specific post we can link to, link to it if (!empty($postinfo)) { $infraction['post'] = $vbulletin->options['bburl'] . "/showthread.php?p={$postinfo['postid']}#post{$postinfo['postid']}"; $infraction['pagetext'] =& $postinfo['pagetext']; $emailphrase = $emailsubphrase . '_post'; } else { $infraction['post'] = ''; $emailphrase = $emailsubphrase . '_profile'; } eval(fetch_email_phrases($emailphrase, $userinfo['languageid'], $emailsubphrase)); $message = $plaintext_parser->parse($message, 'privatemessage'); vbmail($userinfo['email'], $subject, $message); } } else { if (!empty($errors)) { // include useful functions require_once DIR . '/includes/functions_newpost.php'; $postpreview = construct_errors(array_map('fetch_error', $errors)); define('PMPREVIEW', 1); } } } if (!defined('PMPREVIEW')) { // trim the message so it's not too long if ($vbulletin->options['postmaxchars'] > 0) {
/** * 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); }
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; }
if ($perform_floodcheck) { 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 (!$verify->verify_token($vbulletin->GPC['humanverify'])) { $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(); } } }
$ignorelist = array(); if (trim($userinfo['ignorelist'])) { $ignorelist = preg_split('/( )+/', trim($userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); } if (!in_array($vbulletin->userinfo['userid'], $ignorelist)) { // Send pm/email $cansendemail = (($userinfo['adminemail'] OR $userinfo['showemail']) AND $vbulletin->options['enableemail'] AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canemailmember']); if ($cansendemail) { $touserinfo =& $userinfo; $fromuserinfo =& $vbulletin->userinfo; eval(fetch_email_phrases('blog_group_request_email', $touserinfo['languageid'])); require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language($touserinfo['languageid']); $message = $plaintext_parser->parse($message, 'privatemessage'); vbmail($touserinfo['email'], $subject, $message); } $pending = 'pending'; } else { $pending = 'ignored'; } $db->query_write("
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(); }
function post_save_each($doquery = true) { global $vbphrase; if (!$this->condition) { if ($postinfo =& $this->info['postinfo']) { $dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost'); $dataman->set_existing($postinfo); $dataman->set('infraction', $this->fetch_field('points') == 0 ? 1 : 2); $dataman->save(); unset($dataman); $threadinfo =& $this->info['threadinfo']; } if ($userinfo =& $this->info['userinfo']) { $userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT); $userdata->set_existing($userinfo); if ($points = $this->fetch_field('points')) { $userdata->set('ipoints', "ipoints + {$points}", false); $userdata->set('infractions', 'infractions + 1', false); } else { $userdata->set('warnings', 'warnings + 1', false); } $userdata->save(); unset($userdata); if ($points) { $this->update_infraction_groups($this->fetch_field('action'), $points); } // Insert thread if ($this->registry->options['uiforumid'] and $foruminfo = fetch_foruminfo($this->registry->options['uiforumid'])) { $infractioninfo = array('title' => $this->fetch_field('customreason') ? unhtmlspecialchars($this->fetch_field('customreason')) : fetch_phrase('infractionlevel' . $this->fetch_field('infractionlevelid') . '_title', 'infractionlevel', '', false, true, 0), 'points' => $points, 'note' => unhtmlspecialchars($this->fetch_field('note')), 'message' => $this->info['message'], 'username' => unhtmlspecialchars($userinfo['username']), 'threadtitle' => unhtmlspecialchars($threadinfo['title'])); if ($threadinfo['prefixid']) { // need prefix in correct language $infractioninfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, 0, false) . ' '; } else { $infractioninfo['prefix_plain'] = ''; } eval(fetch_email_phrases($postinfo ? 'infraction_thread_post' : 'infraction_thread_profile', 0, $points > 0 ? 'infraction_thread_infraction' : 'infraction_thread_warning')); $dataman =& datamanager_init('Thread_FirstPost', $this->registry, ERRTYPE_SILENT, 'threadpost'); $dataman->set_info('forum', $foruminfo); $dataman->set_info('is_automated', true); $dataman->set_info('mark_thread_read', true); $dataman->set('allowsmilie', true); $dataman->setr('userid', $this->fetch_field('whoadded')); $dataman->set('title', $subject); $dataman->setr('pagetext', $message); $dataman->setr('forumid', $foruminfo['forumid']); $dataman->set('visible', true); $threadid = $dataman->save(); // Update infraction with threadid $infdata =& datamanager_init('Infraction', $this->registry, ERRTYPE_SILENT); $infractioninfo = array('infractionid' => $this->fetch_field('infractionid')); $infdata->set_existing($infractioninfo); $infdata->set('threadid', $threadid); $infdata->save(); unset($infdata); } } } else { if ($this->setfields['action'] and ($this->fetch_field('action') == 1 or $this->fetch_field('action') == 2)) { $this->reset_infraction(); $this->update_infraction_groups($this->existing['action'], $this->existing['points']); if ($this->fetch_field('action') == 2 and $threadid = $this->fetch_field('threadid') and $threadinfo = fetch_threadinfo($threadid) and $foruminfo = $this->registry->forumcache["{$threadinfo['forumid']}"] and $userid = $this->fetch_field('actionuserid')) { // Reversed $infractioninfo = array('reason' => unhtmlspecialchars($this->fetch_field('actionreason'))); eval(fetch_email_phrases('infraction_post', 0, $this->existing['points'] > 0 ? 'infraction_post_infraction' : 'infraction_post_warning')); $dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost'); $dataman->set_info('thread', $threadinfo); $dataman->set_info('forum', $foruminfo); $dataman->set('threadid', $threadinfo['threadid']); $dataman->set('userid', $userid); $dataman->set('allowsmilie', true); $dataman->set('visible', true); $dataman->set('title', $subject); $dataman->set('pagetext', $message); $dataman->save(); unset($dataman); } } } ($hook = vBulletinHook::fetch_hook('infractiondata_postsave')) ? eval($hook) : false; }
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(); }
/** * 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'], fetch_seo_url('thread|js', $rpthreadinfo)) : ''; $reportinfo['postlink'] = fetch_seo_url('thread|nosession', $reportinfo, array('p' => $reportinfo['postid'])) . "#post$reportinfo[postid]"; $reportinfo['threadlink'] = fetch_seo_url('thread|nosession', $reportinfo); eval(fetch_email_phrases('report' . $this->phrasekey, $email_langid)); vbmail($moderator['email'], $subject, $message, true); }
foreach ($photoplog_category_options as $photoplog_key => $photoplog_val) { $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'];
vbmail_start(); $emails = ''; while ($user = $vbulletin->db->fetch_array($users)) { // make random number if (empty($user['activationid'])) { //none exists so create one $user['activationid'] = vbrand(0, 100000000); /*insert query*/ $vbulletin->db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "useractivation\n\t\t\t\t(userid, dateline, activationid, type, usergroupid)\n\t\t\tVALUES\n\t\t\t\t({$user['userid']}, " . TIMENOW . ", {$user['activationid']}, 0, 2)\n\t\t"); } else { $user['activationid'] = vbrand(0, 100000000); $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "useractivation SET\n\t\t\tdateline = " . TIMENOW . ",\n\t\t\tactivationid = {$user['activationid']}\n\t\t\tWHERE userid = {$user['userid']} AND type = 0\n\t\t"); } $userid = $user['userid']; $username = $user['username']; $activateid = $user['activationid']; eval(fetch_email_phrases('activateaccount', $user['languageid'])); vbmail($user['email'], $subject, $message); $emails .= iif($emails, ', '); $emails .= $user['username']; } if ($emails) { log_cron_action($emails, $nextitem, 1); } vbmail_end(); /*======================================================================*\ || #################################################################### || # Downloaded: 09:39, Wed Nov 5th 2008 || # CVS: $RCSfile$ - $Revision: 15476 $ || #################################################################### \*======================================================================*/
} else { if ($photoplog_doaction == 'delete') { if (!empty($photoplog_sql_in)) { $photoplog_fileids_array = array(); $photoplog_catids_array = array(); $photoplog_fileids_query = $db->query_read("SELECT fileid,userid,title,catid\r\n\t\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\tWHERE commentid IN (" . $photoplog_sql_in . ")\r\n\t\t\t"); while ($photoplog_fileids_row = $db->fetch_array($photoplog_fileids_query)) { $photoplog_fileids_array[] = intval($photoplog_fileids_row['fileid']); $photoplog_catids_array[] = intval($photoplog_fileids_row['catid']); if ($vbulletin->options['photoplog_user_email']) { $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_fileids_row['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_username = unhtmlspecialchars($photoplog_fetch_userinfo['username']); $photoplog_title = $photoplog_fileids_row['title']; $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_declined_comment', -1, '', 'photoplog_')); vbmail($photoplog_fetch_userinfo['email'], $photoplog_subject, $photoplog_message, true); } $db->free_result($photoplog_fetch_userinfo); } } $db->free_result($photoplog_fileids_query); foreach ($photoplog_checked_commentids as $photoplog_commentid) { $photoplog_comment_info = $db->query_first("SELECT userid,comment\r\n\t\t\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\tWHERE commentid = " . intval($photoplog_commentid) . "\r\n\t\t\t\t"); if ($photoplog_comment_info) { $photoplog_have_comment = $photoplog_comment_info['comment'] != '' ? 1 : 0; if ($db->query_write("DELETE FROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\t\tWHERE commentid = " . intval($photoplog_commentid) . "\r\n\t\t\t\t\t\t")) { if ($photoplog_have_comment) { $db->query_write("UPDATE " . TABLE_PREFIX . "user\r\n\t\t\t\t\t\t\t\tSET photoplog_commentcount = photoplog_commentcount - 1\r\n\t\t\t\t\t\t\t\tWHERE userid = " . intval($photoplog_comment_info['userid']) . "\r\n\t\t\t\t\t\t\t"); } }
// ######################################################################## $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 $ || #################################################################### \*======================================================================*/
exit; } // ######################################################################## // ######################### START MAIN SCRIPT ############################ // ######################################################################## $today = date('m-d', TIMENOW); $ids = '0'; foreach ($vbulletin->usergroupcache as $usergroupid => $usergroup) { if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'] and $usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] and !in_array($usergroup['usergroupid'], array(1, 3, 4))) { $ids .= ",{$usergroupid}"; } } $birthdays = $vbulletin->db->query_read("\n\tSELECT username, email, languageid\n\tFROM " . TABLE_PREFIX . "user\n\tWHERE birthday LIKE '{$today}-%' AND\n\t(options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ") AND\n\tusergroupid IN ({$ids})\n"); vbmail_start(); while ($userinfo = $vbulletin->db->fetch_array($birthdays)) { $username = unhtmlspecialchars($userinfo['username']); eval(fetch_email_phrases('birthday', $userinfo['languageid'])); vbmail($userinfo['email'], $subject, $message); $emails .= iif($emails, ', '); $emails .= $userinfo['username']; } vbmail_end(); if ($emails) { log_cron_action($emails, $nextitem, 1); } /*======================================================================*\ || #################################################################### || # Downloaded: 03:13, Sat Sep 7th 2013 || # CVS: $RCSfile$ - $Revision: 32878 $ || #################################################################### \*======================================================================*/
$vbulletin->db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "subscribeevent\n\t\tSET lastreminder =\n\t\tCASE\n\t\t " . implode(" \r\n", $sql) . "\n\t\tELSE lastreminder\n\t\tEND\n\t\tWHERE subscribeeventid IN (" . implode(', ', $updateids) . ")\n\t"); } 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); } /*======================================================================*\
// its a valid payment now lets check transactionid $transaction = $db->query_first("\n\t\t\t\tSELECT *\n\t\t\t\tFROM " . TABLE_PREFIX . "paymenttransaction\n\t\t\t\tWHERE transactionid = '" . $db->escape_string($apiobj->transaction_id) . "'\n\t\t\t\t\tAND paymentapiid = {$api['paymentapiid']}\n\t\t\t"); if (($apiobj->type == 2 or empty($transaction) and $apiobj->type == 1) and $vbulletin->options['paymentemail']) { if (!$vbphrase) { // initialize $vbphrase and set language constants $vbphrase = init_language(); } $emailphrase = $apiobj->type == 2 ? 'payment_reversed' : 'payment_received'; $emails = explode(' ', $vbulletin->options['paymentemail']); $username = unhtmlspecialchars($apiobj->paymentinfo['username']); $userid = $apiobj->paymentinfo['userid']; $subscription = $vbphrase['sub' . $apiobj->paymentinfo['subscriptionid'] . '_title']; $amount = vb_number_format($apiobj->paymentinfo['amount'], 2) . ' ' . strtoupper($apiobj->paymentinfo['currency']); $processor = $api['title']; $transactionid = $apiobj->transaction_id; eval(fetch_email_phrases($emailphrase, 0)); foreach ($emails as $toemail) { if (trim($toemail)) { vbmail($toemail, $subject, $message, true); } } } if (empty($transaction)) { // transaction hasn't been processed before /*insert query*/ $trans = array('transactionid' => $apiobj->transaction_id, 'paymentinfoid' => $apiobj->paymentinfo['paymentinfoid'], 'amount' => $apiobj->paymentinfo['amount'], 'currency' => $apiobj->paymentinfo['currency'], 'state' => $apiobj->type, 'dateline' => TIMENOW, 'paymentapiid' => $api['paymentapiid']); if (!$apiobj->type) { $trans['request'] = serialize(array('vb_error_code' => $apiobj->error_code, 'GET' => serialize($_GET), 'POST' => serialize($_POST))); } $db->query_write(fetch_query_sql($trans, 'paymenttransaction')); if ($apiobj->type == 1) {
/** * 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)); }
/** * Sends a welcome pm to the user * */ function send_welcomepm($fromuser = null) { if ($this->registry->options['welcomepm'] and $username = unhtmlspecialchars($this->fetch_field('username'))) { if (!$fromuser) { $fromuser = fetch_userinfo($this->registry->options['welcomepm']); } if ($fromuser) { cache_permissions($fromuser, false); eval(fetch_email_phrases('welcomepm')); // create the DM to do error checking and insert the new PM $pmdm =& datamanager_init('PM', $this->registry, ERRTYPE_SILENT); $pmdm->set_info('is_automated', true); $pmdm->set('fromuserid', $fromuser['userid']); $pmdm->set('fromusername', $fromuser['username']); $pmdm->set_info('receipt', false); $pmdm->set_info('savecopy', false); $pmdm->set('title', $subject); $pmdm->set('message', $message); $pmdm->set_recipients($username, $fromuser['permissions']); $pmdm->set('dateline', TIMENOW); $pmdm->set('allowsmilie', true); ($hook = vBulletinHook::fetch_hook('private_insertpm_process')) ? eval($hook) : false; $pmdm->pre_save(); if (empty($pmdm->errors)) { $pmdm->save(); ($hook = vBulletinHook::fetch_hook('private_insertpm_complete')) ? eval($hook) : false; } unset($pmdm); } } }
$eventid = $eventdata->save(); clear_autosave_text('vBForum_Calendar', 0, 0, $vbulletin->userinfo['userid']); if ($calendarinfo['neweventemail']) { $calemails = unserialize($calendarinfo['neweventemail']); $calendarinfo['title'] = unhtmlspecialchars($calendarinfo['title']); $title =& $vbulletin->GPC['title']; $vbulletin->userinfo['username'] = unhtmlspecialchars($vbulletin->userinfo['username']); //for emails require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language(0); // email addresses don't have a language ID $eventmessage = $plaintext_parser->parse($message, 'calendar'); foreach ($calemails as $index => $toemail) { if (trim($toemail)) { eval(fetch_email_phrases('newevent', 0)); vbmail($toemail, $subject, $message, true); } } } ($hook = vBulletinHook::fetch_hook('calendar_update_complete')) ? eval($hook) : false; if ($visible) { $vbulletin->url = 'calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getinfo&e={$eventid}&day=" . $eventdata->info['occurdate']; print_standard_redirect('redirect_calendaraddevent'); } else { $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);
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; }
photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_text']); } $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']);
if (!$user) { // no activation record, probably got back here after a successful request, back to home exec_header_redirect($vbulletin->options['forumhome'] . '.php'); } if ($user['dateline'] < TIMENOW - 24 * 60 * 60) { // is it older than 24 hours? eval(standard_error(fetch_error('resetexpired', $vbulletin->session->vars['sessionurl']))); } if ($user['activationid'] != $vbulletin->GPC['activationid']) { //wrong act id eval(standard_error(fetch_error('resetbadid', $vbulletin->session->vars['sessionurl']))); } // delete old activation id $db->query_write("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = {$userinfo['userid']} AND type = 1"); $newpassword = fetch_random_password(8); // init user data manager $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD); $userdata->set_existing($userinfo); $userdata->set('password', $newpassword); $userdata->save(); ($hook = vBulletinHook::fetch_hook('reset_password')) ? eval($hook) : false; eval(fetch_email_phrases('resetpw', $userinfo['languageid'])); vbmail($userinfo['email'], $subject, $message, true); eval(standard_error(fetch_error('resetpw', $vbulletin->session->vars['sessionurl']))); } /*======================================================================*\ || #################################################################### || # Downloaded: 12:39, Wed May 30th 2012 || # CVS: $RCSfile$ - $Revision: 39862 $ || #################################################################### \*======================================================================*/
} if (isset($pendingcache['buddy']["{$userid}"]) and $pendingcache['buddy']["{$userid}"]['friend'] == 'pending') { $add['approvals'][] = $userid; continue; } 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; }
build_datastore('photoplog_dscat', serialize($photoplog_dscatopts)); unset($photoplog_dscatopts); $photoplog_parent_fields = $db->query_read("SELECT groupid,\r\n\t\t\t\t\tdisplayorder, hidden, active, parentid\r\n\t\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_customfields\r\n\t\t\t\tWHERE catid = " . intval($photoplog_parentid) . "\r\n\t\t\t\tAND inherited != 0\r\n\t\t\t"); $photoplog_parent_values = array(); while ($photoplog_parent_field = $db->fetch_array($photoplog_parent_fields)) { $photoplog_parent_values[] = "\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t" . intval($photoplog_catid) . ",\r\n\t\t\t\t\t\t" . intval($photoplog_parent_field['groupid']) . ",\r\n\t\t\t\t\t\t" . intval($photoplog_parent_field['displayorder']) . ",\r\n\t\t\t\t\t\t" . intval($photoplog_parent_field['hidden']) . ",\r\n\t\t\t\t\t\t" . intval($photoplog_parent_field['active']) . ",\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\t" . intval($photoplog_parent_field['parentid']) . ",\r\n\t\t\t\t\t\t''\r\n\t\t\t\t\t)\r\n\t\t\t\t"; } $db->free_result($photoplog_parent_fields); if (count($photoplog_parent_values) > 0) { $photoplog_parent_values = implode(", ", $photoplog_parent_values); $db->query_write("INSERT INTO " . PHOTOPLOG_PREFIX . "photoplog_customfields\r\n\t\t\t\t\t(catid, groupid, displayorder, hidden, active, protected, inherited, parentid, info)\r\n\t\t\t\t\tVALUES " . $photoplog_parent_values . "\r\n\t\t\t\t"); } unset($photoplog_parent_values); if ($vbulletin->options['photoplog_admin_email']) { $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_made_category', -1, '', 'photoplog_')); vbmail($vbulletin->options['webmasteremail'], $photoplog_subject, $photoplog_message, true); } } } $photoplog_return_url = $photoplog['location'] . '/index.php?' . $vbulletin->session->vars['sessionurl'] . 'c=' . $photoplog_parentid; if ($photoplog_parentid < 0) { $photoplog_return_url = $photoplog['location'] . '/index.php' . $vbulletin->session->vars['sessionurl_q']; } ($hook = vBulletinHook::fetch_hook('photoplog_categories_do_complete')) ? eval($hook) : false; $vbulletin->url = $photoplog_return_url; eval(print_standard_redirect('redirect_photoplog_submissionthanks')); } ($hook = vBulletinHook::fetch_hook('photoplog_categories_complete')) ? eval($hook) : false; if ($_REQUEST['do'] != 'suggest' && $_POST['do'] != 'dosuggest' && $_REQUEST['do'] != 'create' && $_POST['do'] != 'docreate') { photoplog_index_bounce();