Ejemplo n.º 1
0
function print_admin_stop_exception($e)
{
    $args = $e->getParams();
    $message = fetch_phrase($args[0], 'error', '', false);
    if (sizeof($args) > 1) {
        $args[0] = $message;
        $message = call_user_func_array('construct_phrase', $args);
    }
    echo "<p>{$message}</p>\n";
}
Ejemplo n.º 2
0
 /**
  * Returns the HTML to be displayed to the user for Human Verification
  *
  * @param	string	Passed to template
  *
  * @return 	string	HTML to output
  *
  */
 function output_token($var_prefix = 'humanverify')
 {
     global $vbphrase, $stylevar, $show;
     $vbulletin =& $this->registry;
     $humanverify = $this->generate_token();
     require_once DIR . '/includes/functions_misc.php';
     $humanverify['question'] = fetch_phrase('question' . $humanverify['answer'], 'hvquestion', '', false, true, $this->registry->userinfo['languageid'], false);
     eval('$output = "' . fetch_template('humanverify_question') . '";');
     return $output;
 }
Ejemplo n.º 3
0
 /**
  * Returns the HTML to be displayed to the user for Human Verification
  *
  * @param	string	Passed to template
  *
  * @return 	string	HTML to output
  *
  */
 function output_token($var_prefix = 'humanverify')
 {
     global $vbphrase, $show;
     $vbulletin =& $this->registry;
     $humanverify = $this->generate_token();
     require_once DIR . '/includes/functions_misc.php';
     $humanverify['question'] = fetch_phrase('question' . $humanverify['answer'], 'hvquestion', '', false, true, $this->registry->userinfo['languageid'], false);
     $templater = vB_Template::create('humanverify_question');
     $templater->register('humanverify', $humanverify);
     $templater->register('var_prefix', $var_prefix);
     $output = $templater->render();
     return $output;
 }
