define('PMPREVIEW', 1); $preview = construct_errors($errors); // this will take the preview's place $_REQUEST['do'] = 'newpm'; } else { if ($vbulletin->GPC['preview'] != '') { define('PMPREVIEW', 1); $foruminfo = array('forumid' => 'privatemessage', 'allowicons' => $vbulletin->options['privallowicons']); $preview = process_post_preview($pm); $_REQUEST['do'] = 'newpm'; } else { // everything's good! $pmdm->save(); // force pm counters to be rebuilt $vbulletin->userinfo['pmunread'] = -1; build_pm_counters(); ($hook = vBulletinHook::fetch_hook('private_insertpm_complete')) ? eval($hook) : false; $vbulletin->url = 'private.php' . $vbulletin->session->vars['sessionurl_q']; eval(print_standard_redirect('pm_messagesent')); } } } // ############################### start new pm ############################### // form for creating a new private message if ($_REQUEST['do'] == 'newpm') { if ($permissions['pmquota'] < 1) { print_no_permission(); } else { if (!$vbulletin->userinfo['receivepm']) { eval(standard_error(fetch_error('pm_turnedoff'))); }
function do_delete_pm() { global $vbulletin, $db; $vbulletin->input->clean_array_gpc('r', array('pm' => TYPE_UINT)); // get selected via post $messageids = array(); $messageids[$vbulletin->GPC['pm']] = $vbulletin->GPC['pm']; $pmids = array(); $textids = array(); // get the pmid and pmtext id of messages to be deleted $pms = $db->query_read_slave("\n\tSELECT pmid\n\tFROM " . TABLE_PREFIX . "pm\n\tWHERE userid = " . $vbulletin->userinfo['userid'] . "\n\tAND pmid IN(" . implode(', ', $messageids) . ")\n\t"); // check to see that we still have some ids to work with if ($db->num_rows($pms) == 0) { json_error(ERR_INVALID_PM, RV_POST_ERROR); } // build the final array of pmids to work with while ($pm = $db->fetch_array($pms)) { $pmids[] = $pm['pmid']; } // delete from the pm table using the results from above $deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN(" . implode(', ', $pmids) . ")"; $db->query_write($deletePmSql); build_pm_counters(); return array('success' => 1); }