Вход Регистрация
Файл: vsime.com/system/functions/input_bbs.php
Строк: 286
<?
    
function input_bbs ($field_id='textarea'$style=1$bbs_array=NULL)
    {
        global 
$user;
        if (
$user['input_bbs'] == 1) {
            if (!
$bbs_array)
            {
                
$bbs_array = array();
                
$bbs_array['b'] = 1;
                
$bbs_array['i'] = 1;
                
$bbs_array['u'] = 1;
                
$bbs_array['s'] = 1;
                
$bbs_array['smiles'] = 1;
                
$bbs_array['quote'] = 1;
                
$bbs_array['url'] = 1;
                
$bbs_array['color'] = 1;
                
$bbs_array['fon'] = 1;
            } else {
                if (!isset(
$bbs_array['b']))$bbs_array['b'] = 1;
                if (!isset(
$bbs_array['i']))$bbs_array['i'] = 1;
                if (!isset(
$bbs_array['u']))$bbs_array['u'] = 1;
                if (!isset(
$bbs_array['s']))$bbs_array['s'] = 1;
                if (!isset(
$bbs_array['smiles']))$bbs_array['smiles'] = 1;
                if (!isset(
$bbs_array['url']))$bbs_array['url'] = 1;
                if (!isset(
$bbs_array['quote']))$bbs_array['quote'] = 1;
                if (!isset(
$bbs_array['color']))$bbs_array['color'] = 1;
                if (!isset(
$bbs_array['fon']))$bbs_array['fon'] = 1;
            }
            global 
$user$dbi$user$config;
            if (
$config['web']==false)$bbs_array['smiles'] = 0;
            if (
array_sum($bbs_array))
            {
                if (
$style==1)echo "<div class='grand_h'>n";
                
?>
                <div id="toolbar">
                        <noscript><input class="url-btn" type="submit" name="urlbtn" value=" " title="Вставить ссылку" style="text-decoration:none; width: 20px; background: url(/i/bb/link.gif) no-repeat !important;" />
                        </noscript>
                    </div>
                    
                        <style>
                                    
                                .bb_hide{background-color: #d9d9d9; padding: 5px; border-radius: 3px; border: 1px solid #708090; display: none; overflow: auto; max-width: 300px; max-height: 350px; position: absolute;}
                                .bb_opt:hover .bb_hide{display: block;}
                                .bb_color a {float:left;  width:9px; height:9px; margin:1px;padding: 0 !important;}
                                
                                .bb_color a.categorySelect{width:auto; height:auto; border:none; float:none;}
                                #quote-show-smiles-categories{width:276px;background-color: #d9d9d9;padding: 5px;border-radius: 3px;border: 1px solid #708090;display: none;overflow: auto;position: absolute; padding-right: 15px; }
                                a.more_links{text-decoration:none;}
                                #quote-view-all-smiles{width: 96%;background: #fff;border: 1px solid #666;position:relative;}
                                #smiles_inner_wrap{padding: 5px 15px 5px 5px;}
                        </style>
                
                    
                    <script xmlns="http://www.w3.org/1999/xhtml" language="javascript" type="text/javascript">
                        /*<![CDATA[*/
                                function tag(text1, text2, text3) {
                                    var element = document.getElementById("<? echo $field_id;?>");
                                    element.focus(); 
                                    if (document.selection) {
                                        var selected = document.form.document.selection.createRange(); 
                                        selected.text = text3 + text1 + selected.text + text2 + text3; 
                                    } else if (element.selectionStart !== undefined) {
                                        var str = element.value; 
                                        var start = element.selectionStart; 
                                        var length = element.selectionEnd - element.selectionStart; 
                                        element.value = str.substr(0, start) + text3 + text1 + str.substr(start, length) + text2 + text3 + str.substr(start + length); 
                                    } else 
                                        element.value += text3 + text1 + text2 + text3; 
                                    return false; 
                                }
                                
                                function pasteLink(text) {
                                    var element = document.getElementById("textarea"); 
                                    var str = element.value; 
                                    var start = element.selectionStart; 
                                    var length = element.selectionEnd - element.selectionStart; 
                                    element.value = str.substr(0, start) + text + str.substr(start, length) + str.substr(start + length); 
                                    return false; 
                                }
                                
                                var toolbar = document.getElementById('toolbar'); 
                                toolbar.innerHTML += '<? if ($bbs_array['b'] == 1){?><a href="#<? echo $field_id;?>"  onclick="return tag('[b]', '[/b]', '')"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/bold.gif" alt="b" title="Жирный шрифт" /></a> <? ?>'
                                    + '<? if ($bbs_array['i'] == 1){ ?><a href="#<? echo $field_id;?>" onclick="return tag('[i]', '[/i]', '')"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/italics.gif" alt="i" title="Наклонный шрифт" /></a> <? ?>'
                                    + '<? if ($bbs_array['u'] == 1){ ?><a href="#<? echo $field_id;?>" onclick="return tag('[u]', '[/u]', '')"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/underline.gif" alt="u" title="Подчеркнутый шрифт" /></a> <? ?>'
                                    + '<? if ($bbs_array['s'] == 1){ ?><a href="#<? echo $field_id;?>" onclick="return tag('[s]', '[/s]', '')"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/strike.gif" alt="s" title="Зачеркнутый шрифт" /></a> <? ?>'
                                    + '<? if ($bbs_array['smiles'] == 1){ ?><a href="#<? echo $field_id;?>" onclick="if (document.getElementById('quote-view-all-smiles')){document.getElementById('quote-view-all-smiles').style.display = 'none'} toggle('show-smiles-categories'); return false;" id="addSmilesButton"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/toolbar_smile.png" alt="" title="Смайлы" /></a><? ?>'
                                    + '<? if ($bbs_array['smiles'] == 1){ ?><div class="bb_hide bb_color" id="quote-show-smiles-categories" style="display:none;">'
                                    + '<div style="position:absolute; top:1px; right:1px;line-height:100%;">'
                                    + '<a href="#<? echo $field_id;?>" onclick="toggle('show-smiles-categories'); return false;" class="categorySelect more_links red_link"><img src="/i/site/delete.png" alt="" /></a>'
                                    + '</div>'<?
                                    $num 
0;
                                                
$query mysqli_query($dbi"SELECT * FROM `smiles` WHERE `type` = 'cat'");
                                                while (
$post mysqli_fetch_array($query))
                                                {
                                                
$num++;
            
?> + '<a href="#<? echo $field_id;?>" id="cat<? echo $num;?>" onclick="return selectCategory('<? echo $num;?>')" class="categorySelect"><?
                                    $smile 
mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `smiles` WHERE `id_cat` = '$post[id]' ORDER BY rand()"));
                                    if (
$smile != NULL)
                                    {
                                        
?><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/smiles/<? echo $smile['id'].'.'.$smile['image'];?>" alt="<? echo hsc($post['name']);?>" title="<? echo hsc($post['name']);?>"/><?
                                    
}
                                    else echo 
'<img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/toolbar_smile.png" alt="'.hsc($post['name']).'" title="'.hsc($post['name']).'"/>';?></a> ' <?
                                    
}
                                    
?>+ '</div><? ?>'
                                    + '<? if ($bbs_array['quote'] == 1){ ?> <a href="#<? echo $field_id;?>" onclick="return tag('[quote]', '[/quote]', '')"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/quote.png" alt="q" title="Цитата" /></a><? ?>'
                                    
                                    + '<span id="quote-show-more_links">'
                                        
                                                + '<? if ($bbs_array['url'] == 1){ ?> <a href="#<? echo $field_id;?>" onclick="pasteLink('<? echo $user['copy_url_form'];?>');"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/link.gif" alt="url" title="Вставить ссылку" /></a><? ?>'
                                        
                                    
                                
                        +'<? if ($bbs_array['color'] == 1){ ?> <span class="bb_opt" style="display: inline-block; cursor:pointer; padding:0 5px;"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/color.gif" alt="url" title="Цвет шрифта" />'
                        + "<div class="bb_hide bb_color"><table><tr><?
                        $query 
mysqli_query($dbi"SELECT * FROM `colors_list` WHERE `default` = '1'");
                        
$num 0;
                        while(
$post mysqli_fetch_array($query))
                        {
                        
$num++;
                        
?><td style='width: 1px'><a href="#<? echo $field_id;?>" onclick="return tag('[color=#<? echo $post['color'];?>]', '[/color]', '');" style="background-color:#<? echo $post['color'];?>;"></a></td><?
                        
if ($num==5)
                        {
                        
$num=0;
                        
?></tr><tr><?
                        
}
                        }
                        
?></tr></table></div>"
                        +'</span><? ?>'
                        
                        
                            
                                
                                        + '<? if ($bbs_array['fon'] == 1){ ?> <span class="bb_opt" style="display: inline-block; cursor:pointer; padding:0 5px;"><img src="<? echo "http://$_SERVER[HTTP_HOST]";?>/i/bb/color_bg.gif" alt="url" title="Цвет фона" />'
                                        + "<div class="bb_hide bb_color"><table><tr><?
                        $query 
mysqli_query($dbi"SELECT * FROM `colors_list` WHERE `default` = '1'");
                        
$num 0;
                        while(
$post mysqli_fetch_array($query))
                        {
                        
$num++;
                        
?><td style='width: 1px'><a href="#<? echo $field_id;?>" onclick="return tag('[fon=#<? echo $post['color'];?>]', '[/fon]', '');" style="background-color:#<? echo $post['color'];?>;"></a></td><?
                        
if ($num==5)
                        {
                        
$num=0;
                        
?></tr><tr><?
                        
}
                        }
                        
?></tr></table></div>"
                                        + '</span><? ?>'
                                        
                                
                                
                                
                                + '</span>';
                                    
                        
                                <? if ($bbs_array['smiles'] == 1){ ?>var Smiles_array = [
                                        
                                                
                                                        <?
                                                        $num_cat 
0;
                                                
$query_cat mysqli_query($dbi"SELECT * FROM `smiles` WHERE `type` = 'cat'");
                                                while (
$post_cat mysqli_fetch_array($query_cat))
                                                {
                                                    
$num_cat++;
                                                    echo 
"[";
                                                    
$num_smiles 0;
                                                    
$query_smiles mysqli_query($dbi"SELECT * FROM `smiles` WHERE `type` = 'smile' AND `id_cat` = '$post_cat[id]' ORDER BY `id` ASC");
                                                    while (
$post_smiles mysqli_fetch_array($query_smiles))
                                                    {
                                                        
$num_smiles++;
                                                    echo 
"{text:"$post_smiles[name]",src:"http://$_SERVER[HTTP_HOST]/i/smiles/$post_smiles[id].$post_smiles[image]"}".(mysqli_num_rows($query_smiles)!=$num_smiles?",":NULL);
                                                    
}
                                                    echo 
"]".(mysqli_num_rows($query_cat)!=$num_cat?",":NULL)."nnn";
                                                }
                                                
?>
                                        ];

                                function selectCategory(category){
                                        category = category - 1;
                                    var this_group_smiles_count = Smiles_array[category].length;
                                    var smilesHtml='<div id="quote-view-all-smiles" style="margin:0 auto;">';
                                    
                                    smilesHtml += '<div id="smiles_inner_wrap">';
                                    
                                    for (var i=0; i<this_group_smiles_count; i++){
                                        smilesHtml += "<a href='#<? echo $field_id;?>' onclick="return selectSmile('"+Smiles_array[category][i].text+"','')"><img src='"+Smiles_array[category][i].src+"'  alt=''/></a> ";
                                    }
                                    
                                    smilesHtml += '<div style="position:absolute; top:1px; right:1px;line-height:100%;"><a href="#quote-view-all-smiles-link" onclick="toggle('view-all-smiles'); return false;" class="categorySelect more_links red_link top"><img src="/i/site/delete.png" alt="" /></a></div>';
                                    
                                    smilesHtml += '<div class="stnd_padd" style="clear:both; border-top: 1px solid #cccaca; margin-top: 10px;"><a href="#back_to_categories" onclick="if (document.getElementById('quote-view-all-smiles')){document.getElementById('quote-view-all-smiles').style.display = 'none'} toggle('show-smiles-categories'); return false;" class="arrow_link">&larr; <span>Вернуться к выбору категорий</span></div>';
                                    
                                    smilesHtml += '</div></div>';
                                    
                                    document.getElementById("block_for_smiles").innerHTML=smilesHtml;
                                    
                                    var hide = document.getElementById('quote-show-smiles-categories');
                                        hide.style.display = 'none';
                                    return false; 
                                }

                                function selectSmile(text1) {
                                        text1 = text1 + ' ';
                                    var text3 = '';
                                    var element = document.getElementById("<? echo $field_id;?>"); 
                                    if (document.selection) {
                                        element.focus(); 
                                        var selected = document.form.document.selection.createRange(); 
                                        selected.text = text3 + text1  + text3; 
                                    } else if (element.selectionStart !== undefined) {
                                        var str = element.value; 
                                        var start = element.selectionStart; 
                                        var length = element.selectionEnd - element.selectionStart; 
                                        element.value = str.substr(0, start) + text3 + text1  + text3 + str.substr(start + length); 
                                    } else {
                                        element.value += text3 + text1 + text3; 
                                        }
                                    return false; 
                                }
                                <? ?>
                                function toggle(id,inline) {
                                    var quote = document.getElementById('quote-' + id);
                                    var state = quote.style.display;
                                    if (inline){
                                        if(state == 'none') {
                                                quote.style.display = 'inline';
                                            } else {
                                                quote.style.display = 'none';
                                            }    
                                    }else{
                                            if(state == 'none') {
                                                quote.style.display = 'block';
                                            } else {
                                                quote.style.display = 'none';
                                            }
                                    }
                                }
                                
                        
                                    
                            /*]]>*/
                    </script>

                    <div id="block_for_smiles"></div><?
                
if ($style==|| !array_sum($bbs_array))echo "</div>n";
            }
        }
    }
?>
Онлайн: 4
Реклама