Файл: core/modules/bb_code.inc.php
Строк: 78
<?php
if (!defined('CMS')) { die('Access Denied!'); }
# Вспомогательная функция быстрой вставки
function quickpaste($form, $return = false) {
$str = '<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.form.' . $form . '.focus();
document.form.document.selection.createRange().text = text1+document.form.document.selection.createRange().text+text2;
} else if(document.forms['form'].elements['' . $form . ''].selectionStart!=undefined) {
var element = document.forms['form'].elements['' . $form . ''];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
} else document.form.' . $form . '.value += text1+text2;
}
</script>';
if (!$return) echo $str;
else return $str;
}
# Функция вывода админских тегов
function quicktags($return = false) {
$str = 'Быстрые теги <br />';
$str .= '<a href="#form" onclick="javascript:tag('<a href="">', '</a>');"><img src="' . IMAGES . 'editor/a.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<img src="', '" alt="image" />');"><img src="' . IMAGES . 'editor/img.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<br />', '');"><img src="' . IMAGES . 'editor/br.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<hr />', '');"><img src="' . IMAGES . 'editor/hr.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<b>', '</b>');"><img src="' . IMAGES . 'editor/b.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<big>', '</big>');"><img src="' . IMAGES . 'editor/big.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<small>', '</small>');"><img src="' . IMAGES . 'editor/small.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<i>', '</i>');"><img src="' . IMAGES . 'editor/i.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<u>', '</u>');"><img src="' . IMAGES . 'editor/u.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<div style="text-align:left">', '</div>');"><img src="' . IMAGES . 'editor/left.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<div style="text-align:center">', '</div>');"><img src="' . IMAGES . 'editor/center.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<div style="text-align:right">', '</div>');"><img src="' . IMAGES . 'editor/right.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<span style="color:#ff0000">', '</span>');"><img src="' . IMAGES . 'editor/red.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<span style="color:#00ff00">', '</span>');"><img src="' . IMAGES . 'editor/green.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<span style="color:#0000ff">', '</span>');"><img src="' . IMAGES . 'editor/blue.gif" alt="" /></a>';
$str .= '<a href="#form" onclick="javascript:tag('<span style="color:#ffff00">', '</span>');"><img src="' . IMAGES . 'editor/yellow.gif" alt="" /></a>';
$str .= '<br />';
if (!$return) echo $str;
else return $str;
}
?>