$bccrecipients = implode(', ', $bcclist); } } $show['recipients'] = true; } // generate navbar $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$pm['folderid']}"] = $foldernames["{$pm['folderid']}"]; $navbits[''] = $pm['title']; $templatename = 'pm_showpm'; } // ############################### start pm folder view ############################### if ($_REQUEST['do'] == 'messagelist') { $vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_INT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT)); ($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false; $folderid = $vbulletin->GPC['folderid']; $folderjump = construct_folder_jump(0, $vbulletin->GPC['folderid']); $foldername = $foldernames["{$vbulletin->GPC['folderid']}"]; // count receipts $receipts = $db->query_first_slave("\n\t\tSELECT\n\t\t\tSUM(IF(readtime <> 0, 1, 0)) AS confirmed,\n\t\t\tSUM(IF(readtime = 0, 1, 0)) AS unconfirmed\n\t\tFROM " . TABLE_PREFIX . "pmreceipt\n\t\tWHERE userid = " . $vbulletin->userinfo['userid']); // get ignored users $ignoreusers = preg_split('#\\s+#s', $vbulletin->userinfo['ignorelist'], -1, PREG_SPLIT_NO_EMPTY); $totalmessages = intval($messagecounters["{$vbulletin->GPC['folderid']}"]); // build pm counters bar, folder is 100 if we have no quota so red shows on the main bar $tdwidth = array(); $tdwidth['folder'] = $permissions['pmquota'] ? ceil($totalmessages / $permissions['pmquota'] * 100) : 100; $tdwidth['total'] = $permissions['pmquota'] ? ceil($vbulletin->userinfo['pmtotal'] / $permissions['pmquota'] * 100) - $tdwidth['folder'] : 0; $tdwidth['quota'] = 100 - $tdwidth['folder'] - $tdwidth['total']; $show['thisfoldertotal'] = iif($tdwidth['folder'], true, false); $show['allfolderstotal'] = iif($tdwidth['total'], true, false); $show['pmicons'] = iif($vbulletin->options['privallowicons'], true, false); // build navbar
$threadpms .= $postbit_obj->construct_postbit($threadpm); } } else { $threadpms = vB_Template::create('pm_nomessagehistory')->render(); } $xml->add_tag('html', process_replacement_vars($threadpms)); } $xml->close_group(); $xml->print_xml(true); } // ############################### start pm folder view ############################### if ($_REQUEST['do'] == 'messagelist') { $vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_INT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT)); ($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false; $folderid = $vbulletin->GPC['folderid']; $folderjump = construct_folder_jump(0, $vbulletin->GPC['folderid'], false, '', true); $foldername = $foldernames["{$vbulletin->GPC['folderid']}"]['name']; // count receipts $receipts = $db->query_first_slave("\n\t\tSELECT\n\t\t\tSUM(IF(readtime <> 0, 1, 0)) AS confirmed,\n\t\t\tSUM(IF(readtime = 0, 1, 0)) AS unconfirmed\n\t\tFROM " . TABLE_PREFIX . "pmreceipt\n\t\tWHERE userid = " . $vbulletin->userinfo['userid']); // get ignored users $ignoreusers = preg_split('#\\s+#s', $vbulletin->userinfo['ignorelist'], -1, PREG_SPLIT_NO_EMPTY); $totalmessages = intval($messagecounters["{$vbulletin->GPC['folderid']}"]); // build pm counters bar, folder is 100 if we have no quota so red shows on the main bar $tdwidth = array(); $tdwidth['folder'] = $permissions['pmquota'] ? ceil($totalmessages / $permissions['pmquota'] * 100) : 100; $tdwidth['folder'] = min($tdwidth['folder'], 100); $totalWidth = $permissions['pmquota'] && $vbulletin->userinfo['pmtotal'] / $permissions['pmquota'] < 1 ? $vbulletin->userinfo['pmtotal'] / $permissions['pmquota'] : 1; $tdwidth['total'] = $permissions['pmquota'] ? ceil($totalWidth * 100) - $tdwidth['folder'] : 0; $tdwidth['quota'] = 100 - $tdwidth['folder'] - $tdwidth['total']; $show['thisfoldertotal'] = iif($tdwidth['folder'], true, false); $show['allfolderstotal'] = iif($tdwidth['total'], true, false);
function do_get_subscriptions() { global $vbulletin, $db, $show, $vbphrase, $permissions, $subscribecounters; $vbulletin->options['threadpreview'] = FR_PREVIEW_LEN; if (!$vbulletin->userinfo['userid']) { json_error(ERR_NO_PERMISSION); } if (!$vbulletin->userinfo['userid'] and $_REQUEST['do'] != 'removesubscription' or $vbulletin->userinfo['userid'] and !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or $vbulletin->userinfo['usergroupid'] == 4 or !($permissions['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) { json_error(ERR_NO_PERMISSION); } $thread_data = array(); $unread_subs = 0; // vbulletin expects folderid, but we will just get them all $vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_NOHTML, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'sortfield' => TYPE_NOHTML, 'sortorder' => TYPE_NOHTML, 'previewtype' => TYPE_INT)); $previewtype = $vbulletin->GPC['previewtype']; if (!$previewtype) { $previewtype = 1; } $vbulletin->GPC['folderid'] = 'all'; // Values that are reused in templates $sortfield =& $vbulletin->GPC['sortfield']; $perpage =& $vbulletin->GPC['perpage']; $pagenumber =& $vbulletin->GPC['pagenumber']; $folderid =& $vbulletin->GPC['folderid']; if ($folderid == 'all') { $getallfolders = true; $show['allfolders'] = true; } else { $folderid = intval($folderid); } $folderselect["{$folderid}"] = 'selected="selected"'; // Build folder jump require_once DIR . '/includes/functions_misc.php'; $folders = construct_folder_jump(1, $folderid, false, '', true); $templater = vB_Template::create('subscribe_folder_jump'); $templater->register('folders', $folders); $folderjump = $templater->render(); // look at sorting options: if ($vbulletin->GPC['sortorder'] != 'asc') { $vbulletin->GPC['sortorder'] = 'desc'; $sqlsortorder = 'DESC'; $order = array('desc' => 'selected="selected"'); } else { $sqlsortorder = ''; $order = array('asc' => 'selected="selected"'); } switch ($sortfield) { case 'title': case 'lastpost': case 'replycount': case 'views': case 'postusername': $sqlsortfield = 'thread.' . $sortfield; break; default: $handled = false; if (!$handled) { $sqlsortfield = 'thread.lastpost'; $sortfield = 'lastpost'; } } $sort = array($sortfield => 'selected="selected"'); if ($getallfolders) { $totalallthreads = array_sum($subscribecounters); } else { $totalallthreads = $subscribecounters["{$folderid}"]; } // set defaults sanitize_pageresults($totalallthreads, $pagenumber, $perpage, 200, $vbulletin->options['maxthreads']); // display threads $limitlower = ($pagenumber - 1) * $perpage + 1; $limitupper = $pagenumber * $perpage; if ($limitupper > $totalallthreads) { $limitupper = $totalallthreads; if ($limitlower > $totalallthreads) { $limitlower = $totalallthreads - $perpage; } } if ($limitlower <= 0) { $limitlower = 1; } $hook_query_fields = $hook_query_joins = $hook_query_where = ''; $getthreads = $db->query_read_slave("\n\t\tSELECT thread.threadid, emailupdate, subscribethreadid, thread.forumid, thread.postuserid\n\t\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = subscribethread.threadid)\n\t\t{$hook_query_joins}\n\t\tWHERE subscribethread.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\tAND thread.visible = 1\n\t\t\tAND canview = 1\n\t\t" . iif(!$getallfolders, "\tAND folderid = {$folderid}") . "\n\t\t\t{$hook_query_where}\n\t\tORDER BY {$sqlsortfield} {$sqlsortorder}\n\t\tLIMIT " . ($limitlower - 1) . ", {$perpage}\n\t"); if ($totalthreads = $db->num_rows($getthreads)) { $forumids = array(); $threadids = array(); $emailupdate = array(); $killthreads = array(); while ($getthread = $db->fetch_array($getthreads)) { $forumperms = fetch_permissions($getthread['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or $getthread['postuserid'] != $vbulletin->userinfo['userid'] and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) { $killthreads["{$getthread['subscribethreadid']}"] = $getthread['subscribethreadid']; $totalallthreads--; continue; } $forumids["{$getthread['forumid']}"] = true; $threadids[] = $getthread['threadid']; $emailupdate["{$getthread['threadid']}"] = $getthread['emailupdate']; $subscribethread["{$getthread['threadid']}"] = $getthread['subscribethreadid']; } $threadids = implode(',', $threadids); } unset($getthread); $db->free_result($getthreads); if (!empty($killthreads)) { // Update thread subscriptions $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "subscribethread\n\t\t\tSET canview = 0\n\t\t\tWHERE subscribethreadid IN (" . implode(', ', $killthreads) . ")\n\t\t"); } if (!empty($threadids)) { cache_ordered_forums(1); $colspan = 5; $show['threadicons'] = false; // get last read info for each thread $lastread = array(); foreach (array_keys($forumids) as $forumid) { if ($vbulletin->options['threadmarking']) { $lastread["{$forumid}"] = max($vbulletin->forumcache["{$forumid}"]['forumread'], TIMENOW - $vbulletin->options['markinglimit'] * 86400); } else { $lastread["{$forumid}"] = max(intval(fetch_bbarray_cookie('forum_view', $forumid)), $vbulletin->userinfo['lastvisit']); } if ($vbulletin->forumcache["{$forumid}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons']) { $show['threadicons'] = true; $colspan = 6; } } if ($previewtype == 1) { $previewfield = "post.pagetext AS preview, post.username AS lastpost_username, post.userid AS lastpost_userid,"; $previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)"; } else { $previewfield = "post.pagetext AS preview, post.username AS lastpost_username, post.userid AS lastpost_userid,"; $previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.lastpostid)"; } $hasthreads = true; $threadbits = ''; $pagenav = ''; $counter = 0; $toread = 0; $vbulletin->options['showvotes'] = intval($vbulletin->options['showvotes']); if ($vbulletin->userinfo['userid'] and in_coventry($vbulletin->userinfo['userid'], true)) { $lastpost_info = "IF(tachythreadpost.userid IS NULL, thread.lastpost, tachythreadpost.lastpost) AS lastpost, " . "IF(tachythreadpost.userid IS NULL, thread.lastposter, tachythreadpost.lastposter) AS lastposter, " . "IF(tachythreadpost.userid IS NULL, thread.lastposterid, tachythreadpost.lastposterid) AS lastposterid, " . "IF(tachythreadpost.userid IS NULL, thread.lastpostid, tachythreadpost.lastpostid) AS lastpostid"; $tachyjoin = "LEFT JOIN " . TABLE_PREFIX . "tachythreadpost AS tachythreadpost ON " . "(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " . $vbulletin->userinfo['userid'] . ')'; } else { $lastpost_info = 'thread.lastpost, thread.lastposter, thread.lastposterid, thread.lastpostid'; $tachyjoin = ''; } $hook_query_fields = $hook_query_joins = $hook_query_where = ''; $threads = $db->query_read_slave("\n\t\t\tSELECT\n\t\t\t\tIF(thread.votenum >= " . $vbulletin->options['showvotes'] . ", thread.votenum, 0) AS votenum,\n\t\t\t\tIF(thread.votenum >= " . $vbulletin->options['showvotes'] . " AND thread.votenum > 0, thread.votetotal / thread.votenum, 0) AS voteavg,\n\t\t\t\tthread.votetotal,\n\t\t\t\t{$previewfield} thread.threadid, thread.title AS threadtitle, thread.forumid, thread.pollid,\n\t\t\t\tthread.open, thread.replycount, thread.postusername, thread.prefixid,\n\t\t\t\t{$lastpost_info}, thread.postuserid, thread.dateline, thread.views, thread.iconid AS threadiconid,\n\t\t\t\tthread.notes, thread.visible, thread.attach, thread.taglist\n\t\t\t\t" . ($vbulletin->options['threadmarking'] ? ", threadread.readtime AS threadread" : '') . "\n\t\t\t\t{$hook_query_fields}\n\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t{$previewjoin}\n\t\t\t" . ($vbulletin->options['threadmarking'] ? " LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")" : '') . "\n\t\t\t{$tachyjoin}\n\t\t\t{$hook_query_joins}\n\t\t\tWHERE thread.threadid IN ({$threadids})\n\t\t\tORDER BY {$sqlsortfield} {$sqlsortorder}\n\t\t"); unset($sqlsortfield, $sqlsortorder); require_once DIR . '/includes/functions_forumdisplay.php'; // Get Dot Threads $dotthreads = fetch_dot_threads_array($threadids); if ($vbulletin->options['showdots'] and $vbulletin->userinfo['userid']) { $show['dotthreads'] = true; } else { $show['dotthreads'] = false; } if ($vbulletin->options['threadpreview'] and $vbulletin->userinfo['ignorelist']) { // Get Buddy List $buddy = array(); if (trim($vbulletin->userinfo['buddylist'])) { $buddylist = preg_split('/( )+/', trim($vbulletin->userinfo['buddylist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($buddylist as $buddyuserid) { $buddy["{$buddyuserid}"] = 1; } } DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy))); // Get Ignore Users $ignore = array(); if (trim($vbulletin->userinfo['ignorelist'])) { $ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($ignorelist as $ignoreuserid) { if (!$buddy["{$ignoreuserid}"]) { $ignore["{$ignoreuserid}"] = 1; } } } DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore))); } $foruminfo['allowratings'] = true; $show['notificationtype'] = true; $show['threadratings'] = true; $show['threadrating'] = true; while ($thread = $db->fetch_array($threads)) { $threadid = $thread['threadid']; // build thread data $thread = process_thread_array($thread, $lastread["{$thread['forumid']}"]); switch ($emailupdate["{$thread['threadid']}"]) { case 0: $thread['notification'] = $vbphrase['none']; break; case 1: $thread['notification'] = $vbphrase['instant']; break; case 2: $thread['notification'] = $vbphrase['daily']; break; case 3: $thread['notification'] = $vbphrase['weekly']; break; default: $thread['notification'] = $vbphrase['n_a']; } $avatarurl = ''; if ($thread['lastpost_userid'] > 0) { $userinfoavatar = fetch_userinfo($thread['lastpost_userid'], FETCH_USERINFO_AVATAR); fetch_avatar_from_userinfo($userinfoavatar, true, false); if ($userinfoavatar['avatarurl'] != '') { $avatarurl = process_avatarurl($userinfoavatar['avatarurl']); } unset($userinfoavatar); } $tmp = array('thread_id' => $thread['threadid'], 'new_posts' => $show['gotonewpost'] ? true : false, 'forum_id' => $thread['forumid'], 'total_posts' => $thread['totalposts'] ? $thread['totalposts'] : 0, 'forum_title' => prepare_utf8_string($thread['forumtitle']), 'thread_title' => prepare_utf8_string($thread['threadtitle']), 'thread_preview' => prepare_utf8_string(preview_chop(html_entity_decode($thread['preview']), FR_PREVIEW_LEN)), 'post_userid' => $thread['lastpost_userid'], 'post_lastposttime' => prepare_utf8_string(date_trunc($thread['lastpostdate']) . ' ' . $thread['lastposttime']), 'post_username' => prepare_utf8_string(strip_tags($thread['lastpost_username']))); if ($avatarurl != '') { $tmp['avatarurl'] = $avatarurl; } if ($thread['attach']) { $tmp['attach'] = true; } if ($thread['pollid']) { $tmp['poll'] = true; } $thread_data[] = $tmp; } $db->free_result($threads); unset($threadids); } else { $totalallthreads = 0; } $out = array('threads' => $thread_data, 'total_threads' => $totalallthreads); return $out; }
case 'move': $ids = array(); foreach ($deletebox as $id) { $id = intval($id); $ids["{$id}"] = $id; } $numthreads = sizeof($ids); $ids = sign_client_string(serialize($ids)); unset($id, $deletebox); require_once DIR . '/includes/functions_misc.php'; if ($vbulletin->GPC['folderid'] === 'all') { $exclusions = false; } else { $exclusions = array($vbulletin->GPC['folderid'], -1); } $folderoptions = construct_folder_jump(1, 0, $exclusions); ($hook = vBulletinHook::fetch_hook('usersub_manage_move')) ? eval($hook) : false; if ($folderoptions) { if ($vbulletin->GPC['folderid'] === 'all') { $fromfolder = $vbphrase['all']; } else { $folders = unserialize($vbulletin->userinfo['subfolders']); $fromfolder = $folders["{$vbulletin->GPC['folderid']}"]; } // build the cp nav construct_usercp_nav('substhreads_listthreads'); $navbits[''] = $vbphrase['subscriptions']; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); $folderid =& $vbulletin->GPC['folderid']; eval('$HTML = "' . fetch_template('subscribe_move') . '";');
if ($edit['emailupdate'] !== NULL) { $folderselect["{$edit['folderid']}"] = 'selected="selected"'; $emailchecked["{$edit['emailupdate']}"] = 'selected="selected"'; } else { if ($threadinfo['issubscribed']) { $folderselect["{$threadinfo['folderid']}"] = 'selected="selected"'; } else { $folderselect[0] = 'selected="selected"'; } // get the checked option for auto subscription $emailchecked = fetch_emailchecked($threadinfo); } // Don't show the folderjump if we only have one folder, would be redundant ;) if (sizeof($folders) > 1) { require_once DIR . '/includes/functions_misc.php'; $folderbits = construct_folder_jump(1, $threadinfo['folderid'], false, $folders); $show['subscriptionfolders'] = true; } if ($previewpost or $vbulletin->GPC['advanced']) { $newpost['reason'] = $edit['reason']; } else { if ($vbulletin->userinfo['userid'] == $postinfo['edit_userid']) { // Only carry the reason over if the editing user owns the previous edit $newpost['reason'] = $postinfo['edit_reason']; } } $postinfo['postdate'] = vbdate($vbulletin->options['dateformat'], $postinfo['dateline']); $postinfo['posttime'] = vbdate($vbulletin->options['timeformat'], $postinfo['dateline']); // find out if first post $getpost = $db->query_first("\n\t\tSELECT postid\n\t\tFROM " . TABLE_PREFIX . "post\n\t\tWHERE threadid = {$threadinfo['threadid']}\n\t\tORDER BY dateline\n\t\tLIMIT 1\n\t"); if ($getpost['postid'] == $postinfo['postid']) {
} if (!isset($checked['postpoll'])) { $checked['postpoll'] = ''; } if (!isset($newpost['polloptions'])) { $polloptions = 4; } else { $polloptions = $newpost['polloptions']; } // Get subscribed thread folders $newpost['folderid'] = iif($newpost['folderid'], $newpost['folderid'], 0); $folders = unserialize($vbulletin->userinfo['subfolders']); // Don't show the folderjump if we only have one folder, would be redundant ;) if (sizeof($folders) > 1) { require_once DIR . '/includes/functions_misc.php'; $folderbits = construct_folder_jump(1, $newpost['folderid'], false, $folders); } $show['subscribefolders'] = iif(!empty($folderbits), true, false); // get the checked option for auto subscription $emailchecked = fetch_emailchecked($threadinfo, $vbulletin->userinfo, $newpost); if ($emailchecked['9999']) { $emailchecked['0'] = $emailchecked['9999']; unset($emailchecked['9999']); $checked['subscribe'] = ''; } else { $checked['subscribe'] = 'checked="checked"'; } if ($foruminfo['allowhtml']) { if (!isset($htmlchecked)) { $htmlchecked = array('on_nl2br' => 'selected="selected"'); }
if ($threadinfo['issubscribed']) { $folderid = $threadinfo['folderid']; } else { $folderid = 0; } } $folders = unserialize($vbulletin->userinfo['subfolders']); // Don't show the folderjump if we only have one folder, would be redundant ;) if (sizeof($folders) > 1) { require_once(DIR . '/includes/functions_misc.php'); $folderbits = construct_folder_jump(1, $folderid, false, $folders); } $show['subscribefolders'] = iif(!empty($folderbits), true, false); // get the checked option for auto subscription $emailchecked = fetch_emailchecked($threadinfo, $vbulletin->userinfo, $newpost); if ($emailchecked['9999']) { $emailchecked['0'] = $emailchecked['9999']; unset($emailchecked['9999']); $checked['subscribe'] = ''; } else { $checked['subscribe'] = 'checked="checked"'; }
function do_get_pm() { global $vbulletin, $db; require_once DIR . '/includes/class_postbit.php'; require_once DIR . '/includes/functions_bigthree.php'; $vbulletin->input->clean_array_gpc('r', array('pmid' => TYPE_UINT, 'showhistory' => TYPE_BOOL)); ($hook = vBulletinHook::fetch_hook('private_showpm_start')) ? eval($hook) : false; $pm = $db->query_first_slave("\n\t\tSELECT\n\t\t\tpm.*, pmtext.*,\n\t\t\t" . iif($vbulletin->options['privallowicons'], "icon.title AS icontitle, icon.iconpath,") . "\n\t\t\tIF(ISNULL(pmreceipt.pmid), 0, 1) AS receipt, pmreceipt.readtime, pmreceipt.denied,\n\t\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight\n\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)\n\t\t" . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "pmreceipt AS pmreceipt ON(pmreceipt.pmid = pm.pmid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = pmtext.fromuserid)\n\t\tWHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . "\n\t"); if (!$pm) { json_error(strip_tags(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } $folderjump = construct_folder_jump(0, $pm['folderid']); // do read receipt $show['receiptprompt'] = $show['receiptpopup'] = false; if ($pm['receipt'] == 1 and $pm['readtime'] == 0 and $pm['denied'] == 0) { if ($permissions['pmpermissions'] & $vbulletin->bf_ugp_pmpermissions['candenypmreceipts']) { // set it to denied just now as some people might have ad blocking that stops the popup appearing $show['receiptprompt'] = $show['receiptpopup'] = true; $receipt_question_js = addslashes_js(construct_phrase($vbphrase['x_has_requested_a_read_receipt'], unhtmlspecialchars($pm['fromusername'])), '"'); $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET denied = 1 WHERE pmid = {$pm['pmid']}"); } else { // they can't deny pm receipts so do not show a popup or prompt $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET readtime = " . TIMENOW . " WHERE pmid = {$pm['pmid']}"); } } else { if ($pm['receipt'] == 1 and $pm['denied'] == 1) { $show['receiptprompt'] = true; } } $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm'); $pm_postbit = $pm; $postbit = $postbit_obj->construct_postbit($pm_postbit); // update message to show read if ($pm['messageread'] == 0) { $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pm SET messageread=1 WHERE userid=" . $vbulletin->userinfo['userid'] . " AND pmid={$pm['pmid']}"); if ($pm['folderid'] >= 0) { $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdm->set_existing($vbulletin->userinfo); $userdm->set('pmunread', 'IF(pmunread >= 1, pmunread - 1, 0)', false); $userdm->save(true, true); unset($userdm); } } $cclist = array(); $bcclist = array(); $ccrecipients = ''; $bccrecipients = ''; $touser = unserialize($pm['touserarray']); if (!is_array($touser)) { $touser = array(); } foreach ($touser as $key => $item) { if (is_array($item)) { foreach ($item as $subkey => $subitem) { $userinfo = array('userid' => $subkey, 'username' => $subitem); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); ${$key . 'list'}[] = $templater->render(); } } else { $userinfo = array('username' => $item, 'userid' => $key); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); $bcclist[] = $templater->render(); } } if (count($cclist) > 1 or is_array($touser['cc']) and !in_array($vbulletin->userinfo['username'], $touser['cc']) or $vbulletin->userinfo['userid'] == $pm['fromuserid'] and $pm['folderid'] == -1) { if (!empty($cclist)) { $ccrecipients = implode("\r\n", $cclist); } if (!empty($bcclist) and $vbulletin->userinfo['userid'] == $pm['fromuserid'] and $pm['folderid'] == -1) { if (empty($cclist) and count($bcclist == 1)) { $ccrecipients = implode("\r\n", $bcclist); } else { $bccrecipients = implode("\r\n", $bcclist); } } $show['recipients'] = true; } $pm['senddate'] = vbdate($vbulletin->options['dateformat'], $pm['dateline']); $pm['sendtime'] = vbdate($vbulletin->options['timeformat'], $pm['dateline']); list($text, $nuked_quotes, $images) = parse_post($pm['message'], $vbulletin->options['privallowsmilies'] && $usesmiles); $fr_images = array(); foreach ($images as $image) { $fr_images[] = array('img' => $image); } // Avatar work $avatarurl = ''; if ($pm_postbit['avatarurl']) { $avatarurl = process_avatarurl($pm_postbit['avatarurl']); } $to_users = unserialize($pm['touserarray']); $users = array(); if ($to_users !== false) { if ($to_users['cc']) { $users = $to_users['cc']; } else { $users = $to_users; } } $out = array('id' => $pm['pmid'], 'pm_unread' => $pm['messageread'] == 0, 'username' => prepare_utf8_string(strip_tags($pm['fromusername'])), 'to_usernames' => prepare_utf8_string(implode('; ', $users)), 'userid' => $pm['fromuserid'], 'title' => prepare_utf8_string($pm['title']), 'online' => fetch_online_status(fetch_userinfo($pm['fromuserid']), false), 'message' => $text, 'quotable' => $nuked_quotes, 'fr_images' => $fr_images, 'pm_timestamp' => prepare_utf8_string(date_trunc($pm['senddate'] . ' ' . $pm['sendtime']))); if ($avatarurl != '') { $out['avatarurl'] = $avatarurl; } return $out; }