Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Тематические » Системы управления сайтами » Koobi - 2

Модерирует : Antuan

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

faun



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

В файл users/ru.php добавляем:

Код:
 
$lang['khelp_spoiler'] = "Вставить разворачивающееся окно в сообщении (Alt + J)";
$lang['khelp_hide_u'] = "Вставить скрытие от незарегистрированных пользователей (Alt + N)";
$lang['khelp_hide'] = "Вставить скрытие по количеству сообщений (Alt+ C)";
$lang['text_enter_hide_name'] = "Введите информацию которую необходимо скрыть";
$lang['text_enter_hide'] = "Укажите необходимое количество сообщений что-бы видеть скрытое";
$lang['error_no_hide'] = "Не указано число";
$lang['error_no_hide_text'] = "Не введена информация";
$lang['hide'] = "Скрытая часть сообщения";
$lang['hide_spoiler'] = "Спойлер";
$lang['hide_reg'] = "Скрыто от незарегистрированных пользователей";
 

в файл func.js добавляем:

Код:
 
function tag_hide()
{
    var FoundErrors = '';
    var enterHIDE   = prompt(text_enter_hide, "0");
    var enterTITLE = prompt(text_enter_hide_name, "");
    if (!enterHIDE) {
        FoundErrors += " " + error_no_hide;
    }
    if (!enterTITLE) {
        FoundErrors += " " + error_no_hide_text;
    }
    if (FoundErrors) {
        alert(""+FoundErrors);
        return;
    }
    doInsert("[HIDE="+enterHIDE+"]"+enterTITLE+"[/HIDE]", "", false);
}
 

в конец файла это еще добавляем:

Код:
 
function spoiler_on()  
{  
document.getElementById('spoiler').style.display='';  
}  
function spoiler_off()  
{  
document.getElementById('spoiler').style.display='none';  
}  
 

далее ищем  

Код:
 
    var B_open = 0;
    var I_open = 0;
    var U_open = 0;
    var QUOTE_open = 0;
    var CODE_open = 0;
    var PHP_open = 0;
 

и добавляем ниже это:

Код:
 
    var SPOILER_open = 0;
    var HIDE_open = 0;
 

в файл style.css добавляем

Код:
 
 .spoiler {background-repeat:repeat-x;padding-top: 10px;}  
.spoilerheader {padding-left:15px;background-image:url(../img/page/s_plus.gif);background-repeat:no-repeat;display:block;cursor: pointer;}
 .spoiler.open .spoilerheader {background-image:url(../img/page/s_minus.gif);}
 .spoiler .spoilertext {display:none;} .spoiler.open .spoilertext {display:block;}
 

надеюсь не надо объяснять что нужно две картинки плюс и минус, соответственно s_plus.gif s_minus.gif
 
Далее файл Func.Post.php, ищем функцию function pre_kcodes изаменяем ее код:

Код:
 