Ejemplo n.º 4
0
         $messages['errors'][] = $userdata->errors[0];
     }
 }
 // check if username already exists on DB
 $user_exists = $db->query_first("\n        SELECT userid, username, email, languageid\n        FROM " . TABLE_PREFIX . "user\n        WHERE username = '******'username']) . "'\n    ");
 if (!empty($user_exists['username'])) {
     $valid_entries = FALSE;
     $error_type = "username";
     $messages['fields'][] = $error_type;
     $messages['errors'][] = "Sorry, this username is already taken.";
     // fetch_error('usernametaken', $user_exists['username'], '');
 }
 if (empty($vbulletin->GPC['terms_and_conditions'])) {
     $valid_entries = FALSE;
     $userdata->error('fieldmissing');
     $messages['errors'][] = $message = "Please agree to the " . fetch_phrase('forum_rules', 'register');
     $messages['fields'][] = $error_type = "terms_and_conditions";
 }
 // validate email
 if (is_valid_email_address($vbulletin->GPC['email'])) {
     list($email_name, $email_domain) = preg_split("/@/", $vbulletin->GPC['email']);
     if (!checkdnsrr($email_domain, "MX")) {
         $valid_entries = FALSE;
         $messages['errors'][] = $message = fetch_error('bademail') . " No MX records found for domain.";
         $messages['fields'][] = $error_type = "email";
     } else {
         if ($vbulletin->options['requireuniqueemail']) {
             // check if email already exists on DB
             $user_exists = $db->query_read_slave("\n                        SELECT userid, username, email, languageid\n                        FROM " . TABLE_PREFIX . "user\n                        WHERE UPPER(email) = '" . strtoupper($db->escape_string($vbulletin->GPC['email'])) . "'\n                    ");
             if ($db->num_rows($user_exists)) {
                 $valid_entries = FALSE;
Ejemplo n.º 5
0
/**
 * 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();
}
Ejemplo n.º 6
0
 if ($showemail) {
     if (empty($vbulletin->GPC['message']) and $vbulletin->options['uimessage'] and !$nocontact) {
         $errors[] = 'nomessagetouser';
     }
     if (!empty($errors)) {
         // include useful functions
         require_once DIR . '/includes/functions_newpost.php';
         $postpreview = construct_errors(array_map('fetch_error', $errors));
         define('PMPREVIEW', 1);
         $postmessage = htmlspecialchars_uni($vbulletin->GPC['message']);
     } else {
         // 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 {
Ejemplo n.º 7
0
 /**
  * Sets information regarding the report
  *
  * @param	array	Information regarding the report
  *
  */
 function set_reportinfo(&$reportinfo)
 {
     $reportinfo = array_merge($reportinfo, array('forumtitle' => unhtmlspecialchars($this->extrainfo['forum']['title_clean']), 'threadtitle' => unhtmlspecialchars($this->extrainfo['thread']['title']), 'posttitle' => unhtmlspecialchars($this->iteminfo['title']), 'pusername' => unhtmlspecialchars($this->iteminfo['username']), 'puserid' => $this->iteminfo['userid'], 'postid' => $this->iteminfo['postid'], 'threadid' => $this->extrainfo['thread']['threadid'], 'pagetext' => $this->iteminfo['pagetext']));
     $reportinfo['prefix_plain'] = $this->extrainfo['thread']['prefixid'] ? fetch_phrase("prefix_" . $this->extrainfo['thread']['prefixid'] . "_title_plain", 'global', '', false, true, 0, false) . ' ' : '';
 }
Ejemplo n.º 8
0
		}
		</script>
		<?php 
        print_form_header('user', 'domoderate');
        print_table_header($vbphrase['users_awaiting_moderation'], 4);
        print_cells_row(array($vbphrase['username'], $vbphrase['email'], $vbphrase['ip_address'], "<input type=\"button\" class=\"button\" value=\"" . $vbphrase['accept_all'] . "\" onclick=\"js_check_radio(1)\" />\n\t\t\t<input type=\"button\" class=\"button\" value=\"" . $vbphrase['delete_all'] . "\" onclick=\"js_check_radio(-1)\" />\n\t\t\t<input type=\"button\" class=\"button\" value=\"" . $vbphrase['ignore_all'] . "\" onclick=\"js_check_radio(0)\" />"), 0, 'thead', -3);
        while ($user = $db->fetch_array($users)) {
            $cell = array();
            $cell[] = "<a href=\"user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&amp;u={$user['userid']}\" target=\"_user\"><b>{$user['username']}</b></a>";
            $cell[] = "<a href=\"mailto:{$user['email']}\">{$user['email']}</a>";
            $cell[] = "<a href=\"usertools.php?" . $vbulletin->session->vars['sessionurl'] . "do=doips&amp;depth=2&amp;ipaddress={$user['ipaddress']}&amp;hash=" . CP_SESSIONHASH . "\" target=\"_user\">{$user['ipaddress']}</a>";
            $cell[] = "\n\t\t\t\t<label for=\"v_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"1\" id=\"v_{$user['userid']}\" tabindex=\"1\" />{$vbphrase['accept']}</label>\n\t\t\t\t<label for=\"d_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"-1\" id=\"d_{$user['userid']}\" tabindex=\"1\" />{$vbphrase['delete']}</label>\n\t\t\t\t<label for=\"i_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"0\" id=\"i_{$user['userid']}\" tabindex=\"1\" checked=\"checked\" />{$vbphrase['ignore']}</label>\n\t\t\t";
            print_cells_row($cell, 0, '', -4);
        }
        require_once DIR . '/includes/functions_misc.php';
        $template = fetch_phrase('validated', 'emailbody', 'email_');
        print_table_break();
        print_table_header($vbphrase['email_options']);
        print_yes_no_row($vbphrase['send_email_to_accepted_users'], 'send_validated', 1);
        print_yes_no_row($vbphrase['send_email_to_deleted_users'], 'send_deleted', 1);
        print_description_row($vbphrase['email_will_be_sent_in_user_specified_language']);
        print_table_break();
        print_submit_row($vbphrase['continue']);
    }
}
// ###################### Start do moderate and coppa #######################
if ($_POST['do'] == 'domoderate') {
    $vbulletin->input->clean_array_gpc('p', array('send_validated' => TYPE_INT, 'send_deleted' => TYPE_INT, 'validate' => TYPE_ARRAY_INT));
    if (empty($vbulletin->GPC['validate'])) {
        print_stop_message('please_complete_required_fields');
    } else {
Ejemplo n.º 9
0
        }
    }
}
require_once DIR . '/includes/class_xml.php';
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('threadrating');
if ($update) {
    $thread = $db->query_first_slave("\n\t\tSELECT votetotal, votenum\n\t\tFROM " . TABLE_PREFIX . "thread\n\t\tWHERE threadid = {$threadinfo['threadid']}\n\t");
    if ($thread['votenum'] >= $vbulletin->options['showvotes']) {
        // Show Voteavg
        $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2);
        $thread['rating'] = round($thread['votetotal'] / $thread['votenum']);
        $xml->add_tag('voteavg', process_replacement_vars("{$vbphrase['rating']}: <img class=\"inlineimg\" src=\"{$stylevar['imgdir_rating']}/rating_{$thread['rating']}.gif\" alt=\"" . construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\" border=\"0\" />"));
    } else {
        $xml->add_tag('voteavg', '');
    }
    if (!function_exists('fetch_phrase')) {
        require_once DIR . '/includes/functions_misc.php';
    }
    $xml->add_tag('message', fetch_phrase('redirect_threadrate_add', 'frontredirect', 'redirect_'));
} else {
    $xml->add_tag('error', fetch_error('threadratevoted'));
}
$xml->close_group();
$xml->print_xml();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 08:19, Wed Nov 5th 2008
|| # CVS: $RCSfile$ - $Revision: 26399 $
|| ####################################################################
\*======================================================================*/
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
	/**
	 * Rate a node (ajax only)
	 *
	 * @return string
	 */
	public function actionRate()
	{
		global $bootstrap;

		$nodeid = intval($this->node->getNodeId());

		// Load the style
		$bootstrap->force_styleid($this->node->getStyleId());
		$bootstrap->load_style();

		vB::$vbulletin->input->clean_array_gpc('r', array(
			'vote' => vB_Input::TYPE_UINT
		));
		$vote = vB::$vbulletin->GPC['vote'];

		if ($vote < 0 OR $vote > 5)
		{
			die;
		}

		$rated = intval(fetch_bbarray_cookie('cms_rate', $nodeid));

		$update = false;
		if (vB::$vbulletin->userinfo['userid'])
		{
			if ($rating = vB::$db->query_first("
				SELECT *
				FROM " . TABLE_PREFIX . "cms_rate
				WHERE userid = " . vB::$vbulletin->userinfo['userid'] . "
					AND nodeid = $nodeid
			"))
			{
				if (vB::$vbulletin->options['votechange'])
				{
					if ($vote != $rating['vote'])
					{
						$rateitem = new vBCms_Item_Rate($rating['rateid']);
						$ratedm = new vBCms_DM_Rate($rateitem);
						$ratedm->set('nodeid', $nodeid);
						$ratedm->set('userid', vB::$vbulletin->userinfo['userid']);
						$ratedm->set('vote', intval($vote));
						$ratedm->save();
					}
					$update = true;
				}
			}
			else
			{
				$ratedm = new vBCms_DM_Rate();
				$ratedm->set('nodeid', $nodeid);
				$ratedm->set('userid', vB::$vbulletin->userinfo['userid']);
				$ratedm->set('vote', intval($vote));
				$ratedm->save();

				$update = true;
			}
		}
		else
		{
			// Check for cookie on user's computer for this blogid
			if ($rated AND !vB::$vbulletin->options['votechange'])
			{

			}
			else
			{
				// Check for entry in Database for this Ip Addr/blogid
				if ($rating = vB::$db->query_first("
					SELECT *
					FROM " . TABLE_PREFIX . "cms_rate
					WHERE ipaddress = '" . vB::$db->escape_string(IPADDRESS) . "'
						AND nodeid = $nodeid
				"))
				{
					if (vB::$vbulletin->options['votechange'])
					{
						if ($vote != $rating['vote'])
						{
							$rateitem = new vBCms_Item_Rate($rating['rateid']);
							$ratedm = new vBCms_DM_Rate($rateitem);
							$ratedm->set('nodeid', $nodeid);
							$ratedm->set('vote', intval($vote));
							$ratedm->save();
						}
						$update = true;
					}
				}
				else
				{
					$ratedm = new vBCms_DM_Rate();
					$ratedm->set('nodeid', $nodeid);
					$ratedm->set('userid', 0);
					$ratedm->set('vote', intval($vote));
					$ratedm->save();

					$update = true;

				}
			}
		}

		require_once(DIR . '/includes/class_xml.php');
		$xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');
		$xml->add_group('threadrating');
		if ($update)
		{
			$node = vB::$db->query_first_slave("
				SELECT ratingtotal, ratingnum
				FROM " . TABLE_PREFIX . "cms_nodeinfo
				WHERE nodeid = $nodeid
			");

			if ($node['ratingnum'] > 0 AND $node['ratingnum'] >= vB::$vbulletin->options['showvotes'])
			{	// Show Voteavg
				$node['ratingavg'] = vb_number_format($node['ratingtotal'] / $node['ratingnum'], 2);
				$node['rating'] = intval(round($node['ratingtotal'] / $node['ratingnum']));
				$xml->add_tag('voteavg', "<img class=\"inlineimg\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_rating') . "/rating-15_$node[rating].png\" alt=\"" . construct_phrase($vbphrase['rating_x_votes_y_average'], $node['ratingnum'], $node['ratingavg']) . "\" border=\"0\" />");
			}
			else
			{
				$xml->add_tag('voteavg', '');
			}

			if (!function_exists('fetch_phrase'))
			{
				require_once(DIR . '/includes/functions_misc.php');
			}
			$xml->add_tag('message', fetch_phrase('redirect_blog_rate_add', 'frontredirect', 'redirect_'));
		}
		else	// Already voted error...
		{
			if (!empty($rating['nodeid']))
			{
				set_bbarray_cookie('cms_rate', $rating['nodeid'], $rating['vote'], 1);
			}
			$xml->add_tag('error', fetch_error('blog_rate_voted'));
		}
		$xml->close_group();
		$xml->print_xml();

	}
Ejemplo n.º 12
0
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();
}
Ejemplo n.º 13
0
/**
* Returns eval()-able code to initiate a standard redirect
*
* The global variable $url should contain the URL target for the redirect
*
* @param	mixed	Name of redirect phrase, or array if constructing a phrase.
* @param	boolean	If false, use the name of redirect phrase as the phrase text itself
* @param	boolean	Whether or not to force a redirect message to be shown
* @param	integer	Language ID to fetch the phrase from (-1 uses the page-wide default)
* @param	bool	Force bypass of domain whitelist check
*
* @return	none (the session is re-directed).
*/
function print_standard_redirect($redir_phrase, $isphrase = true, $forceredirect = false, $languageid = -1, $bypasswhitelist = false)
{
    if (!VB_API) {
        if ($isphrase) {
            if (!function_exists('fetch_phrase')) {
                require_once DIR . '/includes/functions_misc.php';
            }
            if (is_array($redir_phrase)) {
                // array element 0 is the phrase name, convert it to the phrase, and then run it through construct.
                $redir_phrase[0] = fetch_phrase($redir_phrase[0], 'frontredirect', 'redirect_', false, false, $languageid);
                $phrase = construct_phrase($redir_phrase);
                // Build final output.
            } else {
                $phrase = fetch_phrase($redir_phrase, 'frontredirect', 'redirect_', true, false, $languageid, false);
            }
        } else {
            $phrase = addslashes($redir_phrase);
        }
    } else {
        $phrase = $redir_phrase;
    }
    return standard_redirect($phrase, $forceredirect, $bypasswhitelist);
}
Ejemplo n.º 14
0
	public static function fixNodeLR($sectionid = false, $nodeleft = 0, $sectiontypeid = false, $findmissing = true)
	{
		//We pull the list of items that are children of the current node.
		global $vbulletin;
		global $vbphrase;
		$result = '';

		if (! intval($sectiontypeid))
		{
			$sectiontypeid = vB_Types::instance()->getContentTypeID("vBCms_Section");
		}

		//There can be nodes that don't have a valid parent. In that case, we make a
		//"lost and found" section and put them into it. If we do this first, then
		//we will automatically fix it.
		if ($findmissing)
		{
			if ($rst = $vbulletin->db->query_read("SELECT n1.nodeid FROM " .
			TABLE_PREFIX . "cms_node n1 LEFT JOIN " .
			TABLE_PREFIX . "cms_node n2 ON n2.nodeid = n1.parentnode AND n2.nodeid <> n1.nodeid
				AND n2.contenttypeid = $sectiontypeid
 			WHERE n2.nodeid IS NULL AND n1.contenttypeid <> $sectiontypeid;"))
			{
				$orphans = array();
				while($record = $record = $vbulletin->db->fetch_array($rst))
				{
					$orphans[] = $record['nodeid'];
				}
			}

			//Do we have orphans?
			if (count($orphans))
			{
				//We need to make a lost and found folder.
				$record = $vbulletin->db->query_first("SELECT node.nodeid FROM " .
				TABLE_PREFIX . "cms_node AS node WHERE	node.parentnode IS NULL LIMIT 1");
				//Now create a node.
				$vbulletin->GPC_exists['parentnode'] = $vbulletin->GPC_exists['sectionid'] = 1;
				$vbulletin->GPC['parentnode'] = $vbulletin->GPC['sectionid'] = $record['nodeid'];

				if ($content = vBCms_Content::create('vBCms', 'Section'))
				{
					require_once DIR . '/includes/functions_misc.php';
					$nodedm = new vBCms_DM_Section();
					$nodedm->set('parentnode', $record['nodeid']);
					$nodedm->set('contenttypeid', $sectiontypeid);
					vB::$vbulletin->GPC_exists['title'] = 1;
					vB::$vbulletin->GPC['title'] = fetch_phrase('lost_found', 'cpcms');
					// create content handler
					$content = vBCms_Content::create('vBCms', 'Section');
					$content->setParentNode( $record['nodeid']);
					if (! $sectionid = $content->createDefaultContent($nodedm))
					{
							throw (new vB_Exception_DM('Could not create new node for content: ' . print_r($nodedm->getErrors())));
					}
					$result = fetch_phrase('check_lost_found', 'cpcms');
				}
				vB_Cache::instance()->event('sections_updated');
				vB_Cache::instance()->cleanNow();

				//We have everything we need. Let's update
				$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "cms_node SET parentnode = $sectionid, permissionsfrom = 1
				WHERE nodeid IN(" . implode(',', $orphans) . ")");

			}
			self::fixNodeLR(false, 0, $sectiontypeid, false);
			return $result;
		}
		else
		{
			$rst = $vbulletin->db->query_read($sql = "SELECT node.nodeid, contenttypeid FROM " .
			TABLE_PREFIX . "cms_node AS node INNER JOIN " .
			TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid WHERE
			node.parentnode " . (intval($sectionid) ? "= $sectionid" : "IS NULL")  . " ORDER BY nodeleft" );

			$nodes = array();
			while ($record = $vbulletin->db->fetch_array($rst))
			{
				$nodes[] = $record;
			}
			$vbulletin->db->free_result($rst);

			$childnodeleft = intval($nodeleft) + 1;

			if ($sectionid)
			{
				//Find out if we should assign permissionsfrom for this record, or inherit from a parent.
				if ($permission_record = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX .
					"cms_permissions WHERE nodeid = $sectionid LIMIT 1;" ))
				{
					$permissionsfrom = $sectionid;
				}
				else
				{
					$permission_record = $vbulletin->db->query_first("SELECT permissionsfrom FROM " . TABLE_PREFIX .
					"cms_node WHERE nodeid = $sectionid LIMIT 1;" );
					$permissionsfrom = $permission_record['permissionsfrom'];
				}
			}
			else
			{
				//We are at the root. Our early code created orphan nodecategory records. Let's find and
				// remove any.
				$vbulletin->db->query_write("CREATE TEMPORARY TABLE cms_nc_orphans AS
					select nc.nodeid FROM " . TABLE_PREFIX .
					"cms_nodecategory nc LEFT JOIN " . TABLE_PREFIX .
					"cms_node AS node on node.nodeid = nc.nodeid
						WHERE node.nodeid IS NULL;");

				$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX .
					"cms_nodecategory WHERE nodeid IN (SELECT nodeid from cms_nc_orphans);");

				$vbulletin->db->query_write("DROP TEMPORARY TABLE cms_nc_orphans");

				$permissionsfrom = false;
			}

			foreach ($nodes as $node)
			{
				if (intval($node['contenttypeid']) == intval($sectiontypeid))
				{
					if ($permissionsfrom)
					{
						$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "cms_node SET permissionsfrom =
						 $permissionsfrom WHERE nodeid = " . $node['nodeid']);
					}
					$childnodeleft = self::fixNodeLR($node['nodeid'], $childnodeleft, $sectiontypeid, false);
				}
				else
				{
					$rst = $vbulletin->db->query_write($sql = "UPDATE " .
					TABLE_PREFIX . "cms_node SET nodeleft = $childnodeleft, noderight = " .
					($childnodeleft + 1) . ", permissionsfrom = $permissionsfrom WHERE nodeid = " . $node['nodeid'] );
					$childnodeleft += 2;
				}
			}
			if (intval($sectionid))
			{
				$rst = $vbulletin->db->query_write($sql = "UPDATE " .
				TABLE_PREFIX . "cms_node set nodeleft = $nodeleft, noderight = " .
				$childnodeleft . ($permissionsfrom ? ", permissionsfrom = $permissionsfrom" : '') .
				" WHERE nodeid = $sectionid " );
				return $childnodeleft + 1;
			}
		}

		self::fixCategoryLR();

		return $result;
	}
Ejemplo n.º 15
0
/**
* Halts execution and shows a message based upon a parsed phrase
*
* After the first parameter, this function can take any number of additional
* parameters, in order to replace {1}, {2}, {3},... {n} variable place holders
* within the given phrase text. The parsed phrase is then passed to print_cp_message()
*
* Note that a redirect can be performed if CP_REDIRECT is defined with a URL
*
* @param	string	Name of phrase (from the Error phrase group)
* @param	string	1st variable replacement {1}
* @param	string	2nd variable replacement {2}
* @param	string	Nth variable replacement {n}
*/
function print_stop_message($phrasename)
{
    global $vbulletin, $vbphrase;
    if (!function_exists('fetch_phrase')) {
        require_once DIR . '/includes/functions_misc.php';
    }
    $message = fetch_phrase($phrasename, 'error', '', false);
    $args = func_get_args();
    if (sizeof($args) > 1) {
        $args[0] = $message;
        $message = call_user_func_array('construct_phrase', $args);
    }
    if (defined('CP_CONTINUE')) {
        define('CP_REDIRECT', CP_CONTINUE);
    }
    if ($vbulletin->GPC['ajax']) {
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('error', $message);
        $xml->print_xml();
    }
    if (VB_AREA == 'Upgrade') {
        echo $message;
        exit;
    }
    print_cp_message($message, defined('CP_REDIRECT') ? CP_REDIRECT : NULL, 1, defined('CP_BACKURL') ? CP_BACKURL : NULL, defined('CP_CONTINUE') ? true : false);
}
Ejemplo n.º 16
0
        $redirect_phrase = 'redirect_reputationminus';
    } else {
        $redirect_phrase = 'redirect_reputationadd';
    }
    if (!$vbulletin->GPC['ajax']) {
        $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "&amp;p={$postid}#post{$postid}";
        eval(print_standard_redirect($redirect_phrase));
        // redirect or close window here
    } else {
        cache_permissions($userinfo);
        $post = $userinfo;
        $repdisplay = fetch_reputation_image($post, $userinfo['permissions']);
        require_once DIR . '/includes/class_xml.php';
        require_once DIR . '/includes/functions_misc.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('reputation', process_replacement_vars(fetch_phrase($redirect_phrase, 'frontredirect', 'redirect_')), array('reppower' => fetch_reppower($userinfo, $userinfo['permissions']), 'repdisplay' => process_replacement_vars($post['reputationdisplay']), 'userid' => $userinfo['userid']));
        $xml->print_xml();
    }
} else {
    $vbulletin->input->clean_array_gpc('p', array('ajax' => TYPE_BOOL));
    if ($vbulletin->userinfo['userid'] == $userid) {
        // is this your own post?
        ($hook = vBulletinHook::fetch_hook('reputation_viewown_start')) ? eval($hook) : false;
        $postreputations = $db->query_read_slave("\n\t\t\tSELECT reputation, reason\n\t\t\tFROM " . TABLE_PREFIX . "reputation\n\t\t\tWHERE postid = {$postid}\n\t\t\tORDER BY dateline DESC\n\t\t");
        if ($db->num_rows($postreputations) > 0) {
            require_once DIR . '/includes/class_bbcode.php';
            $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
            while ($postreputation = $db->fetch_array($postreputations)) {
                $total += $postreputation['reputation'];
                if ($postreputation['reputation'] > 0) {
                    $posneg = 'pos';
Ejemplo n.º 17
0
 public static function construct_cat_chooser_options($topname = null)
 {
     global $vbulletin, $vbphrase;
     $selectoptions = array();
     if ($topname) {
         $selectoptions['-2'] = $topname;
     }
     require_once DIR . '/includes/blog_functions_category.php';
     require_once DIR . '/includes/functions_misc.php';
     fetch_ordered_categories(0);
     $selectoptions['-1'] = fetch_phrase('uncategorized', 'vbblogglobal');
     if (!empty($vbulletin->vbblog['categorycache']["0"])) {
         foreach ($vbulletin->vbblog['categorycache']["0"] as $categoryid => $category) {
             $depthmark = str_pad('', 4 * $category['depth'], '- - ', STR_PAD_LEFT);
             $selectoptions[$categoryid] = $depthmark . fetch_phrase('category' . $category['blogcategoryid'] . '_title', 'vbblogcat');
         }
     }
     return $selectoptions;
 }
Ejemplo n.º 18
0
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();
}
Ejemplo n.º 19
0
/**
* Returns eval()-able code to initiate a standard redirect
*
* The global variable $url should contain the URL target for the redirect
*
* @param	string	Name of redirect phrase
* @param	boolean	If false, use the name of redirect phrase as the phrase text itself
* @param	boolean	Whether or not to force a redirect message to be shown
* @param	integer	Language ID to fetch the phrase from (-1 uses the page-wide default)
*
* @return	string
*/
function print_standard_redirect($redir_phrase, $doquery = true, $forceredirect = false, $languageid = -1)
{
	if ($doquery)
	{
		if (!function_exists('fetch_phrase'))
		{
			require_once(DIR . '/includes/functions_misc.php');
		}

		$phrase = fetch_phrase($redir_phrase, 'frontredirect', 'redirect_', true, false, $languageid, false);
		// addslashes run in fetch_phrase
	}
	else
	{
		$phrase = addslashes($redir_phrase);
	}

	return 'standard_redirect("' . $phrase . '", ' . intval($forceredirect) . ');';
}
Ejemplo n.º 20
0
                        $pmdm->save();
                        ($hook = vBulletinHook::fetch_hook('private_insertpm_complete')) ? eval($hook) : false;
                    }
                    unset($pmdm);
                }
            } else {
                if ($status == -1) {
                    // deleted
                    if ($vbulletin->GPC['send_deleted']) {
                        if (!isset($evalemail_deleted["{$user['languageid']}"])) {
                            //note that we pass the "all languages" flag as true all the time because if the function does
                            //caching internally and is not smart enough to check if the language requested the second time
                            //was cached on the first pass -- so we make sure that we load and cache all language version
                            //in case the second user has a different language from the first
                            $text_message = fetch_phrase('moderation_deleted', 'emailbody', '', true, true, $chosenlanguage);
                            $text_subject = fetch_phrase('moderation_deleted', 'emailsubject', '', true, true, $chosenlanguage);
                            $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
Ejemplo n.º 21
0
// ########################################################################
$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 $
|| ####################################################################
\*======================================================================*/
Ejemplo n.º 22
0
 /**
  * Parse exception
  *
  * @param	string	error msg to parse
  *
  * @return	string
  */
 protected function stop_exception($e)
 {
     $args = $e->getParams();
     require_once DIR . '/includes/functions_misc.php';
     $message = fetch_phrase($args[0], 'error', '', false);
     if (sizeof($args) > 1) {
         $args[0] = $message;
         $message = call_user_func_array('construct_phrase', $args);
     }
     return $message;
 }
Ejemplo n.º 23
0
                foreach ($vbulletin->GPC["{$varname}"] as $_cleanme) {
                    $vbulletin->url .= $varname . '[]=' . urlencode($_cleanme) . '&amp;';
                }
            } else {
                $vbulletin->url .= $varname . '[]=' . urlencode($vbulletin->GPC["{$varname}"]) . '&amp;';
            }
        }
        $vbulletin->url = substr($vbulletin->url, 0, -5);
    }
    ($hook = vBulletinHook::fetch_hook('search_doprefs_complete')) ? eval($hook) : false;
    if (!$vbulletin->GPC['ajax']) {
        eval(print_standard_redirect($clearprefs ? 'search_preferencescleared' : 'search_preferencessaved', true, true));
    } else {
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('message', fetch_phrase($clearprefs ? 'redirect_search_preferencescleared' : 'redirect_search_preferencessaved', 'frontredirect', 'redirect_'));
        $xml->print_xml();
    }
}
// #############################################################################
// finish off the page
if ($templatename != '') {
    ($hook = vBulletinHook::fetch_hook('search_complete')) ? eval($hook) : false;
    $navbits = construct_navbits($navbits);
    eval('$navbar = "' . fetch_template('navbar') . '";');
    eval('print_output("' . fetch_template($templatename) . '");');
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 22:41, Fri Oct 10th 2008
|| # CVS: $RCSfile$ - $Revision: 26900 $
Ejemplo n.º 24
0
			require_once(DIR . '/includes/functions_newpost.php');

			$postpreview = construct_errors(array_map('fetch_error', $errors));
			define('PMPREVIEW', 1);

			$postmessage = htmlspecialchars_uni($vbulletin->GPC['message']);
		}
		else
		{	// 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'] . '/' . fetch_seo_url('thread', $threadinfo, array('p' => $postinfo['postid'])) . "#post$postinfo[postid]";
				$infraction['pagetext'] =& $postinfo['pagetext'];
				$emailphrase = $emailsubphrase . '_post';
			}
			else
			{
Ejemplo n.º 25
0
/**
* Halts execution and shows a message based upon a parsed phrase
*
* After the first parameter, this function can take any number of additional
* parameters, in order to replace {1}, {2}, {3},... {n} variable place holders
* within the given phrase text. The parsed phrase is then passed to print_cp_message()
*
* Note that a redirect can be performed if CP_REDIRECT is defined with a URL
*
* @param	string	Name of phrase (from the Error phrase group)
* @param	string	1st variable replacement {1}
* @param	string	2nd variable replacement {2}
* @param	string	Nth variable replacement {n}
*/
function print_stop_message($phrasename)
{
    global $vbulletin, $vbphrase;
    if (!function_exists('fetch_phrase')) {
        require_once DIR . '/includes/functions_misc.php';
    }
    $message = fetch_phrase($phrasename, 'error', '', false);
    $args = func_get_args();
    if (sizeof($args) > 1) {
        $args[0] = $message;
        $message = call_user_func_array('construct_phrase', $args);
    }
    if (defined('CP_CONTINUE')) {
        define('CP_REDIRECT', CP_CONTINUE);
    }
    print_cp_message($message, defined('CP_REDIRECT') ? CP_REDIRECT : NULL, 1, defined('CP_BACKURL') ? CP_BACKURL : NULL, defined('CP_CONTINUE') ? true : false);
}
Ejemplo n.º 26
0
	if (!$vbulletin->GPC['ajax'])
	{
		$vbulletin->url = fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post$postid";
		eval(print_standard_redirect($redirect_phrase));
		// redirect or close window here
	}
	else
	{
		cache_permissions($userinfo);
		$post = $userinfo;
		$repdisplay = fetch_reputation_image($post, $userinfo['permissions']);

		require_once(DIR . '/includes/class_xml.php');
		require_once(DIR . '/includes/functions_misc.php');
		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_tag('reputation', process_replacement_vars(fetch_phrase($redirect_phrase, 'frontredirect', 'redirect_')), array(
			'reppower'   => fetch_reppower($userinfo, $userinfo['permissions']),
			'repdisplay' => process_replacement_vars($post['reputationdisplay']),
			'userid'     => $userinfo['userid'],
		));
		$xml->print_xml();
	}
}
else
{
	$vbulletin->input->clean_array_gpc('p', array(
		'ajax' => TYPE_BOOL,
	));

	if ($vbulletin->userinfo['userid'] == $userid)
	{ // is this your own post?
Ejemplo n.º 27
0
 /**
  * Verify that product can be installed
  *
  * @param	string	XML file to parse
  *
  * @return	mixed true on success, error message on failure
  */
 public function verify_install($productid)
 {
     $product_file = DIR . "/includes/xml/product-{$productid}.xml";
     $xml = file_read($product_file);
     try {
         $this->parse($xml);
         $this->import_dependencies();
     } catch (vB_Exception_AdminStopMessage $e) {
         $args = $e->getParams();
         require_once DIR . '/includes/functions_misc.php';
         $message = fetch_phrase($args[0], 'error', '', false, false, -1, false);
         if (sizeof($args) > 1) {
             $args[0] = $message;
             $message = call_user_func_array('construct_phrase', $args);
         }
         return $message;
     }
     return true;
 }
Ejemplo n.º 28
0
function upgrade_product_step($productid)
{
	global $vbulletin;
	global $upgrade_phrases;

	$product_file = DIR . "/includes/xml/product-$productid.xml";
	$exists = file_exists($product_file);
	if (!$exists)
	{
		$upgrade_phrases['finalupgrade.php']['product_not_found'];
		return false;
	}

	require_once(DIR . "/includes/adminfunctions_plugin.php");
	require_once(DIR . "/includes/adminfunctions_template.php");
	require_once(DIR . '/includes/class_bootstrap_framework.php');
	vB_Bootstrap_Framework::init();

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['installing_product'] . "</p>");
	$xml = file_read($product_file);

	try
	{
		install_product($xml, true);
	}
	catch(vB_Exception_AdminStopMessage $e)
	{
		$args = $e->getParams();
		$message = fetch_phrase($args[0], 'error', '', false);

		if (sizeof($args) > 1)
		{
			$args[0] = $message;
			$message = call_user_func_array('construct_phrase', $args);
		}

		echo "<p>$message</p>\n";
		echo "<p>" . $upgrade_phrases['finalupgrade.php']['product_not_installed'] . "</p>";
		return false;
	}

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['product_installed'] . "</p>");
	return 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);
     }
 }
Ejemplo n.º 30
0
/**
* Sends the selected PT digest (daily or weekly)
*
* @param	string	Digest type (daily or weekly)
*/
function exec_pt_digest($type = 'daily')
{
    global $vbulletin;
    if (empty($vbulletin->pt_permissions)) {
        $vbulletin->datastore->do_db_fetch("'pt_bitfields','pt_permissions'");
    }
    $lastdate = mktime(0, 0);
    // midnight today
    if ($type == 'daily') {
        // daily, yesterday midnight
        $lastdate -= 24 * 60 * 60;
    } else {
        // weekly, last week midnight
        $type = 'weekly';
        $lastdate -= 7 * 24 * 60 * 60;
    }
    require_once DIR . '/includes/functions_misc.php';
    require_once DIR . '/includes/class_bbcode_alt.php';
    $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
    vbmail_start();
    // get new issues
    $issues = $vbulletin->db->query_read_slave("\r\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\r\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\r\n\t\t\tissue.*, language.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuesubscribe.issueid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (issuesubscribe.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\r\n\t\tWHERE issuesubscribe.subscribetype = '{$type}'\r\n\t\t\tAND issue.lastpost > {$lastdate}\r\n\t\t\tAND issue.visible = 'visible'\r\n\t\t\tAND user.usergroupid <> 3\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t");
    while ($issue = $vbulletin->db->fetch_array($issues)) {
        // check that this user has the correct permissions to view
        $issueperms = fetch_project_permissions($issue, $issue['projectid'], $issue['issuetypeid']);
        if (!($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canview']) or $issue['userid'] != $issue['submituserid'] and !($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canviewothers'])) {
            // can't view or can't view others' issues
            continue;
        }
        $notebits = '';
        $hourdiff = (date('Z', TIMENOW) / 3600 - ($issue['timezoneoffset'] + ($issue['dstonoff'] ? 1 : 0))) * 3600;
        $lastpost_adjusted = max(0, $issue['lastpost'] - $hourdiff);
        $issue['lastreplydate'] = date($vbulletin->options['dateformat'], $lastpost_adjusted);
        $issue['lastreplytime'] = date($vbulletin->options['timeformat'], $lastpost_adjusted);
        $issue['title'] = unhtmlspecialchars($issue['title']);
        $issue['username'] = unhtmlspecialchars($issue['username']);
        $issue['submitusername'] = unhtmlspecialchars($issue['submitusername']);
        $issue['lastpostusername'] = unhtmlspecialchars($issue['lastpostusername']);
        $issue['newposts'] = 0;
        // get posts
        $notes = $vbulletin->db->query_read_slave("\r\n\t\t\tSELECT issuenote.*\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuenote AS issuenote\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = issuenote.userid)\r\n\t\t\tWHERE issuenote.issueid = {$issue['issueid']}\r\n\t\t\t\tAND issuenote.visible = 'visible'\r\n\t\t\t\tAND issuenote.dateline > {$lastdate}\r\n\t\t\tORDER BY issuenote.dateline\r\n\t\t");
        // compile
        $haveothers = false;
        while ($note = $vbulletin->db->fetch_array($notes)) {
            if ($note['userid'] != $issue['userid']) {
                $haveothers = true;
            }
            $issue['newposts']++;
            $dateline_adjusted = max(0, $note['dateline'] - $hourdiff);
            $note['postdate'] = date($vbulletin->options['dateformat'], $dateline_adjusted);
            $note['posttime'] = date($vbulletin->options['timeformat'], $dateline_adjusted);
            $note['username'] = unhtmlspecialchars($note['username']);
            $plaintext_parser->set_parsing_language($issue['languageid']);
            $note['message'] = $plaintext_parser->parse($note['pagetext'], 'pt');
            eval(fetch_email_phrases('pt_digestnotebit', $issue['languageid']));
            $notebits .= $message;
        }
        // Don't send an update if the subscriber is the only one who posted in the issue.
        if ($haveothers) {
            // make email
            eval(fetch_email_phrases('pt_digestissue', $issue['languageid']));
            vbmail($issue['email'], $subject, $message);
        }
    }
    unset($plaintext_parser);
    // get new projects
    $projects = $vbulletin->db->query_read_slave("\r\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\r\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\r\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\r\n\t\t\tproject.*, projecttype.issuetypeid,\r\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\r\n\t\tFROM " . TABLE_PREFIX . "pt_projecttypesubscribe AS projecttypesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_projecttype AS projecttype ON (projecttype.projectid = projecttypesubscribe.projectid AND projecttype.issuetypeid = projecttypesubscribe.issuetypeid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_project AS project ON (project.projectid = projecttypesubscribe.projectid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = projecttypesubscribe.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\r\n\t\tWHERE projecttypesubscribe.subscribetype = '{$type}'\r\n\t\t\tAND projecttype.lastpost > {$lastdate}\r\n\t\t\tAND user.usergroupid <> 3\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t");
    while ($project = $vbulletin->db->fetch_array($projects)) {
        $userinfo = array('lang_locale' => $project['lang_locale'], 'dstonoff' => $project['dstonoff'], 'timezoneoffset' => $project['timezoneoffset']);
        $newissuebits = '';
        $newissues = 0;
        $updatedissuebits = '';
        $updatedissues = 0;
        $project['username_clean'] = unhtmlspecialchars($project['username']);
        $project['title_clean'] = unhtmlspecialchars($project['title_clean']);
        $project['issuetype_plural'] = fetch_phrase("issuetype_{$project['issuetypeid']}_plural", 'projecttools', '', false, true, $project['languageid'], false);
        $issues = $vbulletin->db->query_read_slave("\r\n\t\t\tSELECT issue.*\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issue AS issue\r\n\t\t\tWHERE issue.projectid = {$project['projectid']}\r\n\t\t\t\tAND issue.issuetypeid = '{$project['issuetypeid']}'\r\n\t\t\t\tAND issue.visible = 'visible'\r\n\t\t\t\tAND issue.lastpost > {$lastdate}\r\n\t\t");
        while ($issue = $vbulletin->db->fetch_array($issues)) {
            $issueperms = fetch_project_permissions($project, $issue['projectid'], $issue['issuetypeid']);
            if (!($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canview']) or $issue['userid'] != $issue['submituserid'] and !($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canviewothers'])) {
                // can't view or can't view others' issues
                continue;
            }
            $issue['lastreplydate'] = vbdate($project['lang_dateoverride'] ? $project['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $issue['lastpost'], false, true, true, false, $userinfo);
            $issue['lastreplytime'] = vbdate($project['lang_timeoverride'] ? $project['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $issue['lastpost'], false, true, true, false, $userinfo);
            $issue['title_clean'] = unhtmlspecialchars($issue['title']);
            $issue['submitusername_clean'] = unhtmlspecialchars($issue['submitusername']);
            $issue['lastposter_clean'] = unhtmlspecialchars($issue['lastposter']);
            eval(fetch_email_phrases('pt_digestissuebit', $project['languageid']));
            if ($issue['submitdate'] > $lastdate) {
                // new issue
                $newissues++;
                $newissuebits .= $message;
            } else {
                $updatedissues++;
                $updatedissuebits .= $message;
            }
        }
        if ($newissues or $updatedissues) {
            // make email
            eval(fetch_email_phrases('pt_digestproject', $project['languageid']));
            vbmail($project['email'], $subject, $message);
        }
    }
    vbmail_end();
}