Пример #1
0
/**
* Returns process pagetext
*
* @param	string	Text to process
*
* @return	array	text and bbcode, bbcode is used by VB_API
*/
function process_toolbar_text($text, $toolbartype, $ishtml, $forumid, $allowsmilie, $parsesmilie)
{
    global $vbulletin;
    $result = array('message' => '', 'bbcode' => '');
    if (!$text) {
        return $result;
    }
    if ($toolbartype == 2 or defined('VB_API') and VB_API === true) {
        // got to parse the message to be displayed from bbcode into HTML
        if ($text !== '') {
            require_once DIR . '/includes/class_wysiwygparser.php';
            $html_parser = new vB_WysiwygHtmlParser($vbulletin);
            $result['message'] = $html_parser->parse_wysiwyg_html($text, $ishtml, $forumid, ($allowsmilie and $parsesmilie) ? 1 : 0);
        } else {
            $result['message'] = '';
        }
        $result['message'] = htmlspecialchars_uni($result['message']);
        if (defined('VB_API') and VB_API === true) {
            if ($ishtml) {
                require_once DIR . '/includes/class_wysiwygparser.php';
                $html_parser = new vB_WysiwygHtmlParser($vbulletin);
                $result['bbcode'] = $html_parser->parse_wysiwyg_html_to_bbcode($result['message']);
            } else {
                $result['bbcode'] = $result['message'];
            }
        }
    } else {
        $result['message'] = $text;
    }
    return $result;
}
Пример #2
0
     $vbulletin->input->clean_gpc('p', 'calendarid', TYPE_UINT);
     $calendarinfo = verify_id('calendar', $vbulletin->GPC['calendarid'], 0, 1);
     if ($calendarinfo) {
         $getoptions = convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS);
         $geteaster = convert_bits_to_array($calendarinfo['holidays'], $_CALENDARHOLIDAYS);
         $calendarinfo = array_merge($calendarinfo, $getoptions, $geteaster);
     }
 }
 if ($vbulletin->GPC['parsetype'] == 'announcement') {
     // oh this is a kludge but there is no simple way to changing the bbcode parser from using global $post with announcements without changing function arguments
     $post = array('announcementoptions' => $vbulletin->GPC['allowbbcode'] ? $vbulletin->bf_misc_announcementoptions['allowbbcode'] : 0);
 }
 if ($vbulletin->GPC['towysiwyg']) {
     // from standard to wysiwyg
     $html_parser = new vB_WysiwygHtmlParser($vbulletin);
     $message = process_replacement_vars($html_parser->parse_wysiwyg_html(htmlspecialchars_uni($vbulletin->GPC['message']), false, $vbulletin->GPC['parsetype'], $vbulletin->GPC['allowsmilie']));
     if (is_browser('mozilla')) {
         // Going with a list of items to check at the end of the container, one for now but other tags might need to be added
         // Otherwise we are going to have instances where a break appears when we don't want it
         $find = array('#(<hr[^>]*>)$#si');
         $replace = array('\\1<br type="_moz" />');
         $message = preg_replace($find, $replace, $message);
     }
     $xml->add_tag('message', $message);
 } else {
     // from wysiwyg to standard
     switch ($vbulletin->GPC['parsetype']) {
         case 'calendar':
             $dohtml = $calendarinfo['allowhtml'];
             break;
         case 'privatemessage':
Пример #3
0
if ($_POST['do'] == 'unquotedposts') {
    $vbulletin->input->clean_array_gpc('c', array('vbulletin_multiquote' => TYPE_STR));
    $vbulletin->input->clean_array_gpc('p', array('wysiwyg' => TYPE_BOOL, 'type' => TYPE_STR));
    $quote_postids = explode(',', $vbulletin->GPC['vbulletin_multiquote']);
    require_once DIR . '/includes/class_xml.php';
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $quote_text = fetch_quotable_posts($quote_postids, $threadinfo['threadid'], $unquoted_post_count, $quoted_post_ids, 'other', true);
    if ($vbulletin->GPC['type'] == 'deselect') {
        $remaining = array_diff($quote_postids, $quoted_post_ids);
        $xml->add_tag('mqpostids', implode(',', $remaining));
        //setcookie('vbulletin_multiquote', implode(',', $remaining), 0, '/');
    } else {
        if ($vbulletin->GPC['wysiwyg']) {
            require_once DIR . '/includes/class_wysiwygparser.php';
            $html_parser = new vB_WysiwygHtmlParser($vbulletin);
            $quote_text = $html_parser->parse_wysiwyg_html(htmlspecialchars_uni($quote_text), false, $threadinfo['forumid'], $foruminfo['allowsmilies'] ? 1 : 0);
        }
        $xml->add_tag('quotes', process_replacement_vars($quote_text));
    }
    $xml->print_xml();
}
// ############################### start post reply ###############################
if ($_POST['do'] == 'postreply') {
    // Variables reused in templates
    $posthash =& $vbulletin->input->clean_gpc('p', 'posthash', TYPE_NOHTML);
    $poststarttime =& $vbulletin->input->clean_gpc('p', 'poststarttime', TYPE_UINT);
    $vbulletin->input->clean_array_gpc('p', array('wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'quickreply' => TYPE_BOOL, 'fromquickreply' => TYPE_BOOL, 'ajaxqrfailed' => TYPE_BOOL, 'folderid' => TYPE_UINT, 'emailupdate' => TYPE_UINT, 'htmlstate' => TYPE_STR, 'subscribe' => TYPE_BOOL, 'title' => TYPE_STR, 'iconid' => TYPE_UINT, 'parseurl' => TYPE_BOOL, 'signature' => TYPE_BOOL, 'preview' => TYPE_STR, 'disablesmilies' => TYPE_BOOL, 'username' => TYPE_STR, 'rate' => TYPE_BOOL, 'rating' => TYPE_UINT, 'stickunstick' => TYPE_BOOL, 'openclose' => TYPE_BOOL, 'ajax' => TYPE_BOOL, 'ajax_lastpost' => TYPE_INT, 'loggedinuser' => TYPE_INT, 'humanverify' => TYPE_ARRAY, 'multiquoteempty' => TYPE_NOHTML, 'specifiedpost' => TYPE_BOOL, 'return_node' => TYPE_UINT));
    if ($vbulletin->GPC['loggedinuser'] != 0 and $vbulletin->userinfo['userid'] == 0) {
        // User was logged in when writing post but isn't now. If we got this
        // far, guest posts are allowed, but they didn't enter a username so
        // they'll get an error. Force them to log back in.