function pre_kcodes($text) {
    global $set, $lang, $pref, $boxtype, $THEME, $db, $area, $islogged;
    if(IMGCODE==1) { };
 
    $divheight = divheight($text);
    $sql = $db->Query("SELECT boxwidthcomm,boxwidthforums,maxlengthword FROM " . PREFIX . "_settings",-1,true);
    $row = $sql->fetchrow();
    $bwidth = ("pagecomments") ? $row->boxwidthcomm : $row->boxwidthforums;
 
    $head = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; height:'.$divheight.'px; overflow:auto"><code style="white-space:nowrap">';
    $foot = '</code></div>';
 
    $head_quote = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.';"><span style="font-style:italic;">';
    $foot_quote = '</span></div>';
 
    $pstring = time() . mt_rand(0,10000000);
    $treffer = "/\[php\](.*?)\[\/php\]/si";
    @preg_match_all ($treffer, $text, $erg);
    for($i=0;$i<count($erg[1]);$i++) { $text = str_replace($erg[1][$i], $pstring.$i.$pstring, $text); }
 
    $text = kspecialchars($text);
    $lines = explode("\n", $text);
    $c_mlength = $row->maxlengthword;
    for($n=0;$n<count($lines);$n++) {
        $words = explode(" ",$lines[$n]);
        $pstringount_w = count($words)-1;
        if($pstringount_w >= 0) {
            for($i=0;$i<=$pstringount_w;$i++) {
                $max_length_word = $c_mlength;
                $tword = trim($words[$i]);
                $tword = preg_replace("/\[(.*?)\]/si", "", $tword);
                $displaybox = substr_count($tword, "http://") + substr_count($tword, "https://") + substr_count($tword, "www.") + substr_count($tword, "ftp://");
                if($displaybox > 0) {
                    $max_length_word = 200;
                }
                if(strlen($tword)>$max_length_word) {
                    $words[$i] = chunk_split($words[$i], $max_length_word, "<br />");
                    $length = strlen($words[$i])-5;
                    $words[$i] = substr($words[$i],0,$length);
                }
            }
            $lines[$n] = implode(" ", $words);
        } else {
            $lines[$n] = chunk_split($lines[$n], $max_length_word, "<br />");
        }
    }
    $text = implode("\n", $lines);
    $text = nl2br($text);
    $text = preg_replace("#\[color=(\#?[\da-fA-F]{6}|[a-z\ \-]{3,})\](.*?)\[/color\]+#i","<font color=\"\\1\">\\2</font>",$text);
    $text = preg_replace("#\[size=()?(.*?)\](.*?)\[/size\]#si", "<font size=\"\\2\">\\3</font>", $text);
    $text = preg_replace("#\[face=()?(.*?)\](.*?)\[/face\]#si", "<span style=\"font-family:\\2\">\\3</span>", $text);
    $text = preg_replace("#\[font=()?(.*?)\](.*?)\[/font\]#si", "<span style=\"font-family:\\2\">\\3</span>", $text);
    $text = preg_replace("!\[(?i)b\]!", "<b>", $text);
    $text = preg_replace("!\[/(?i)b\]!", "</b>", $text);
    $text = preg_replace("!\[(?i)u\]!", "<u>", $text);
    $text = preg_replace("!\[/(?i)u\]!", "</u>", $text);
    $text = preg_replace("!\[(?i)i\]!", "<i>", $text);
    $text = preg_replace("!\[/(?i)i\]!", "</i>", $text);
    $text = preg_replace("!\[(?i)url\](http://|ftp://)(.*?)\[/(?i)url\]+!", "<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", $text);
    $text = preg_replace("!\[(?i)url\](.*?)\[/(?i)url\]+!", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $text);
    $text = preg_replace("#\[url=(http://)?(.*?)\](.*?)\[/url\]#si", "<A HREF=\"http://\\2\" TARGET=\"_blank\">\\3</A>", $text);
    $text = preg_replace("!\[(?i)email\]([a-zA-Z0-9-._]+@[a-zA-Z0-9-.]+)\[/(?i)email\]!", "<a href=\"mailto:\\1\">\\1</a>", $text);
    $text = preg_replace("#\[email=()?(.*?)\](.*?)\[/email\]#si", "<A HREF=\"mailto:\\2\">\\3</A>", $text);
    $text = preg_replace("!\[(?i)img\]([_-a-zA-Z0-9:/\?\[\]=.@-]+)\[(?i)/img\]!", "<img src=\"\\1\" border=\"0\" alt=\"\" />", $text);
    $text = preg_replace("!\[(?i)IMG\]([_-a-zA-Z0-9:/\?\[\]=.@-]+)\[(?i)/IMG\]!", "<img src=\"\\1\" border=\"0\" alt=\"\" />", $text);
    $text = preg_replace("/\[code\](.*?)\[\/code\]/si",str_replace("%%boxtitle%%", $lang['code'], $head).'\\1'.$foot, $text);
    $text = preg_replace("!\[(?i)quote\]!", str_replace("%%boxtitle%%", $lang['quote'], $head_quote), $text);
    $text = preg_replace("!\[/(?i)quote\]!", $foot_quote, $text);
    $text = preg_replace("/\[list\](.*?)\[\/list\]/si","<ul>\\1</ul>", $text);
    $text = preg_replace("/\[list=(.*?)\](.*?)\[\/list\]/si","<ol type=\"\\1\">\\2</ol>", $text);
    $text = preg_replace("/\[\*\](.*?)\\n/si","<li>\\1</li>", $text);
 
    for($i=0;$i<count($erg[1]);$i++) {
        ob_start();
        @highlight_string(trim($erg[1][$i]));
        $highlight_string = ob_get_contents();
        ob_end_clean();
        $displaybox = str_replace("%%boxtitle%%", $lang['phpcode'], $head) . $highlight_string.$foot;
        $text = str_replace("[PHP]", "[php]", $text);
        $text = str_replace("[/PHP]", "[/php]", $text);
        $text = str_replace("[php]" . $pstring . $i . $pstring . "[/php]",$displaybox,$text);
    }
 
    if ($islogged != 0)
    {
        $sql_hide = $db->Query("SELECT user_posts FROM " . PREFIX . "_user WHERE uid = '".UID."'");
        $row_hide = $sql_hide->fetchrow();
    }
 
    $user_mes = (int)$row_hide->user_posts;
    $mask_hide = "/\[hide=(.*?)\](.*?)\[\/hide\]/si";
    preg_match($mask_hide, $text, $hide_num);
 
    if ($user_mes >= $hide_num[1])
    {
        $head_hide = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; overflow:auto">';
        $foot_hide = '</div>';
        $replace_hide = str_replace("%%boxtitle%%", $lang['hide'],$head_hide).'\\2'. $foot_hide;
    } else {
        $head_hide = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; overflow:auto">Что бы увидеть скрытую часть сообщения Вам необходимо '.$hide_num[1].' сообщений.</div>';
        $replace_hide = str_replace("%%boxtitle%%", $lang['hide'],$head_hide);
    }
    $text = preg_replace($mask_hide, $replace_hide, $text);
 
    if ($islogged != 0)
    {
        $head_hide_reg = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; overflow:auto">';
        $foot_hide_reg  = '</div>';
        $replace_hide_reg = str_replace("%%boxtitle%%", $lang['hide'],$head_hide_reg).'\\1'. $foot_hide_reg;
    } else {
        $head_hide_reg = '<div style="MARGIN: 5px 0px 0px">%%boxtitle%%</div><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; overflow:auto">Что бы увидеть скрытую часть сообщения Вам необходимо <a href="index.php?area='.$area.'&amp;p=signup">зарегистрироваться</a></div>';
        $replace_hide_reg = str_replace("%%boxtitle%%", $lang['hide_reg'],$head_hide_reg);
    }
    $text = preg_replace("/\[hide\](.*?)\[\/hide\]/si", $replace_hide_reg, $text);
 
    $head_spoiler = '<div class="spoiler"> <a class="spoilerheader" onclick="this.parentNode.className=this.parentNode.className==\'spoiler\'?\'spoiler open\':\'spoiler\'">%%boxtitle%%</a> <div class="spoilertext"><div class="divcode" style="margin:0px; padding:5px; border:1px inset; width:'.$bwidth.'; overflow:auto">';
    $foot_spoiler  = '</div></div></div>';
    $replace_spoiler = str_replace("%%boxtitle%%", $lang['hide_spoiler'],$head_spoiler).'\\1'. $foot_spoiler;
 
    $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/si", $replace_spoiler, $text);
 
    return $text;
}
 

 
Ну и последнее файл format.tpl, его новое полное содержание:

