function AdminFileManager()
{
    UseScript('elfinder');
    $options = array('url' => 'index.php?name=plugins&p=connectors&mod=elfinder', 'lang' => 'ru', 'docked' => true, 'height' => 490);
    System::admin()->AddOnLoadJS('var elfinder = $("#finder").elfinder(' . JsonEncode($options) . ')');
    System::admin()->AddTextBox('�איכמג�י לוםוהזונ', '<div id="finder">finder</div>');
}
 /**
  * Выводит дерево в html-коде для отображения в админ-панели
  * @param int $ParentId
  * @return bool|string
  */
 public function ShowCats($ParentId = 0)
 {
     UseScript('jquery_ui_treeview');
     if ($ParentId == 0 && isset($_GET['_cat_parent'])) {
         $ParentId = SafeEnv($_GET['_cat_parent'], 11, int);
     }
     $elements = array();
     if ($ParentId == 0 && !isset($this->Cats[$ParentId])) {
         return 'Нет категорий';
     }
     foreach ($this->Cats[$ParentId] as $cat) {
         $id = SafeDB($cat['id'], 11, int);
         $icon = trim(SafeDB($cat['icon'], 255, str));
         $info = '';
         if ($icon != '') {
             $info .= '<img src="' . $icon . '">';
         }
         if ($this->index_id_par_name != '') {
             $link_go = Ufu('index.php?name=' . $this->module . '&' . $this->index_id_par_name . '=' . $id, $this->module . '/{' . $this->index_id_par_name . '}/');
             $info .= ($icon != '' ? '<br>' : '') . '<b>Адрес</b>: <a href="' . $link_go . '" target="_blank">/' . $link_go . '</a>';
         }
         $icon = 'images/folder.png';
         $add_cat_link = ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $this->edit_met . '&_cat_adto=' . $id;
         $edit_cat_link = ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $this->edit_met . '&' . $this->id_par_name . '=' . $id;
         $func = '';
         $func .= System::admin()->SpeedButton('Добавить дочернюю категорию', $add_cat_link, 'images/admin/folder_add.png');
         $func .= System::admin()->SpeedButton('Редактировать', $edit_cat_link, 'images/admin/edit.png');
         $func .= System::admin()->SpeedConfirmJs('Удалить категорию', '$(\'#cats_tree_container\').treeview(\'deleteNode\', ' . $id . ');', 'images/admin/delete.png', 'Уверены что хотите удалить? Все дочерние объекты так-же будут удалены.');
         $obj_counts = $this->GetCountersRecursive($id);
         $elements[] = array('id' => $id, 'icon' => $icon, 'title' => '<b>' . System::admin()->Link(SafeDB($cat['title'], 255, str) . ' (' . $obj_counts['files'] . ')', $edit_cat_link) . '</b>', 'info' => $info, 'func' => $func, 'isnode' => isset($this->Cats[$id]), 'child_url' => ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $this->showcats_met . '&_cat_parent=' . $id);
     }
     if ($ParentId == 0) {
         System::admin()->AddOnLoadJS('$("#cats_tree_container").treeview({del: \'' . ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $this->del_met . '&ok=1\', delRequestType: \'GET\', tree: ' . JsonEncode($elements) . '});');
         return '<div id="cats_tree_container"></div>';
     } else {
         echo JsonEncode($elements);
         exit;
     }
 }
function AdminNewsEditTopic()
{
    global $news_access_edittopics;
    if (!isset($_GET['id']) || !$news_access_edittopics) {
        System::admin()->AccessDenied();
    }
    AddCenterBox('Редактирование раздела');
    UseScript('jquery_ui', 'colorbox?theme=admin');
    $id = SafeEnv($_GET['id'], 11, int);
    System::database()->Select('news_topics', "`id`='" . $id . "'");
    $topic = System::database()->FetchRow();
    FormRow('Название раздела', System::admin()->Edit('topic_name', SafeDB($topic['title'], 255, str), false, 'maxlength="255" style="width:400px;" class="autofocus"'));
    FormTextRow('Описание (HTML)', System::admin()->HtmlEditor('topic_description', SafeDB($topic['description'], 255, str), 600, 200));
    $image = SafeDB($topic['image'], 255, str);
    list($width, $height) = SafeDB(explode(':', System::config('news/topics_tmb_size')), 11, int);
    FormRow('Изображение', System::admin()->FileManager('topic_image', $image) . '<br>
		<a href="' . $image . '" class="filemanager_topic_image colorbox" data-content="href:path" target="_blank">
			<img src="' . GetThumb($image, $width, $height) . '" class="filemanager_topic_image" data-content="src:tmb" style="margin-top: 5px; max-width: 250px;">
		</a>');
    AddForm('<form name="topicsform" action="' . ADMIN_FILE . '?exe=news&a=savetopic&id=' . $id . '" method="post" enctype="multipart/form-data" name="topicsform">', System::admin()->Button('Отмена', 'onclick="history.go(-1);"') . System::admin()->Submit('Сохранить'));
}
function AdminGalleryUploadForm()
{
    global $edit_images;
    if (!$edit_images) {
        System::admin()->AccessDenied();
    }
    $top = 'Мультизагрузка';
    $cat_id = isset($_GET['to']) ? SafeDB($_GET['to'], 11, int) : 0;
    $cats_data = AdminGalleryGetTree()->GetCatsData($cat_id);
    if (count($cats_data) == 0) {
        $back_to_form = SaveRefererUrl();
        AddTextBox($top, 'Нет категорий для добавления! ' . System::admin()->SpeedButton('Добавить категорию', ADMIN_FILE . '?exe=gallery&a=cateditor&back=' . $back_to_form, '', true, true));
        return;
    }
    System::admin()->AddCenterBox($top);
    UseScript('swfupload');
    $formid = uniqid();
    // Уникальный ID формы
    $_SESSION['uploadforms'][$formid] = array('photos' => array(), 'category' => '0', 'allow_comments' => '1', 'allow_votes' => '1', 'view' => '4', 'show' => '1');
    System::admin()->AddOnLoadJS(Indent('
		window.photo_id = 1;
		window.allUploadComplete = false;
		window.photosCountFiles = 0;
		window.photosUploaded = 0;

		// SWFUpload
		if(window.gallery_swfu){
			window.gallery_swfu.destroy();
		}else{
			window.GallerySubmitFormGuard = function(){
				if(window.photosCountFiles == 0){
					alert("Выберите фотографии для загрузки");
					return false;
				}
				if(!window.allUploadComplete){
					window.gallery_swfu.startUpload();
					Admin.ShowSplashScreen("Загрузка фотографий на хостинг");
					return false;
				}
				return true;
			}
		}

		window.gallery_swfu = new SWFUpload({
			upload_url: "' . ADMIN_FILE . '?exe=gallery&a=upload&formid=' . $formid . '",
			file_post_name : "up_image",
			post_params: {
				"action": "upload"
			},
			file_size_limit: "100 MB",
			file_types: "*.jpg; *.png; *.jpeg; *.gif",
			file_types_description: "Все файлы",
			file_upload_limit: 0,
			file_queue_limit: 0,
			debug: false,

			button_placeholder_id: "uploadbutton",
			button_width: "54",
			button_height: "18",
			button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
			button_text: "<span class=\\"btnCap\\">Обзор<span>",
			button_text_style: ".btnCap{ align: center; color: #4F4F4F; font-family: Verdana, Tahoma, sans-serif; font-weight: bold; }",
			button_text_left_padding: 4,
			button_text_top_padding: 1,

			file_dialog_complete_handler: function(numFilesSelected, numFilesQueued, total){
				$("#uploadFilesCount").html("Выбрано " + total + " файл(ов)");
				window.photosCountFiles = total;
			},
			upload_progress_handler: function(file, bytesLoaded, bytesTotal){
				var current = window.photosUploaded + 1;
				Admin.SetSplashScreenMessage("Загрузка фотографий на хостинг: " + current + "/" + window.photosCountFiles + " (" + Math.round(bytesLoaded/bytesTotal*100) + "%)");
			},
			upload_complete_handler: function(file){
				window.photosUploaded++;
				if(window.photosUploaded == window.photosCountFiles){
					window.allUploadComplete = true;
					$("#galleryForm").submit();
				}
			}
		});
	'));
    FormRow('В категорию', System::site()->Select('category', $cats_data));
    FormRow('Выберите файлы', RemoveIndent('
		<div style="float: left;" id="uploadFilesCount">Выбрано 0 файл(ов)</div>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<div class="button" style="float: right; border: 1px #ccc solid;">
			<span id="uploadbutton">
				<a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a>
			</span>
		</div>
	'));
    FormRow('Комментарии', System::site()->Select('allow_comments', GetEnData(true, 'Разрешить', 'Запретить')));
    FormRow('Оценки', System::site()->Select('allow_votes', GetEnData(true, 'Разрешить', 'Запретить')));
    FormRow('Кто видит', System::site()->Select('view', GetUserTypesFormData(4)));
    FormRow('Показать', System::site()->Select('show', GetEnData(true, 'Да', 'Нет')));
    AddForm('<form action="' . ADMIN_FILE . '?exe=gallery&a=upload&formid=' . $formid . '" method="post" onsubmit="return GallerySubmitFormGuard();" id="galleryForm">', System::admin()->Hidden('action', 'preview') . System::admin()->Submit('Загрузить'));
}
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('tinymce', 'elfinder');
$textarea_name = System::site()->textarea_name;
$extra_plugins = System::plug_config('editors.tiny_mce/extra_plugins');
if ($extra_plugins != '') {
    $extra_plugins = ',' . $extra_plugins;
}
$plugins = 'advimage,advlink,advlist,autolink,contextmenu,fullscreen,lists,media,paste,print,save,inlinepopups,' . 'searchreplace,spellchecker,tabfocus,table,visualchars' . ',images,insertcode,codemagic' . $extra_plugins;
$options = '{
	mode: "exact",
	elements: "' . $textarea_name . '",
	language: "ru",
	theme: "' . System::plug_config('editors.tiny_mce/theme') . '",
	skin: "aristo",
	content_css: "' . System::config('tpl_dir') . System::config('general/site_template') . '/style/textstyles.css",
	force_p_newlines: true,
	relative_urls: true,
	remove_script_host: true,
	forced_root_block: "p",
	element_format: "html",
	apply_source_formatting: true,
	gecko_spellcheck: true,
<?php

if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('jquery_ui');
ScriptsAddJQueryPlugin('elfinder/elfinder');
ScriptsAddCss('elfinder/css/elfinder');
function AdminCodetesterSnippets($type)
{
    System::admin()->AddSubTitle('Сниппеты');
    UseScript('jquery_ui_table');
    if (isset($_REQUEST['onpage'])) {
        $num = intval($_REQUEST['onpage']);
    } else {
        $num = 20;
    }
    if (isset($_REQUEST['page'])) {
        $page = intval($_REQUEST['page']);
    } else {
        $page = 1;
    }
    $snippets_db = System::database()->Select('snippets', "`type`='{$type}'");
    $columns = array('title');
    $sortby = '';
    $sortbyid = -1;
    $desc = true;
    if (isset($_REQUEST['sortby'])) {
        $sortby = $columns[$_REQUEST['sortby']];
        $sortbyid = intval($_REQUEST['sortby']);
        $desc = $_REQUEST['desc'] == '1';
    }
    if ($sortby != '') {
        SortArray($snippets_db, $sortby, $desc);
    }
    $table = new jQueryUiTable();
    $table->listing = ADMIN_FILE . '?exe=codetester&a=' . $type . 'snippets&ajax';
    $table->del = ADMIN_FILE . '?exe=codetester&a=delete';
    $table->total = count($snippets_db);
    $table->onpage = $num;
    $table->page = $page;
    $table->sortby = $sortbyid;
    $table->sortdesc = $desc;
    $table->AddColumn('Заголовок');
    $table->AddColumn('Функции', 'center', false, true);
    $snippets_db = ArrayPage($snippets_db, $num, $page);
    // Берем только новости с текущей страницы
    foreach ($snippets_db as $snip) {
        $id = SafeDB($snip['id'], 11, int);
        $editlink = ADMIN_FILE . '?exe=codetester&id=' . $id . '&lang=' . $type;
        $func = '';
        $func .= System::admin()->SpeedButton('Редактировать', $editlink, 'images/admin/edit.png');
        $func .= System::admin()->SpeedConfirmJs('Удалить', '$(\'#jqueryuitable\').table(\'deleteRow\', ' . $id . ');', 'images/admin/delete.png', 'Уверены, что хотите удалить этот сниппет?');
        $table->AddRow($id, '<b>' . System::admin()->Link(SafeDB($snip['title'], 255, str), $editlink) . '</b>', $func);
    }
    if (isset($_GET['ajax'])) {
        echo $table->GetOptions();
        exit;
    } else {
        $table->AddTable('Сниппеты');
    }
}
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('elfinder');
$name = System::site()->editfilemanager_name;
System::site()->AddOnLoadJS('$("#openfilemanager_' . $name . '").click(function(){
	var opts = {
		url : \'index.php?name=plugins&p=connectors&mod=elfinder\',
		lang : \'ru\',
		commandsOptions:{
			getfile: {
				oncomplete: "destroy"
			}
		},
		getFileCallback: function(file, el){
			$(".filemanager_' . $name . '").each(function(){
				var data = $(this).data("content");
				var exp = data.split(":");
				if(exp.lenght == 2 && exp[0] == "call"){
					if(window[exp[1]]){
						window[exp[1]](file);
					}
				}else if(exp.length == 2){
					$(this).prop(exp[0], file[exp[1]]);
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
System::admin()->AddCenterBox('Выполнить SQL');
if (System::database()->Name != 'MySQL') {
    System::admin()->HighlightError('Только базы данных с поддержкой SQL.');
    return;
}
$ace = UseScript('ace?mode=sql&id=sqlcode');
System::admin()->AddOnLoadJS($ace . '.on("focus", function(){ $("#sqlcode_replace").animate({height: "400"}, 500); });');
System::admin()->AddJS('
PerformSqlCode = function(){
	var label = $("#perform").button("option", "label");
	$("#perform").button("option", "label", "Запуск <img src=\\"images/ajax-loader.gif\\">");
	$("#result_container").hide();
	$("#perform_result").html("");
	$("#perform_result").hide();
	$.ajax({
		type: "POST",
		url: "' . ADMIN_FILE . '?exe=dbadmin&a=performsql",
		data: {code: $("#sqlcode").val()},
		success: function(data){
			$("#perform").button("option", "label", label);
			$("#perform_result").html("<pre>"+data+"</pre>");
			$("#result_container").show();
			$("#sqlcode_replace").animate({height: "100"}, 500);
			$("#perform_result").slideDown();
		}
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
$textarea_name = System::site()->textarea_name;
$ace = UseScript('ace?mode=html&id=' . $textarea_name);
System::site()->textarea_html = System::site()->TextArea($textarea_name, System::site()->textarea_value, 'id="' . $textarea_name . '" style="width:' . System::site()->textarea_width . 'px;height:' . System::site()->textarea_height . 'px;"');
function AdminAdminMenuEditor()
{
    UseScript('jquery');
    System::admin()->AddJS(Indent(<<<JS
\t\tSelectLinkType = function(type, first){
\t\t\t\$('.aaml').hide();
\t\t\tif(first){
\t\t\t\t\$('.aaml_'+type).show();
\t\t\t}else{
\t\t\t\t\$('.aaml_'+type).fadeIn(1000);
\t\t\t}
\t\t};
\t\tSelectModule = function(mod){
\t\t\t\tvar mod = \$(mod).find('option:selected').attr('title');
\t\t\t\t\$('#item_title').val(mod).focus();
\t\t};
JS
));
    $id = -1;
    $parent = 0;
    if (isset($_GET['parent'])) {
        $parent = SafeEnv($_GET['parent'], 11, int);
    }
    $module = '';
    $title = '';
    $icon = '';
    $admin_link = '';
    $external_link = '';
    $blank = false;
    $js = '';
    $type = 'admin';
    //(admin|external|js|node|delimiter)
    $enabled = true;
    if (isset($_GET['id'])) {
        $id = SafeEnv($_GET['id'], 11, int);
        System::database()->Select('adminmenu', "`id`='{$id}'");
        $item = System::database()->FetchRow();
        $parent = SafeDB($item['parent'], 11, int);
        $module = SafeDB($item['module'], 255, str);
        $title = SafeDB($item['title'], 255, str);
        $icon = SafeDB($item['icon'], 255, str);
        $admin_link = SafeDB($item['admin_link'], 255, str);
        $external_link = SafeDB($item['external_link'], 255, str);
        $blank = SafeDB($item['blank'], 1, bool);
        $js = SafeDB($item['js'], 0, str);
        $type = SafeDB($item['type'], 255, str);
        $enabled = SafeDB($item['enabled'], 1, bool);
        $form_title = 'Редактирование элемента';
        $button = 'Сохранить';
    } else {
        $form_title = 'Добавить элемент';
        $button = 'Добавить';
    }
    System::admin()->AddOnLoadJS("SelectLinkType('{$type}', true);");
    $items_db = System::database()->Select('adminmenu', "`type`<>'delimiter'");
    $items_tree = new Tree($items_db);
    $parent_data = $items_tree->GetCatsData($parent, false, true, $id, true);
    $modules_db = System::database()->Select('modules');
    $modules_data = array();
    System::admin()->DataAdd($modules_data, '', '', '' == $module);
    foreach ($modules_db as $mod) {
        System::admin()->DataAdd($modules_data, $mod['folder'], $mod['name'], $mod['folder'] == $module);
    }
    $types_data = array();
    $types_av = array('admin' => 'Внутренняя ссылка', 'external' => 'Внешняя ссылка', 'js' => 'JavaScript', 'node' => 'Категория', 'delimiter' => 'Разделитель');
    foreach ($types_av as $t => $c) {
        System::admin()->DataAdd($types_data, $t, $c, $t == $type);
    }
    System::admin()->FormRow('Родительский элемент', System::admin()->Select('parent', $parent_data, false, $parent == 0 ? 'class="autofocus"' : ''));
    System::admin()->FormRow('Модуль', System::admin()->Select('module', $modules_data, false, 'onchange="SelectModule(this);"' . ($parent != 0 ? ' class="autofocus"' : '')));
    System::admin()->FormRow('Заголовок', System::site()->Edit('title', $title, false, 'id="item_title" style="width:400px;" maxlength="255"'));
    System::admin()->FormRow('Иконка (16x16)', System::site()->Edit('icon', $icon, false, 'style="width:400px;" maxlength="255"'));
    System::admin()->FormRow('Тип', System::admin()->Select('type', $types_data, false, 'onchange="SelectLinkType(this.value);"'));
    System::admin()->FormRow('Внутренняя ссылка', System::site()->Edit('admin_link', $admin_link, false, 'style="width:400px;" maxlength="255"'), 'class="aaml aaml_admin"');
    System::admin()->FormRow('Внешняя ссылка', System::site()->Edit('external_link', $external_link, false, 'style="width:400px;" maxlength="255"'), 'class="aaml aaml_external"');
    System::admin()->FormRow('Открыть ссылку в новом окне/вкладке', System::admin()->Select('blank', GetEnData($blank, 'Да', 'Нет')), 'class="aaml aaml_external"');
    System::admin()->FormTextRow('JavaScript', System::site()->TextArea('js', $js, 'style="width:400px;height:100px;"'), 'class="aaml aaml_js"');
    System::admin()->FormRow('Включить', System::admin()->Select('enabled', GetEnData($enabled, 'Да', 'Нет')));
    System::admin()->AddCenterBox($form_title);
    System::admin()->AddForm('<form action="' . ADMIN_FILE . '?exe=adminmenu&a=save' . ($id != -1 ? '&id=' . $id : '') . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1)"') . System::site()->Submit($button));
}
<?php

/*
 * Файл инициализации шаблона.
 * Здесь устанавливается doctype, Подключаются JS, CSS файлы и скрипты.
 * Можно изменить другие параметры шаблона, или сделать вывод в шаблон произвольного контента.
 */
System::site()->Doctype = '<!doctype html>';
System::site()->AddCSSFile('style.css', false, false, 'media="screen"');
System::site()->AddJSFile('functions.js', false, true);
UseScript('jquery');
UseScript('syntaxhighlighter?theme=Default');
// Подсветка кода на страницах
UseScript('colorbox');
// Скрипт просмотра изображений (LightBox)
System::site()->AddOnLoadJS(Indent('
	if($("#errors").html() != "") $("#errors").show();
'));
System::site()->SetTempVar('template', 'header', 'header.html');
System::site()->SetTempVar('template', 'footer', 'footer.html');
function AdminForumMain()
{
    UseScript('jquery_ui_treeview');
    if (CheckGet('parent')) {
        // Запрос дочернего дерева
        $parent = SafeEnv($_GET['parent'], 11, int);
        $default_level = 0;
    } else {
        $parent = 0;
        $default_level = 1;
    }
    $forumsdb = System::database()->Select('forums');
    SortArray($forumsdb, 'order');
    $forums = array();
    foreach ($forumsdb as $f) {
        $forums[$f['parent_id']][] = $f;
    }
    $elements = array();
    if (isset($forums[$parent])) {
        foreach ($forums[$parent] as $forum) {
            $element = AdminForumGetElement($forum, $forums, $default_level);
            if ($parent == 0 && isset($forums[$forum['id']])) {
                foreach ($forums[$forum['id']] as $forum) {
                    $element['childs'][] = AdminForumGetElement($forum, $forums, 2);
                }
            }
            $elements[] = $element;
        }
    } elseif (!CheckGet('parent')) {
        AddTextBox('Управление форумами', 'Нет категорий.');
        return;
    }
    if ($parent == 0) {
        $delete_url = ADMIN_FILE . '?exe=forum&a=delete';
        $move_url = ADMIN_FILE . '?exe=forum&a=move';
        System::admin()->AddOnLoadJS('$("#tree_container").treeview({move: "' . $move_url . '", del: "' . $delete_url . '", tree: ' . JsonEncode($elements) . '});');
        AddTextBox('Управление форумами', '<div id="tree_container"></div>');
    } else {
        echo JsonEncode($elements);
        exit;
    }
}
<?php

if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('swfobject');
ScriptsAddJs('swfupload/swfupload');
$mode = '';
// Режим подсветки
$theme = '';
// Тема подсветки
/* mode = (c_cpp, clojure, coffee, coldfusion, csharp, css, groovy, haxe, html, java, latex, lua, markdown, ocaml, perl, pgsql, php,
 * powershell, python, ruby, scad, scala, scss, sql, svg, text, textile, xml)
 */
/* theme = (chrome, clouds, clouds_midnight, cobalt, crimson_editor, dawn, dreamweaver, eclipse, idle_fingers, kr_theme,
 * merbivore, merbivore_soft, mono_industrial, monokai, pastel_on_dark, solarized_dark, solarized_light, tomorrow,
 * tomorrow_night, tomorrow_night_blue, tomorrow_night_bright, tomorrow_night_eighters, twilight)
 */
extract($params, EXTR_OVERWRITE);
// Подключаем ace.js
ScriptsAddJs('ace/src/ace');
if ($id != '') {
    UseScript('jquery');
    System::site()->AddOnLoadJS(<<<JS
\t\t\tvar aceel = \$("#{$id}");
\t\t\tvar aceeldom = aceel.get(0);
\t\t\tif(aceeldom.nodeName.toLowerCase() == "textarea"){
\t\t\t\tvar ecediv = \$("<div>", {id: "{$id}_replace"}).css({"position": "relative"}).insertBefore(aceel);
\t\t\t\tvar style;
\t\t\t\tvar dest = {};
\t\t\t\tif(window.getComputedStyle){
\t\t\t\t\tstyle = window.getComputedStyle(aceeldom, null);
\t\t\t\t\tdest["width"] = style.getPropertyValue("width");
\t\t\t\t\tdest["height"] = style.getPropertyValue("height");
\t\t\t\t}else if(style = aceeldom.currentStyle){
\t\t\t\t\tdest["width"] = style["width"];
\t\t\t\t\tdest["height"] = style["height"];
\t\t\t\t}else if(style = aceeldom.style){
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
/**
 * Библиотека функций форума.
 * @todo Доработать(переписать) функции корзины.
 */
// Инициализация
define("FORUM_CACHE_DIR", 'cache/forum/');
define("FORUM_CACHE_ALL_DATA_FORUMS", 'Forum_Cache_AllDataTableForum');
define("FORUM_CACHE_ALL_DATA_FORUM_TOPICS", 'Forum_Cache_AllDataTableForumTopics');
$forum_functions_dir = MOD_DIR . 'functions/';
$forum_navigation = '';
if (!defined('ADMIN_SCRIPT')) {
    System::site()->AddCSSFile('forum.css');
    UseScript('forum_scripts');
}
System::user()->Def('u_add_rating', true);
System::user()->Def('u_add_comment', true);
System::user()->Def('u_read_comment', true);
System::user()->Def('u_add_forum', true);
System::user()->Def('u_read_forum', true);
ForumBasketAutoclear();
RegisterClass('ForumStatistics', MOD_DIR . 'lib/forum_statistics.class.php');
RegisterClass('ForumTree', MOD_DIR . 'lib/forum_tree.class.php');
RegisterClass('ForumOnline', MOD_DIR . 'lib/forum_online.class.php');
// Конец инициализации //
/**
 * Фильтрует данные форума или категории. Функции вывода форумов используются в двух местах,
 * непосредственно на главной модуля и при выводе субфорумов при просмотре тем форума.
 * @global type $forum_lang
function AdminExtensions()
{
    UseScript('jquery_ui');
    $mod_dir = System::config('mod_dir');
    $blocks_dir = System::config('blocks_dir');
    $plug_dir = System::config('plug_dir');
    $tpl_dir = System::config('tpl_dir');
    // Стили
    $style = '<style>
	.ex-mod{ border-bottom: 1px #ccf solid; background-color: #DDEAF7; cursor: pointer; }
	.ex-mod:hover{ background-color: #F5F5FF; }
	.ex-mod-info { padding-top: 4px; }
	.ex-mod-info-description { padding-top: 0; margin-bottom: 5px; }
	.mod_info { margin-bottom: 5px; }
	</style>';
    // JS
    System::site()->AddJS('
	window.last_mod_id = "";
	ShowModInfo = function(id){
	  $(".mod_info").slideUp().parents(".ex-mod").css("background-color", "#DDEAF7");
	  if(last_mod_id != id){
	  	$("#mod_info_"+id).slideDown().parents(".ex-mod").css("background-color", "#FFF");
	  	last_mod_id = id;
	  }else{
	    last_mod_id = "";
	  }
	};
	window.last_block_id = "";
	ShowBlockInfo = function(id){
	  $(".mod_info").slideUp().parents(".ex-mod").css("background-color", "#DDEAF7");
	  if(last_block_id != id){
	  	$("#mod_info_"+id).slideDown().parents(".ex-mod").css("background-color", "#FFF");
	  	last_block_id = id;
	  }else{
	    last_block_id = "";
	  }
	};
	');
    // Модули
    $modules_html = '<div style="border-top: 1px #ccf solid; ">';
    $mods = System::database()->Select('modules', "`system`='0'");
    SortArray($mods, 'name');
    foreach ($mods as $mod) {
        $info = ExtLoadInfo($mod_dir . $mod['folder']);
        if ($info === false) {
            continue;
        }
        $mid = SafeEnv($mod['id'], 11, int);
        $func = '';
        $func .= System::admin()->SpeedStatus('Отключить', 'Подключить', ADMIN_FILE . '?exe=extensions&a=changestatus&type=' . EXT_MODULE . '&id=' . $mid, $mod['enabled'] == '1', 'images/bullet_green.png', 'images/bullet_red.png');
        $func .= System::admin()->SpeedButton('Настройки', ADMIN_FILE . '?exe=extensions&a=mod_config&name=' . SafeDB($mod['folder'], 255, str), 'images/admin/config.png');
        // Показываем кнопку удаления, только тогда, когда существует программа удаления
        if (is_file($mod_dir . $mod['folder'] . '/uninstall.php')) {
            $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=extensions&a=uninstall&type=' . EXT_MODULE . '&name=' . SafeDB($mod['folder'], 255, str), 'images/admin/delete.png', 'Полностью удалить модуль ' . $mod['name'] . '?');
        }
        if (is_file($mod_dir . $mod['folder'] . '/icon.png')) {
            $icon = $mod_dir . $mod['folder'] . '/icon.png';
        } else {
            $icon = 'images/application.png';
        }
        if (isset($info['version'])) {
            $version = SafeDB($info['version'], 255, str);
        } else {
            $version = CMS_VERSION;
        }
        if (isset($info['author'])) {
            $author = SafeDB($info['author'], 255, str);
        } else {
            $author = '';
        }
        if (isset($info['site'])) {
            $site = SafeDB($info['site'], 255, str);
        } else {
            $site = '';
        }
        if (isset($info['description'])) {
            $description = SafeDB($info['description'], 0, str, false, false);
        } else {
            $description = 'Нет описания.';
        }
        $modules_html .= '<table width="100%" class="ex-mod">
		<tr onmousedown="ShowModInfo(\'mod' . $mid . '\');">
			<td style="padding-left: 11px; vertical-align: top;">
				<div style="float: left;">
					<div style="float:left; padding-top: 6px;"><img src="' . $icon . '"></div>
					<div style="float:left; padding-top: 7px;">&nbsp;' . SafeDB($mod['name'], 255, str) . ' (v' . $version . ')</div>
				</div>
			</td>
			<td width="90" align="center" style="padding: 3px; padding-bottom: 2px;">
				<div style="float: left">' . $func . '</div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div class="mod_info" id="mod_info_mod' . $mid . '" style="display: none; padding: 4px; padding-left: 11px;">
					<div class="ex-mod-info-description">' . $description . '</div>
		      ' . ($author != '' ? '<div class="ex-mod-info">Автор: ' . $author . '</div>' : '') . '
		      ' . ($site != '' ? '<div class="ex-mod-info">Сайт: <a href="' . $site . '" target="_blank">' . $site . '</a></div>' : '') . '
				</div>
			</td>
		</tr>
		</table>';
    }
    $modules_html .= '</div>';
    // Блоки
    $blocks_html = '<div style="border-top: 1px #ccf solid; ">';
    $mods = System::database()->Select('block_types');
    SortArray($mods, 'name');
    foreach ($mods as $mod) {
        $info = ExtLoadInfo($blocks_dir . $mod['folder']);
        if ($info === false) {
            continue;
        }
        $mid = SafeEnv($mod['id'], 11, int);
        $func = '';
        if (is_file($blocks_dir . $mod['folder'] . '/uninstall.php')) {
            // Показываем кнопку удаления, только тогда, когда существует программа удаления
            $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=extensions&a=uninstall&type=' . EXT_BLOCK . '&name=' . SafeDB($mod['folder'], 255, str), 'images/admin/delete.png', 'Полностью удалить модуль ' . $mod['name'] . '?');
        }
        if (isset($info['icon']) && $info['icon'] != '') {
            $icon = SafeDB($info['icon'], 255, str);
        } else {
            $icon = 'images/application.png';
        }
        if (isset($info['version'])) {
            $version = SafeDB($info['version'], 255, str);
        } else {
            $version = CMS_VERSION;
        }
        if (isset($info['author']) && $info['author'] != '') {
            $author = SafeDB($info['author'], 255, str);
        } else {
            $author = '';
        }
        if (isset($info['site']) && $info['site'] != '') {
            $site = SafeDB($info['site'], 255, str);
        } else {
            $site = '';
        }
        if (isset($info['description']) && $info['description'] != '' && $info['description'] != ' - ') {
            $description = SafeDB($info['description'], 0, str, false, false);
        } else {
            $description = 'Нет описания.';
        }
        $blocks_html .= '<table width="100%" class="ex-mod">
		<tr onmousedown="ShowBlockInfo(\'block' . $mid . '\');">
			<td style="padding-left: 11px; vertical-align: top;">
				<div style="float: left;">
					<div style="float:left; padding-top: 6px;"><img src="' . $icon . '"></div>
					<div style="float:left; padding-top: 7px;">&nbsp;' . SafeDB($mod['name'], 255, str) . ' (v' . $version . ')</div>
				</div>
			</td>
			<td width="62" align="center" style="padding: 3px; padding-bottom: 2px;">
				<div style="float: left">' . $func . '</div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div class="mod_info" id="mod_info_block' . $mid . '" style="display: none; padding: 4px; padding-left: 11px;">
					<div class="ex-mod-info-description">' . $description . '</div>
		      ' . ($author != '' ? '<div class="ex-mod-info">Автор: ' . $author . '</div>' : '') . '
		      ' . ($site != '' ? '<div class="ex-mod-info">Сайт: <a href="' . $site . '" target="_blank">' . $site . '</a></div>' : '') . '
				</div>
			</td>
		</tr>
		</table>';
    }
    $blocks_html .= '</div>';
    // Плагины
    $plugins_html = '<div style="border-top: 1px #ccf solid; ">';
    $mods = System::database()->Select('plugins', "`hidden`='0'");
    SortArray($mods, 'group');
    $configs_groups = PluginsConfigsGroups();
    foreach ($mods as $mod) {
        if ($mod['group'] != '') {
            $path = $plug_dir . $mod['group'] . '/' . $mod['name'];
        } else {
            $path = $plug_dir . $mod['name'];
        }
        $info = ExtLoadInfo($path);
        if ($info === false) {
            continue;
        }
        $mid = SafeEnv($mod['id'], 11, int);
        $func = '';
        $group = SafeDB(($mod['group'] != '' ? $mod['group'] . '.' : '') . $mod['name'], 255, str);
        if (isset($configs_groups[$group])) {
            $func .= System::admin()->SpeedButton('Настройки', ADMIN_FILE . '?exe=extensions&a=plug_config&group=' . $group, 'images/admin/config.png');
        }
        $func .= System::admin()->SpeedStatus('Отключить', 'Подключить', ADMIN_FILE . '?exe=extensions&a=changestatus&type=' . EXT_PLUGIN . '&id=' . $mid, $mod['enabled'] == '1', 'images/bullet_green.png', 'images/bullet_red.png');
        // Показываем кнопку удаления, только тогда, когда существует программа удаления
        if (isset($info['1.3']) || is_file($path . '/uninstall.php')) {
            $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=extensions&a=uninstall&type=' . EXT_PLUGIN . '&name=' . SafeDB($mod['name'], 255, str) . ($mod['group'] != '' ? '&group=' . SafeDB($mod['group'], 255, str) : ''), 'images/admin/delete.png', 'Полностью удалить плагин ' . $mod['name'] . '?');
        }
        $name = SafeDB($info['name'], 255, str);
        if (isset($info['icon']) && $info['icon'] != '') {
            $icon = SafeDB($info['icon'], 255, str);
        } else {
            $icon = 'images/application.png';
        }
        if (isset($info['version'])) {
            $version = SafeDB($info['version'], 255, str);
        } else {
            $version = CMS_VERSION;
        }
        if (isset($info['author']) && $info['author'] != '') {
            $author = SafeDB($info['author'], 255, str);
        } else {
            $author = '';
        }
        if (isset($info['site']) && $info['site'] != '') {
            $site = SafeDB($info['site'], 255, str);
        } else {
            $site = '';
        }
        if (isset($info['description']) && $info['description'] != '' && $info['description'] != ' - ') {
            $description = SafeDB($info['description'], 0, str, false, false);
        } else {
            $description = 'Нет описания.';
        }
        $plugins_html .= '<table width="100%" class="ex-mod">
		<tr onmousedown="ShowBlockInfo(\'plug' . $mid . '\');">
			<td style="padding-left: 11px; vertical-align: top;">
				<div style="float: left;">
					<div style="float:left; padding-top: 6px;"><img src="' . $icon . '"></div>
					<div style="float:left; padding-top: 7px;">&nbsp;' . $name . ' (v' . $version . ')</div>
				</div>
			</td>
			<td width="62" align="center" style="padding: 3px; padding-bottom: 2px;">
				<div style="float: left">' . $func . '</div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div class="mod_info" id="mod_info_plug' . $mid . '" style="display: none; padding: 4px; padding-left: 11px;">
					<div class="ex-mod-info-description">' . $description . '</div>
		      ' . ($author != '' ? '<div class="ex-mod-info">Автор: ' . $author . '</div>' : '') . '
		      ' . ($site != '' ? '<div class="ex-mod-info">Сайт: <a href="' . $site . '" target="_blank">' . $site . '</a></div>' : '') . '
		      <div class="ex-mod-info">Тип: ' . AdminExtensionsPluginType($mod['type']) . '</div>
				</div>
			</td>
		</tr>
		</table>';
    }
    $plugins_html .= '</div>';
    // Шаблоны
    $templates_html = '<div style="border-top: 1px #ccf solid; ">';
    $mods = System::database()->Select('templates', "`default`='0'");
    SortArray($mods, 'name');
    foreach ($mods as $mod) {
        $info = ExtLoadInfo($tpl_dir . $mod['folder']);
        if ($info === false) {
            $info = array('name' => $mod['folder'], 'description' => '', 'author' => '', 'site' => '', 'version' => '1.0', 'admin' => false);
        }
        $mid = SafeEnv($mod['id'], 11, int);
        $name = SafeDB($info['name'], 255, str);
        $func = '';
        $func .= System::admin()->SpeedConfirm('Удалить шаблон', ADMIN_FILE . '?exe=extensions&a=uninstall&type=' . EXT_TEMPLATE . '&name=' . SafeDB($mod['folder'], 255, str), 'images/admin/delete.png', 'Удалить шаблон ' . $name . '?');
        if (isset($info['icon']) && $info['icon'] != '') {
            $icon = $info['icon'];
        } else {
            $icon = 'images/application.png';
        }
        if (isset($info['version'])) {
            $version = SafeDB($info['version'], 255, str);
        } else {
            $version = '';
        }
        if (isset($info['author']) && $info['author'] != '') {
            $author = SafeDB($info['author'], 255, str);
        } else {
            $author = '';
        }
        if (isset($info['site']) && $info['site'] != '') {
            $site = SafeDB($info['site'], 255, str);
        } else {
            $site = '';
        }
        if (isset($info['description']) && $info['description'] != '' && $info['description'] != ' - ') {
            $description = SafeDB($info['description'], 0, str, false, false);
        } else {
            $description = 'Нет описания.';
        }
        $templates_html .= '<table width="100%" class="ex-mod">
		<tr onmousedown="ShowBlockInfo(\'tpl' . $mid . '\');">
			<td style="padding-left: 11px; vertical-align: top;">
				<div style="float: left;">
					<div style="float:left; padding-top: 6px;"><img src="' . $icon . '"></div>
					<div style="float:left; padding-top: 7px;">&nbsp;' . $name . ($version != '' ? ' (v' . $version . ')' : '') . ($mod['admin'] == '1' ? ' (Админ-панель)' : '') . '</div>
				</div>
			</td>
			<td width="62" align="center" style="padding: 3px; padding-bottom: 2px;">
				<div style="float: left">' . $func . '</div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div class="mod_info" id="mod_info_tpl' . $mid . '" style="display: none; padding: 4px; padding-left: 11px;">
					<div class="ex-mod-info-description">' . $description . '</div>
		      ' . ($author != '' ? '<div class="ex-mod-info">Автор: ' . $author . '</div>' : '') . '
		      ' . ($site != '' ? '<div class="ex-mod-info">Сайт: <a href="' . $site . '" target="_blank">' . $site . '</a></div>' : '') . '
				</div>
			</td>
		</tr>
		</table>';
    }
    $templates_html .= '</div>';
    // Выводим расширения по вкладкам
    System::admin()->AddOnLoadJS('
	$("#tabs").tabs({
		event: "mousedown",
		beforeLoad: function( event, ui ){ return false; }
	}).css("width", "700px");
	$(".ui-tabs .ui-tabs-panel")
		.css("padding", "0")
		.css("padding-top","3px")
		.css("height", "400px")
		.css("overflow-y", "auto");
');
    $html = '<div id="tabs">
	<ul>
		<li><a href="#tabs-1"><img src="' . MOD_ICON . '" style="vertical-align: bottom;">&nbsp;Модули</a></li>
		<li><a href="#tabs-2"><img src="images/blocks.png" style="vertical-align: bottom;">&nbsp;Блоки</a></li>
		<li><a href="#tabs-3"><img src="images/plugins.png" style="vertical-align: bottom;">&nbsp;Плагины</a></li>
		<li><a href="#tabs-4"><img src="images/skins.png" style="vertical-align: bottom;">&nbsp;Шаблоны</a></li>
	</ul>
	<div id="tabs-1">' . $modules_html . '</div>
	<div id="tabs-2">' . $blocks_html . '</div>
	<div id="tabs-3">' . $plugins_html . '</div>
	<div id="tabs-4">' . $templates_html . '</div>
</div>';
    System::admin()->AddTextBox('Расширения', $style . $html);
}
<?php

if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('ajaxcssjs');
ScriptsAddJs('admin/admin');
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
UseScript('bbcode_editor');
// Активируется вызовом функции BBCodeToolBar
/**
 * Редактор ссылок
 * @return void
 */
function AdminPagesLinkEditor()
{
    UseScript('jquery');
    System::admin()->AddJS(Indent(<<<JS
\t\tSelectLinkType = function(first){
\t\t\tif(first){
\t\t\t\tvar url = \$('#link_url').val();
\t\t\t\t\$('#link_mods > option').prop('selected', false);
\t\t\t\tif(url.substr(0, 6) == 'mod://'){
\t\t\t\t\tvar mod = url.substr(6);
\t\t\t\t\t\$('#link_mod_'+mod).prop('selected', true);
\t\t\t\t\t\$('.link_form_row').hide();
\t\t\t\t}else{
\t\t\t\t\t\$('#link_mod').prop('selected', true);
\t\t\t\t\t\$('.link_form_row').show();
\t\t\t\t}
\t\t\t}else{
\t\t\t\tvar v = \$('#link_mods').val();
\t\t\t\tif(v == ''){
\t\t\t\t\t\$('.link_form_row').fadeIn(1000);
\t\t\t\t}else{
\t\t\t\t\t\$('.link_form_row').hide();
\t\t\t\t}
\t\t\t}
\t\t};
JS
));
    System::admin()->AddOnLoadJS("SelectLinkType(true);");
    $link = '';
    $id = -1;
    $title = '';
    $parent_id = -1;
    if (isset($_GET['parent'])) {
        $parent_id = SafeEnv($_GET['parent'], 11, int);
    }
    $view = array(1 => false, 2 => false, 3 => false, 4 => false);
    $enabled = true;
    $showinmenu = true;
    if (!isset($_GET['id'])) {
        $view[4] = true;
        $form_title = 'Добавить ссылку';
        $submit = 'Добавить';
    } else {
        $id = SafeEnv($_GET['id'], 11, int);
        System::database()->Select('pages', "`id`='{$id}'");
        $pg = System::database()->FetchRow();
        $parent_id = SafeEnv($pg['parent'], 11, int);
        $title = SafeEnv($pg['title'], 255, str);
        $link = SafeEnv($pg['text'], 255, str);
        $view[SafeDB($pg['view'], 1, int)] = true;
        $enabled = SafeDB($pg['enabled'], 1, bool);
        $showinmenu = SafeDB($pg['showinmenu'], 1, bool);
        $form_title = 'Редактирование ссылки';
        $submit = 'Сохранить изменения';
    }
    // Возможные родительские страницы
    $pages = System::database()->Select('pages');
    SortArray($pages, 'order');
    $tree = new Tree($pages);
    $cats_data = $tree->GetCatsData($parent_id, false, true, $id, true);
    // Кто видит
    $visdata = array();
    System::site()->DataAdd($visdata, 'all', 'Все', $view['4']);
    System::site()->DataAdd($visdata, 'members', 'Только пользователи', $view['2']);
    System::site()->DataAdd($visdata, 'guests', 'Только гости', $view['3']);
    System::site()->DataAdd($visdata, 'admins', 'Только администраторы', $view['1']);
    // Модули
    $modules_data = array();
    $mods = System::database()->Select('modules', "`enabled`='1' and `isindex`='1'");
    System::site()->DataAdd($modules_data, '', '--- URL ---', false, 'id="link_mod"');
    foreach ($mods as $mod) {
        $folder = SafeDB($mod['folder'], 255, str);
        System::site()->DataAdd($modules_data, $folder, SafeDB($mod['name'], 255, str), false, 'id="link_mod_' . $folder . '"');
    }
    // Выводим форму
    System::admin()->FormRow('Родительская страница', System::site()->Select('parent_id', $cats_data, false, $parent_id == -1 ? 'class="autofocus"' : ''));
    System::admin()->FormRow('Заголовок', System::site()->Edit('title', $title, false, 'style="width:400px;" maxlength="255"' . ($parent_id != -1 ? ' class="autofocus"' : '')));
    System::admin()->FormRow('Ссылка на модуль', System::site()->Select('module', $modules_data, false, 'id="link_mods" onchange="SelectLinkType();"'));
    System::admin()->FormRow('Ссылка (URL)', System::site()->Edit('link', $link, false, 'style="width:400px;" id="link_url"'), 'class="link_form_row"');
    System::admin()->FormRow('Кто видит', System::site()->Select('view', $visdata));
    System::admin()->FormRow('Показать в меню', System::admin()->Select('showinmenu', GetEnData($showinmenu, 'Да', 'Нет')));
    System::admin()->FormRow('Включить', System::admin()->Select('enabled', GetEnData($enabled, 'Да', 'Нет')));
    System::admin()->AddCenterBox($form_title);
    System::admin()->AddForm(System::admin()->FormOpen(ADMIN_FILE . '?exe=pages&a=savelink' . ($id != -1 ? '&id=' . $id : '')), System::admin()->Button('Отмена', 'onclick="history.go(-1)"') . System::admin()->Submit($submit));
}