Beispiel #1
0
/**
* Creates new thread or gives error and then redirects user
*
* @param	string	Title of thread
* @param	string	Message of post
* @param	integer ForumID for thread
* @param	boolean Allow guest posts
*/
function create_new_thread($title = 'Defauglt Title', $message = 'Defagult Message', $id = 3, $guest = false)
{
    // set some globals
    global $forumperms, $vbulletin, $vbphrase;
    // init some variables
    $fail = 0;
    $errors = array();
    $newpost = array();
    // init post information
    if ($guest and $vbulletin->userinfo['userid'] == 0) {
        $newpost['username'] = $vbphrase['guest'];
    }
    $newpost['title'] = $title;
    $newpost['message'] = $message;
    $newpost['signature'] = '0';
    if ($vbulletin->userinfo['signature'] != '') {
        $newpost['signature'] = '1';
    }
    $newpost['parseurl'] = '1';
    $newpost['emailupdate'] = '9999';
    // attempt thread create
    $foruminfo = verify_id('forum', $id, 0, 1);
    if (!$foruminfo['forumid']) {
        $fail = 1;
    }
    $forumperms = fetch_permissions($foruminfo['forumid']);
    if (!function_exists('build_new_post')) {
        require_once DIR . '/includes/functions_newpost.php';
    }
    build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);
    if (sizeof($errors) > 0) {
        $fail = 1;
    }
    // do redirection
    if (!$fail) {
        $vbulletin->url = $vbulletin->options['bburl'] . '/showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=" . $newpost['postid'] . "#post" . $newpost['postid'];
        eval(print_standard_redirect('redirect_postthanks'));
    } else {
        $vbulletin->url = $vbulletin->options['bburl'];
        eval(print_standard_redirect($vbphrase['error'] . ': ' . $vbphrase['redirecting'], 0, 1));
    }
}
Beispiel #2
0
     $newpost['htmlstate'] = array_pop($array = array_keys(fetch_htmlchecked($vbulletin->GPC['htmlstate'])));
 } else {
     $newpost['htmlstate'] = 'on_nl2br';
 }
 if ($vbulletin->GPC_exists['emailupdate']) {
     $newpost['emailupdate'] =& $vbulletin->GPC['emailupdate'];
 } else {
     $newpost['emailupdate'] = array_pop($array = array_keys(fetch_emailchecked(array(), $vbulletin->userinfo)));
 }
 if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
     $newpost['emailupdate'] = 0;
 }
 if (!$vbulletin->GPC['subscribe']) {
     $newpost['emailupdate'] = 9999;
 }
 build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);
 if (sizeof($errors) > 0) {
     // ### POST HAS ERRORS ###
     $postpreview = construct_errors($errors);
     // this will take the preview's place
     construct_checkboxes($newpost);
     $_REQUEST['do'] = 'newthread';
     $newpost['message'] = htmlspecialchars_uni($newpost['message']);
     $podcasturl = htmlspecialchars_uni($newpost['podcasturl']);
     $podcastsize = $newpost['podcastsize'] ? $newpost['podcastsize'] : '';
     $podcastkeywords = htmlspecialchars_uni($newpost['podcastkeywords']);
     $podcastsubtitle = htmlspecialchars_uni($newpost['podcastsubtitle']);
     $podcastauthor = htmlspecialchars_uni($newpost['podcastauthor']);
     $explicitchecked = $newpost['podcastexplicit'] ? 'checked="checked"' : '';
 } else {
     if ($newpost['preview']) {
Beispiel #3
0
         $threadman->save();
     }
 }
 if ($vbulletin->options['award_request_formreplythreadid'] > 0) {
     $threadinfo = verify_id('thread', $vbulletin->options['award_request_formreplythreadid'], 0, 1);
     $forumperms = fetch_permissions($threadinfo[forumid]);
     $newpost['message'] =& $formsend;
     $newpost['title'] =& $posttitle;
     $newpost['parseurl'] = "1";
     $newpost['emailupdate'] = '9999';
     if ($vbulletin->userinfo['signature'] != '') {
         $newpost['signature'] = '1';
     } else {
         $newpost['signature'] = '0';
     }
     build_new_post('reply', $foruminfo, $threadinfo, $postinfo, $newpost, $errors);
     $award_send += 2;
 }
 if (!empty($vbulletin->options['award_request_formpmname'])) {
     $vbulletin->GPC['message'] =& $formsend;
     $vbulletin->GPC['title'] =& $posttitle;
     $vbulletin->GPC['recipients'] =& $vbulletin->options['award_request_formpmname'];
     $pm['message'] =& $vbulletin->GPC['message'];
     $pm['title'] =& $vbulletin->GPC['title'];
     $pm['recipients'] =& $vbulletin->GPC['recipients'];
     // create the DM to do error checking and insert the new PM
     $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
     $pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
     $pmdm->set('fromusername', $vbulletin->userinfo['username']);
     $pmdm->setr('title', $pm['title']);
     $pmdm->setr('message', $pm['message']);