Код:
 
<!-- Начало id_0044  -->
<script language="JavaScript" type="text/javascript">
<!--
    var text_enter_url       =  "{$lang.text_enter_url}";
    var text_enter_url_name  =  "{$lang.text_enter_url_name}";
    var text_enter_hide      =  "{$lang.text_enter_hide}";
    var text_enter_hide_name =  "{$lang.text_enter_hide_name}";
    var khelp_hide           =  "{$lang.khelp_hide}";  
    var error_no_hide        =  "{$lang.error_no_hide}";
    var error_no_hide_text   =  "{$lang.error_no_hide_text}";
    var text_enter_image    =  "{$lang.text_enter_image}";
    var text_enter_email    =  "{$lang.text_enter_email}";
    var error_no_url        =  "{$lang.error_no_url}";
    var error_no_title      =  "{$lang.error_no_title}";
    var error_no_email      =  "{$lang.error_no_email}";
    var prompt_start        =  "{$lang.prompt_start}";
    var khelp_bold          =  "{$lang.khelp_bold}";
    var khelp_italic        =  "{$lang.khelp_italic}";    
    var khelp_underline     =  "{$lang.khelp_underline}";  
    var khelp_font          =  "{$lang.khelp_font}";    
    var khelp_size          =  "{$lang.khelp_size}";    
    var khelp_color         =  "{$lang.khelp_color}";  
    var khelp_close         =  "{$lang.khelp_close}";    
    var khelp_url           =  "{$lang.khelp_url}";        
    var khelp_image         =  "{$lang.khelp_image}";    
    var khelp_email         =  "{$lang.khelp_email}";    
    var khelp_quote         =  "{$lang.khelp_quote}";  
    var khelp_hide_u        =  "{$lang.khelp_hide_u}";
    var khelp_spoiler       =  "{$lang.khelp_spoiler}";    
    var khelp_list          =  "{$lang.khelp_list}";    
    var khelp_code          =  "{$lang.khelp_code}";  
    var khelp_php_code      =  "{$lang.khelp_php_code}";  
    var khelp_click_close   =  "{$lang.khelp_click_close}";
    var list_prompt         =  "{$lang.list_prompt}";  
    var list_prompt2        =  "{$lang.list_prompt2}";    
