Exemple #1
0
        $reportobj->do_report($vbulletin->GPC['reason'], $commentinfo);
        $url =& $vbulletin->url;
        print_standard_redirect('redirect_reportthanks');
    }
}
if ($_POST['do'] == 'quickedit') {
    if ($commentinfo and !fetch_user_picture_message_perm('caneditmessages', $pictureinfo, $commentinfo)) {
        print_no_permission();
    } else {
        if (!$commentinfo and !$canpostmessage) {
            print_no_permission();
        }
    }
    $vbulletin->input->clean_array_gpc('p', array('editorid' => TYPE_NOHTML));
    require_once DIR . '/includes/class_xml.php';
    require_once DIR . '/includes/functions_editor.php';
    $editorid = construct_edit_toolbar(htmlspecialchars_uni($commentinfo['pagetext']), false, 'picturecomment', true, true, false, 'qe', $vbulletin->GPC['editorid'], array(), 'content', 'vBForum_PictureComment', $commentinfo['commentid']);
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_group('quickedit');
    $xml->add_tag('editor', process_replacement_vars($messagearea), array('reason' => '', 'parsetype' => 'picturecomment', 'parsesmilies' => true, 'mode' => $show['is_wysiwyg_editor']));
    $xml->add_tag('ckeconfig', vB_Ckeditor::getInstance($editorid)->getConfig());
    $xml->close_group();
    $xml->print_xml();
}
($hook = vBulletinHook::fetch_hook('picture_comment_complete')) ? eval($hook) : false;
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 03:13, Sat Sep 7th 2013
|| # CVS: $RCSfile$ - $Revision: 63231 $
|| ####################################################################
\*======================================================================*/
Exemple #2
0
$templater->register('template_hook', $template_hook);
$templater->register('thread', $thread);
$templater->register('threadadmin_imod_menu_post', $threadadmin_imod_menu_post);
$templater->register('threadid', $threadid);
$templater->register('threadinfo', $threadinfo);
$templater->register('threadlist', $threadlist);
$templater->register('totalonline', $totalonline);
$templater->register('url', $url);
$templater->register('thread_url', $thread_url);
$templater->register('votechecked', $votechecked);
$templater->register('voteselected', $voteselected);
$templater->register('fbpublishcheckbox', $fbpublishcheckbox);
$templater->register('fblikebutton', $fblikebutton);
if ($show['quickedit'] and !$show['quickreply']) {
    $templater->register('editor_clientscript', vB_Template::create('editor_clientscript')->render());
    $templater->register('editor_js', vB_Ckeditor::getJsIncludes());
}
$templater->register('wrt', $wrt);
$templater->register('wrtlist', $wrtlist);
print_output($templater->render());
function goto_prevthread($threadid, $throwerror = true)
{
    global $vbulletin;
    $thread = verify_id('thread', $threadid, $throwerror, 1);
    $forumperms = fetch_permissions($thread['forumid']);
    // remove threads from users on the global ignore list if user is not a moderator
    if ($coventry = fetch_coventry('string') and !can_moderate($thread['forumid'])) {
        $globalignore = "AND postuserid NOT IN ({$coventry})";
    } else {
        $globalignore = '';
    }
Exemple #3
0
/**
* Prepares the templates for a message editor
*
* @param	string	The text to be initially loaded into the editor
* @param	boolean	Is the initial text HTML (rather than plain text or bbcode)?
* @param	mixed	Forum ID of the forum into which we are posting. Special rules apply for values of 'privatemessage', 'usernote', 'calendar', 'announcement' and 'nonforum'.
* @param	boolean	Allow smilies?
* @param	boolean	Parse smilies in the text of the message?
* @param	boolean	Allow attachments?
* @param	string	Editor type - either 'fe' for full editor or 'qr' for quick reply
* @param	string	Force the editor to use the specified value as its editorid, rather than making one up
* @param	array	Information for the image popup
* @param	array	Content type handled by this editor, used to set specific CSS
* @param	string	String value of this content type, e.g. vBForum_Post
* @param	int		Contentid of this item, if it exists already
* @param	int		Parent contentid of this item
* @param	bool	Is this a preview text? Don't autoload if it is
* @param	bool	Don't autoload, regardless ..
* @param	string	Autoload title..
* @param	string	HTML id of title field
*
* @return	string	Editor ID
*/
function construct_edit_toolbar($text = '', $ishtml = false, $forumid = 0, $allowsmilie = true, $parsesmilie = true, $can_attach = false, $editor_type = 'fe', $force_editorid = '', $attachinfo = array(), $content = 'content', $contenttypeid = '', $contentid = 0, $parentcontentid = 0, $preview = false, $autoload = true, $autoloadtitleid = '')
{
    // standard stuff
    global $vbulletin, $vbphrase, $show;
    // templates generated by this function
    global $messagearea, $smiliebox, $disablesmiliesoption, $checked, $vBeditTemplate;
    // counter for editorid
    static $editorcount = 0;
    // determine what we can use
    // this was moved up here as I need the switch to determine if bbcode is enabled
    // to determine if a toolbar is usable
    if ($forumid == 'signature') {
        $sig_perms =& $vbulletin->userinfo['permissions']['signaturepermissions'];
        $sig_perms_bits =& $vbulletin->bf_ugp_signaturepermissions;
        $can_toolbar = $sig_perms & $sig_perms_bits['canbbcode'] ? true : false;
        $show['img_bbcode'] = $sig_perms & $sig_perms_bits['allowimg'] ? true : false;
        $show['video_bbcode'] = $sig_perms & $sig_perms_bits['allowvideo'] ? true : false;
        $show['font_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodefont'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_FONT) ? true : false;
        $show['size_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodesize'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_SIZE) ? true : false;
        $show['color_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodecolor'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_COLOR) ? true : false;
        $show['basic_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodebasic'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_BASIC) ? true : false;
        $show['align_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodealign'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_ALIGN) ? true : false;
        $show['list_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodelist'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_LIST) ? true : false;
        $show['code_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodecode'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE) ? true : false;
        $show['html_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodehtml'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_HTML) ? true : false;
        $show['php_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodephp'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_PHP) ? true : false;
        $show['url_bbcode'] = ($sig_perms & $sig_perms_bits['canbbcodelink'] and $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL) ? true : false;
        $show['quote_bbcode'] = $sig_perms & $sig_perms_bits['canbbcodequote'] ? true : false;
    } else {
        require_once DIR . '/includes/class_bbcode.php';
        $show['font_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_FONT ? true : false;
        $show['size_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_SIZE ? true : false;
        $show['color_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_COLOR ? true : false;
        $show['basic_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_BASIC ? true : false;
        $show['align_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_ALIGN ? true : false;
        $show['list_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_LIST ? true : false;
        $show['code_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE ? true : false;
        $show['html_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_HTML ? true : false;
        $show['php_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_PHP ? true : false;
        $show['url_bbcode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL ? true : false;
        $show['quote_bbcode'] = true;
        // can't disable this anywhere but in sigs
    }
    $ajax_extra = array();
    $show['custom_bbcode'] = $allow_custom_bbcode = true;
    if (empty($forumid)) {
        $forumid = 'nonforum';
    }
    switch ($forumid) {
        case 'privatemessage':
            $can_toolbar = $vbulletin->options['privallowbbcode'];
            $show['img_bbcode'] = $vbulletin->options['privallowbbimagecode'];
            $show['video_bbcode'] = $vbulletin->options['privallowbbvideocode'];
            break;
        case 'usernote':
            $can_toolbar = $vbulletin->options['unallowvbcode'];
            $show['img_bbcode'] = $vbulletin->options['unallowimg'];
            $show['video_bbcode'] = $vbulletin->options['unallowvideo'];
            break;
        case 'calendar':
            global $calendarinfo;
            $can_toolbar = $calendarinfo['allowbbcode'];
            $show['img_bbcode'] = $calendarinfo['allowimgcode'];
            $show['video_bbcode'] = $calendarinfo['allowvideocode'];
            $ajax_extra['calendarid'] = $calendarinfo['calendarid'];
            break;
        case 'announcement':
            $can_toolbar = true;
            $show['img_bbcode'] = true;
            $show['video_bbcode'] = true;
            break;
        case 'signature':
            // see above -- these are handled earlier
            break;
        case 'visitormessage':
        case 'groupmessage':
        case 'picturecomment':
            switch ($forumid) {
                case 'groupmessage':
                    $allowedoption = $vbulletin->options['sg_allowed_bbcode'];
                    break;
                case 'picturecomment':
                    $allowedoption = $vbulletin->options['pc_allowed_bbcode'];
                    break;
                default:
                    $allowedoption = $vbulletin->options['vm_allowed_bbcode'];
                    break;
            }
            $show['font_bbcode'] = ($show['font_bbcode'] and $allowedoption & ALLOW_BBCODE_FONT) ? true : false;
            $show['size_bbcode'] = ($show['size_bbcode'] and $allowedoption & ALLOW_BBCODE_SIZE) ? true : false;
            $show['color_bbcode'] = ($show['color_bbcode'] and $allowedoption & ALLOW_BBCODE_COLOR) ? true : false;
            $show['basic_bbcode'] = ($show['basic_bbcode'] and $allowedoption & ALLOW_BBCODE_BASIC) ? true : false;
            $show['align_bbcode'] = ($show['align_bbcode'] and $allowedoption & ALLOW_BBCODE_ALIGN) ? true : false;
            $show['list_bbcode'] = ($show['list_bbcode'] and $allowedoption & ALLOW_BBCODE_LIST) ? true : false;
            $show['code_bbcode'] = ($show['code_bbcode'] and $allowedoption & ALLOW_BBCODE_CODE) ? true : false;
            $show['html_bbcode'] = ($show['html_bbcode'] and $allowedoption & ALLOW_BBCODE_HTML) ? true : false;
            $show['php_bbcode'] = ($show['php_bbcode'] and $allowedoption & ALLOW_BBCODE_PHP) ? true : false;
            $show['url_bbcode'] = ($show['url_bbcode'] and $allowedoption & ALLOW_BBCODE_URL) ? true : false;
            $show['quote_bbcode'] = ($show['quote_bbcode'] and $allowedoption & ALLOW_BBCODE_QUOTE) ? true : false;
            $show['img_bbcode'] = $allowedoption & ALLOW_BBCODE_IMG ? true : false;
            $show['video_bbcode'] = $allowedoption & ALLOW_BBCODE_VIDEO ? true : false;
            $can_toolbar = ($show['font_bbcode'] or $show['size_bbcode'] or $show['color_bbcode'] or $show['basic_bbcode'] or $show['align_bbcode'] or $show['list_bbcode'] or $show['code_bbcode'] or $show['html_bbcode'] or $show['php_bbcode'] or $show['url_bbcode'] or $show['quote_bbcode'] or $show['img_bbcode'] or $show['video_bbcode']);
            $show['custom_bbcode'] = $allow_custom_bbcode = $allowedoption & ALLOW_BBCODE_CUSTOM ? true : false;
            break;
        case 'nonforum':
            $can_toolbar = $vbulletin->options['allowbbcode'];
            $show['img_bbcode'] = $vbulletin->options['allowbbimagecode'];
            $show['video_bbcode'] = $vbulletin->options['allowbbvideocode'];
            break;
        case 'article_comment':
            // Right here there should be comment specific settings ... but wait, when you edit the comment, you actually
            // go through the post editor so that would be different settings .. confused?
        // Right here there should be comment specific settings ... but wait, when you edit the comment, you actually
        // go through the post editor so that would be different settings .. confused?
        case 'article':
            // Cms always defaults $can_toolbar and $show['img_bbcode'] and $show['video_bbcode'] to true.. uh..
            if ($vbulletin->options['vbcmsforumid'] > 0) {
                $forum = fetch_foruminfo($vbulletin->options['vbcmsforumid']);
                $can_toolbar = $forum['allowbbcode'];
                $show['img_bbcode'] = $forum['allowimages'];
                $show['video_bbcode'] = $forum['allowvideos'];
            } else {
                $can_toolbar = $show['img_bbcode'] = $show['video_bbcode'] = true;
            }
            break;
        default:
            if (intval($forumid)) {
                $forum = fetch_foruminfo($forumid);
                $can_toolbar = $forum['allowbbcode'];
                $show['img_bbcode'] = $forum['allowimages'];
                $show['video_bbcode'] = $forum['allowvideos'];
            } else {
                $can_toolbar = false;
                $show['img_bbcode'] = false;
                $show['video_bbcode'] = false;
            }
            ($hook = vBulletinHook::fetch_hook('editor_toolbar_switch')) ? eval($hook) : false;
            break;
    }
    if (!$can_toolbar) {
        $show['font_bbcode'] = $show['size_bbcode'] = $show['color_bbcode'] = $show['basic_bbcode'] = $show['align_bbcode'] = $show['list_bbcode'] = $show['code_bbcode'] = $show['html_bbcode'] = $show['php_bbcode'] = $show['url_bbcode'] = $show['quote_bbcode'] = $show['img_bbcode'] = $show['video_bbcode'] = false;
    }
    $editor_template_name = 'editor_ckeditor';
    // set the editor mode
    switch ($editor_type) {
        case 'qr':
            if ($force_editorid == '') {
                $editorid = 'vB_Editor_QR';
            } else {
                $editorid = $force_editorid;
            }
            $default_height = 100;
            $autofocus = false;
            break;
        case 'qr_small':
            if ($force_editorid == '') {
                $editorid = 'vB_Editor_QR';
            } else {
                $editorid = $force_editorid;
            }
            $default_height = 60;
            $autofocus = false;
            break;
        case 'qr_pm':
            if ($force_editorid == '') {
                $editorid = 'vB_Editor_QR';
            } else {
                $editorid = $force_editorid;
            }
            $default_height = 120;
            $autofocus = false;
            $editor_type = 'qr';
            break;
        case 'qe':
            if ($force_editorid == '') {
                $editorid = 'vB_Editor_QE';
            } else {
                $editorid = $force_editorid;
            }
            $default_height = 200;
            $editor_template_name = 'postbit_quickedit';
            $autofocus = true;
            break;
        default:
            if ($force_editorid == '') {
                $editorid = 'vB_Editor_' . str_pad(++$editorcount, 3, 0, STR_PAD_LEFT);
            } else {
                $editorid = $force_editorid;
            }
            $default_height = 250;
            if ($editor_type == 'fe_nofocus') {
                $autofocus = false;
                $editor_type = 'fe';
            } else {
                $autofocus = false;
                //$autofocus = true;
            }
            break;
    }
    // set the editor mode
    if (isset($_REQUEST['wysiwyg'])) {
        // 2 = wysiwyg; 1 = standard
        if ($_REQUEST['wysiwyg']) {
            $vbulletin->userinfo['showvbcode'] = 2;
        } else {
            if ($vbulletin->userinfo['showvbcode'] == 0) {
                $vbulletin->userinfo['showvbcode'] = 0;
            } else {
                $vbulletin->userinfo['showvbcode'] = 1;
            }
        }
    }
    $toolbartype = is_wysiwyg_compatible(-1, $editor_type);
    $show['wysiwyg_compatible'] = is_wysiwyg_compatible(2, $editor_type) == 2;
    $show['editor_toolbar'] = $toolbartype > 0;
    // set the height of the editor based on the editor_height cookie if it exists
    $editor_height = $vbulletin->input->clean_gpc('c', 'editor_height', TYPE_NOHTML);
    $editor_heights = explode(':', $editor_height);
    foreach ($editor_heights as $items) {
        $item = explode('#', $items);
        if ($item[0] == $editor_type) {
            $editor_height = $item[1];
        }
    }
    $editor_height = $editor_height > 100 ? $editor_height : $default_height;
    // init the variables used by the templates built by this function
    $vBeditJs = array('normalmode' => 'false');
    $vBeditTemplate = array('clientscript' => '', 'fontfeedback' => '', 'sizefeedback' => '', 'smiliepopup' => '');
    $extrabuttons = '';
    // initialize the ckeditor
    $contentid = intval($contentid);
    $parentcontentid = intval($parentcontentid);
    $autoloadtext = '';
    $autoloadtitle = '';
    if ($autoload and $contenttypeid and $vbulletin->userinfo['userid'] and !$preview) {
        $autoloadinfo = $vbulletin->db->query_first("\n\t\t\tSELECT\n\t\t\t\tpagetext, title\n\t\t\tFROM " . TABLE_PREFIX . "autosave\n\t\t\tWHERE\n\t\t\t\tcontentid = {$contentid}\n\t\t\t\t\tAND\n\t\t\t\tparentcontentid = {$parentcontentid}\n\t\t\t\t\tAND\n\t\t\t\tcontenttypeid = '" . $vbulletin->db->escape_string($contenttypeid) . "'\n\t\t\t\t\tAND\n\t\t\t\tuserid = {$vbulletin->userinfo['userid']}\n\t\t");
        if ($autoloadinfo and $autoloadinfo['pagetext'] != $text) {
            $autoloadtext = $autoloadinfo['pagetext'];
            $autoloadtitle = $autoloadinfo['title'];
        }
    }
    ($hook = vBulletinHook::fetch_hook('editor_toolbar_start')) ? eval($hook) : false;
    // show a post editing toolbar of some sort
    if ($show['editor_toolbar']) {
        if ($can_attach) {
            $show['attach'] = true;
        }
        // get extra buttons... experimental at the moment
        $extrabuttons = construct_editor_extra_buttons($editorid, $allow_custom_bbcode);
        $result = process_toolbar_text($text, $toolbartype, $ishtml, $forumid, $allowsmilie, $parsesmilie);
        $newpost['message'] = $result['message'];
        $newpost['message_bbcode'] = $result['bbcode'];
        $result = process_toolbar_text($autoloadtext, $toolbartype, $ishtml, $forumid, $allowsmilie, $parsesmilie);
        $newpost['message_autoload'] = $result['message'];
        $newpost['message_autoload_bbcode'] = $result['bbcode'];
    } else {
        // do not show a post editing toolbar
        $newpost = array('message' => $text, 'message_autoload' => '');
    }
    $cke = vB_Ckeditor::getInstance($editorid, $editor_type, $contenttypeid, $contentid, $parentcontentid, $vbulletin->userinfo['userid'], $toolbartype);
    foreach (array('editor_jsoptions_font', 'editor_jsoptions_size') as $template) {
        $templater = vB_Template::create($template);
        $string = $templater->render(true);
        $fonts = preg_split('#\\r?\\n#s', $string, -1, PREG_SPLIT_NO_EMPTY);
        foreach ($fonts as $fontkey => $fontsize) {
            $fonts[$fontkey] = trim($fontsize);
        }
        if ($template == 'editor_jsoptions_font') {
            $cke->addFonts($fonts);
        } else {
            $cke->addFontSizes($fonts);
        }
    }
    // set editor height
    $cke->setEditorHeight($editor_height);
    $cke->setEditorType($editor_type);
    $cke->setEditorAutoFocus($autofocus);
    $cke->setEditorParsetype($forumid);
    $cke->setAutoLoad(unhtmlspecialchars($autoloadtext), unhtmlspecialchars($autoloadtitle), $autoloadtitleid);
    $cke->setContentFontType($content);
    if (!$can_toolbar) {
        $cke->setNoBbcode();
    }
    // disable smilies option and clickable smilie
    $show['smiliebox'] = false;
    $smiliebox = '';
    $smiliepopup = '';
    $disablesmiliesoption = '';
    if ($allowsmilie and $show['editor_toolbar']) {
        switch ($editor_type) {
            case 'qr':
            case 'qr_small':
            case 'qr_pm':
            case 'qe':
                $usesmiliebox = false;
                break;
            default:
                $usesmiliebox = true;
        }
        // deal with disable smilies option
        if (!isset($checked['disablesmilies'])) {
            $vbulletin->input->clean_gpc('r', 'disablesmilies', TYPE_BOOL);
            $checked['disablesmilies'] = iif($vbulletin->GPC['disablesmilies'], 'checked="checked"');
        }
        $templater = vB_Template::create('newpost_disablesmiliesoption');
        $templater->register('checked', $checked);
        $disablesmiliesoption = $templater->render();
        if ($toolbartype and ($vbulletin->options['smtotal'] > 0 or $vbulletin->options['wysiwyg_smtotal'] > 0)) {
            // query smilies
            $smilies = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT smilieid, smilietext, smiliepath, smilie.title,\n\t\t\t\t\timagecategory.title AS category\n\t\t\t\tFROM " . TABLE_PREFIX . "smilie AS smilie\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "imagecategory AS imagecategory USING(imagecategoryid)\n\t\t\t\tORDER BY imagecategory.displayorder, imagecategory.title, smilie.displayorder\n\t\t\t");
            // get total number of smilies
            $totalsmilies = $vbulletin->db->num_rows($smilies);
            if ($totalsmilies > 0) {
                if ($vbulletin->options['wysiwyg_smtotal'] > 0) {
                    $show['wysiwygsmilies'] = true;
                    // smilie dropdown menu
                    $i = 0;
                    while ($smilie = $vbulletin->db->fetch_array($smilies)) {
                        $cke->addSmilie($smilie);
                        if ($prevcategory != $smilie['category']) {
                            $prevcategory = $smilie['category'];
                            $templater = vB_Template::create('editor_smilie_category');
                            $templater->register('smilie', $smilie);
                            $smiliepopup .= $templater->render();
                        }
                        if (++$i < $vbulletin->options['wysiwyg_smtotal']) {
                            $templater = vB_Template::create('editor_smilie_row');
                            $templater->register('smilie', $smilie);
                            $smiliepopup .= $templater->render();
                        } else {
                            $show['moresmilies'] = true;
                            break;
                        }
                    }
                } else {
                    $show['wysiwygsmilies'] = false;
                }
                // clickable smilie box
                if ($vbulletin->options['smtotal'] and $usesmiliebox) {
                    $vbulletin->db->data_seek($smilies, 0);
                    $i = 0;
                    $smiliebits = '';
                    while ($smilie = $vbulletin->db->fetch_array($smilies) and $i++ < $vbulletin->options['smtotal']) {
                        $templater = vB_Template::create('editor_smilie');
                        $templater->register('smilie', $smilie);
                        $templater->register('editorid', $editorid);
                        $smiliebits .= $templater->render();
                    }
                    $show['moresmilieslink'] = $totalsmilies > $vbulletin->options['smtotal'];
                    $show['smiliebox'] = true;
                }
                $vbulletin->db->free_result($smilies);
            }
            if ($totalsmilies > $vbulletin->options['wysiwyg_smtotal']) {
                $cke->config['moresmilies'] = 1;
            }
        }
        if ($vbulletin->options['smtotal'] > 0 and $usesmiliebox) {
            $templater = vB_Template::create('editor_smiliebox');
            $templater->register('editorid', $editorid);
            $templater->register('smiliebits', $smiliebits);
            $templater->register('totalsmilies', $totalsmilies);
            $smiliebox = $templater->render();
        } else {
            $smiliebox = '';
        }
    }
    ($hook = vBulletinHook::fetch_hook('editor_toolbar_end')) ? eval($hook) : false;
    // Don't send the editor clientscript on ajax returns of the editor -- it won't do anything..
    if (!$_POST['ajax']) {
        $templater = vB_Template::create('editor_clientscript');
        $templater->register('vBeditJs', $vBeditJs);
        $vBeditTemplate['clientscript'] = $templater->render();
    }
    if ($ajax_extra) {
        $cke->setAjaxExtra($ajax_extra);
    }
    $show['is_wysiwyg_editor'] = intval($toolbartype == 2 ? 1 : 0);
    $cke->setAttachInfo($attachinfo);
    $cke->setShow($show);
    $ckeditor = $cke->getEditor($editorid, unhtmlspecialchars($text));
    $templater = vB_Template::create($editor_template_name);
    $templater->register('editorid', $editorid);
    $templater->register('editortype', $toolbartype == 2 ? 1 : 0);
    $templater->register('smiliebox', $smiliebox);
    $templater->register('ckeditor', $ckeditor);
    $templater->register('newpost', $newpost);
    $messagearea = $vBeditTemplate['clientscript'] . $templater->render();
    return $editorid;
}