/**
* Some bbcodes have help wizards :)
*
* @return bbcode tag with link
* @version 3.0.8
*/
function abbcode_wizards($abbcode_bbcode, $form_name, $text_name, $in_admin)
{
    global $template, $user, $config, $abbcode, $phpbb_admin_path, $phpbb_root_path, $phpEx;
    if (!class_exists('abbcode')) {
        include $phpbb_root_path . 'includes/abbcode.' . $phpEx;
    }
    // $phpbb_admin_path need to be defined previously initialize abbcode
    if ($in_admin) {
        $phpbb_admin_path = "{$phpbb_root_path}adm/";
        $template->set_custom_template($phpbb_admin_path . 'style', 'admin');
    }
    $abbcode->abbcode_init();
    $user->add_lang(array('posting', 'mods/abbcode'));
    // The Gradient BBCode must use a wizard, so lets force it to use one if they are disabled ;)
    if ($abbcode_bbcode == 'abbc3_grad' && $abbcode->abbcode_config['ABBC3_WIZARD_MODE'] == 0) {
        $abbcode->abbcode_config['ABBC3_WIZARD_MODE'] = 1;
    }
    if (!$abbcode->abbcode_config['ABBC3_WIZARD_MODE']) {
        trigger_error('ABBC3_FUNCTION_DISABLED');
    }
    $abbcode_name = strtoupper($abbcode_bbcode);
    if ($abbcode_bbcode == 'abbc3_bbvideo') {
        static $abbcode_video_ary = array();
        if (empty($abbcode_video_ary)) {
            $abbcode_video_ary = abbcode::video_init();
            $allowed_videos = explode(';', $config['ABBC3_VIDEO_OPTIONS']);
            foreach ($abbcode_video_ary as $video_name => $video_data) {
                if (!isset($video_data['id'])) {
                    $abbcode_video_ary[$video_name]['display'] = false;
                    continue;
                }
                $abbcode_video_ary[$video_name]['display'] = in_array($video_data['id'], $allowed_videos) ? true : false;
                // Now clear video optgroup
                if ($video_data['id'] >= 1 && $video_data['id'] <= 200 && $abbcode_video_ary[$video_name]['display']) {
                    $abbcode_video_ary['video']['display'] = true;
                } else {
                    if ($video_data['id'] >= 201 && $video_data['id'] <= 300 && $abbcode_video_ary[$video_name]['display']) {
                        $abbcode_video_ary['file']['display'] = true;
                    }
                }
            }
        }
        if (sizeof($abbcode_video_ary)) {
            $video_options = '<option value="-1" class="disabled-options">-- ' . $user->lang['ABBC3_BBVIDEO_SELECT'] . ' --</option>' . "\n";
            $video_optgroup = false;
            $video_selected = false;
            foreach ($abbcode_video_ary as $video_name => $video_data) {
                // First check that this video is enabled
                if (!$video_data['display']) {
                    continue;
                }
                if ($video_name == 'video' || $video_name == 'file') {
                    $video_options .= $video_optgroup ? '</optgroup>' . "\n" : '';
                    $video_options .= '<optgroup label="-- ' . $user->lang['ABBC3_BBVIDEO_' . strtoupper($video_name)] . ' --">' . "\n";
                    $video_optgroup = true;
                } else {
                    if (isset($video_data['match']) && $video_data['match'] != '' && (isset($video_data['replace']) && $video_data['replace'] != '')) {
                        $example = isset($video_data['example']) ? str_replace('&', '&amp;', $video_data['example']) : $user->lang['ABBC3_NO_EXAMPLE'];
                        if ($video_name == 'youtube.com') {
                            $selected = ' selected="selected"';
                            $video_selected = true;
                        } else {
                            $selected = '';
                        }
                        $video_options .= '<option value="' . $example . '"' . $selected . '>' . $video_name . '</option>' . "\n";
                    } else {
                        continue;
                    }
                }
            }
            $video_options .= $video_optgroup ? '</optgroup>' . "\n" : '';
            if (!$video_optgroup) {
                $template->assign_var('L_BBVIDEO_ERROR', sprintf($user->lang['ABBC3_BBVIDEO_SELECT_ERROR'], '<a href="mailto:' . $config['board_contact'] . '">', '</a>'));
            }
            $user->lang['ABBC3_BBVIDEO_EXAMPLE'] = $video_selected ? $user->lang['ABBC3_BBVIDEO_EXAMPLE'] : '&nbsp;';
        }
    }
    if (strpos($abbcode_bbcode, '_')) {
        list($garbage, $tag) = explode('_', $abbcode_bbcode == 'abbc3_ed2k' ? 'abbc3_url' : $abbcode_bbcode);
    } else {
        $tag = $abbcode_bbcode;
    }
    $need_description = array('url', 'email', 'click');
    $need_width_height = array('web', 'flash', 'flv', 'video', 'quicktime', 'ram', 'bbvideo');
    // General setings
    $template->assign_vars(array('S_ABBC3_IN_WIZARD' => true, 'S_ABBC3_WIZARD_MODE' => $abbcode->abbcode_config['ABBC3_WIZARD_MODE'], 'FORM_NAME' => $form_name, 'TEXT_NAME' => $text_name, 'ABBC3_OPEN' => $tag, 'ABBC3_CLOSE' => "/{$tag}", 'ABBC3_TAG' => isset($user->lang[$abbcode_name . '_TAG']) ? $user->lang[$abbcode_name . '_TAG'] : '', 'ABBC3_MOVER' => isset($user->lang[$abbcode_name . '_MOVER']) ? $user->lang[$abbcode_name . '_MOVER'] : '', 'ABBC3_NOTE' => isset($user->lang[$abbcode_name . '_NOTE']) ? $user->lang[$abbcode_name . '_NOTE'] : '', 'ABBC3_EXAMPLE' => isset($user->lang[$abbcode_name . '_EXAMPLE']) ? $user->lang[$abbcode_name . '_EXAMPLE'] : '', 'ABBC3_DESC' => in_array($tag, $need_description) ? true : false, 'ABBC3_W_H' => in_array($tag, $need_width_height) ? true : false, 'ABBC3_WIDTH' => $abbcode_bbcode == 'abbc3_web' ? '100%' : $abbcode->abbcode_config['ABBC3_VIDEO_WIDTH'], 'ABBC3_HEIGHT' => $abbcode_bbcode == 'abbc3_web' ? '400' : $abbcode->abbcode_config['ABBC3_VIDEO_HEIGHT'], 'S_WIZARD_GENERAL' => $abbcode_bbcode == 'abbc3_table' ? false : $abbcode_bbcode == 'abbc3_grad' ? false : true, 'S_WIZARD_TABLE' => $abbcode_bbcode == 'abbc3_table' ? true : false, 'S_WIZARD_GRAD' => $abbcode_bbcode == 'abbc3_grad' ? true : false, 'S_BBVIDEO_OPTIONS' => $abbcode_bbcode == 'abbc3_bbvideo' ? $video_options : '', 'S_ABBC3_ALIGN' => $abbcode_bbcode == 'abbc3_img' || $abbcode_bbcode == 'abbc3_thumbnail' ? radio_select('image_align', $user->lang['ABBC3_ALIGN_SELECTOR'], 'none', 'image_align') : ''));
    // $phpbb_admin_path need to be defined previously initialize abbcode
    if ($in_admin) {
        $phpbb_admin_path = "{$phpbb_root_path}adm/";
        $template->set_custom_template($phpbb_admin_path . 'style', 'admin');
    }
    // Output page ...
    page_header($user->lang[$abbcode_name . '_MOVER']);
    if ($in_admin) {
        $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
    }
    $template->set_filenames(array('body' => 'posting_abbcode_wizards.html'));
    page_footer();
}
Пример #2
0
function mbd_conn($id, $va, $pid = '')
{
    switch ($id) {
        case 'url':
            $ret = mbd_url();
            $t = 'URL or ID_article';
            break;
        case 'img':
            $ret = mbd_upload($va);
            $t = nms(78);
            break;
        case 'table':
            $ret = mbd_mktable($va);
            $t = 'table';
            break;
        case 'nh':
            $ret = mbd_footnotes($va, 1);
            $t = 'footnotes';
            break;
        case 'css':
            $ret = mbd_css($id);
            break;
        case 'color':
            $ret = mbd_color($id);
            break;
        case 'conn':
            $id = '';
            break;
        case 'video':
            $ret = mbd_video($va);
            break;
        case 'popvideo':
            $ret = mbd_video($va);
            break;
        case "replace":
            $ret = mbd_replace($va);
            break;
        case 'book':
            $ret = mbd_book($id);
            $t = 'mk_book';
            break;
        case 'paste':
            $ret = mbd_paste();
            $t = nms(86);
            $s = 600;
            break;
        case 'microform':
            $ret = mbd_forms($id);
            $t = 'user_form';
            break;
        case 'microsql':
            $ret = mbd_msql();
            $t = 'select_microbase';
            break;
        case 'formail':
            $ret = mbd_forms($id);
            $t = 'form_for_mail';
            break;
        case "call_url":
            $ret = mbd_vacuum();
            $t = helps('import_art');
            break;
            //case("import"): $ret=mbd_vacuum(); $t=helps('import_art'); break;
        //case("import"): $ret=mbd_vacuum(); $t=helps('import_art'); break;
        case "importart":
            $ret = mbd_importart();
            $t = helps('import_art');
            break;
            ////to do
        ////to do
        case 'radio':
            require 'plug/radio.php';
            $ret = radio_select();
            $t = 'mp3 directory ';
            break;
        case "module":
            $ret = mbd_editcomm($id);
            break;
        case "ajax":
            $ret = mbd_editcomm($id);
            break;
        case "articles":
            $ret = mbd_editcomm($id);
            break;
            //case('svg'): $ret=mbd_editsvg($id); break;
        //case('svg'): $ret=mbd_editsvg($id); break;
        case 'search':
            $t = nms(26);
            break;
        case 'rss_art':
            $t = 'xml_url';
            break;
        case 'rss_read':
            $t = 'philum distant_article';
            break;
        case 'iframe':
            $t = nms(51) . ' (.txt)';
            break;
        case 'scan':
            $t = nms(51) . ' (.txt)';
            break;
        case 'preview':
            req('pop,art,tri,spe');
            $t = nms(65);
            $va = embed_links($va);
            $ret = format_txt($va, '', '');
            break;
        case 'display':
            $ret = divc('panel', $va);
            break;
    }
    if ($id) {
        if (strpos('forumchatpetitionlast-update', $id) !== false) {
            $va = ses('read');
        }
    }
    if (!$ret) {
        $ret = assistant('cnv', 'insert_conn', $id, $va, '');
    }
    return $ret;
    return popup($t ? $t : 'connector:' . $id, $ret, $s ? $s : 440);
}