-->
</script>
 
<table width="100%"  border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td>  
      {strip}
      <select style="height:1.8em" onchange="changefont(this.options[this.selectedIndex].value, 'FONT')" name="ffont">
        <option value="0" selected="selected"> {$lang.font_t} </option>
        {foreach from=$listfonts item=fonts}
        <option style="font-family: {$fonts.font}" value="{$fonts.font}"> {$fonts.fontname} </option>
        {/foreach}
      </select> &nbsp;&nbsp;
      <select style="height:1.8em" onchange="changefont(this.options[this.selectedIndex].value, 'SIZE')"  name="fsize">
        <option  value="0" selected="selected"> {$lang.fontsize_t} </option>
        {foreach from=$sizedropdown item=size}
        <option style="font-size:1{$size.size}px" value="{$size.size}"> {$size.size} </option>
        {/foreach}
      </select> &nbsp;&nbsp;
      <select style="height:1.8em" onchange="changefont(this.options[this.selectedIndex].value, 'COLOR')" name="fcolor">
        <option value="0" selected="selected"> {$lang.fontcolor_t} </option>
        {foreach from=$colordropdown item=color}
        <option style="COLOR: {$color.color}" value="{$color.color}"> {$color.fontcolor} </option>
        {/foreach}
      </select> &nbsp;&nbsp;
      <input class="button_bbodes" onclick='closeall();' type="button" value="{$lang.close_all_tags}" />
      <input name="kmode" type="hidden" id="kmode" />
      <input name="kmode" type="hidden" id="kmode" value="normal" />
    </td>
  </tr>
  <tr>
    <td>
      <input class="button_bbodes" accesskey="b" style="FONT-WEIGHT: bold" onclick='easytag("B")' type="button" value="B" name="B" />&nbsp;
      <input class="button_bbodes" accesskey="i" style="" onclick='easytag("I")' type="button" value="I" name="I" />&nbsp;
      <input class="button_bbodes" accesskey="u" style="TEXT-DECORATION: underline" onclick='easytag("U")' type="button" value="U" name="U" />&nbsp;
      <input class="button_bbodes" accesskey="h" onclick="tag_url()" type="button" value="URL" name="url" />&nbsp;
      <input class="button_bbodes" accesskey="e" onclick="tag_email()" type="button" value="@" name="email" />&nbsp;
      <input class="button_bbodes" accesskey="g" onclick="tag_image()" type="button" value="IMG" name="img" />&nbsp;
      <input class="button_bbodes" accesskey="c" onclick="tag_hide()" type="button" value="HIDE=?" name="hide" />&nbsp;
      <input class="button_bbodes" accesskey="n" onclick='easytag("HIDE")' type="button" value="HIDE" name="HIDE" />&nbsp;
      <input class="button_bbodes" accesskey="j" onclick='easytag("SPOILER")' type="button" value="SPOILER" name="SPOILER" />&nbsp;
      <input class="button_bbodes" accesskey="q" onclick='easytag("QUOTE")' type="button" value="QUOTE" name="QUOTE" />&nbsp;
      <input class="button_bbodes" accesskey="p" onclick='easytag("CODE")' type="button" value="CODE" name="CODE" />&nbsp;
      <input class="button_bbodes" accesskey="x" onclick='easytag("PHP")' type="button" value="PHP" name="PHP" />&nbsp;
      <input class="button_bbodes" accesskey="1" onclick='tag_list()' type="button" value="*" name="LIST" />
    </td>
  </tr>
</table>
{/strip}
<!-- Конец id_0044 -->
 

 

Всего записей: 51 | Зарегистр. 25-02-2006 | Отправлено: 11:50 19-04-2009 | Исправлено: faun, 19:09 19-04-2009
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Тематические » Системы управления сайтами » Koobi - 2


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru