function AdminAuditLog() { AddCenterBox('Лог действий администраторов'); $query = System::database()->Select('audit', ''); $count = count($query); if ($count > 0) { if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } SortArray($query, 'date', true); $num = 25; if ($count > $num) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($query, $num, ADMIN_FILE . '?exe=audit&a=log'); $nav = true; } else { $nav = false; } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= Indent('<tr> <th>Пользователь</th> <th>Действие</th> <th>Дата</th> <th>IP</th> </tr>'); foreach ($query as $q) { $user = GetUserInfo(SafeDB($q['user'], 11, int)); $date = TimeRender(SafeDB($q['date'], 11, int)); $action = SafeDB($q['action'], 255, str); $action = nl2br(str_replace(array(' ', "\t"), array(' ', ' '), $action)); $ip = SafeDB($q['ip'], 255, str); $text .= '<tr> <td>' . System::admin()->Link(SafeDB($user['name'], 50, str), ADMIN_FILE . '?exe=admins&a=editadmin&id=' . SafeDB($user['id'], 11, int)) . '</td> <td style="text-align: left;">' . $action . '</td> <td>' . $date . '</td> <td>' . $ip . '</td> </tr>'; } $text .= '</table>'; $text .= System::admin()->SpeedConfirm('Очистить лог', ADMIN_FILE . '?exe=audit&a=clear_log', '', 'Очистить лог действий администраторов?', true, true); AddText($text); if ($nav) { AddNavigation(); } } else { System::admin()->Highlight('Администраторы не произвели никаких действий.'); } }
function AdminCacheMain() { AddCenterBox('Очистка кэша'); if (!System::cache()->Enabled) { if (USE_CACHE) { System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Папка "' . System::cache()->Path . '" не доступна для записи. Функция кэширования отключена.'); } else { System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Функция кэширования отключена в конфигурационном файле "config/config.php".'); } } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>Группа</th><th>Папка</th><th>Записей</th><th>Занимаемое место</th><th>Функции</th></tr>'; $num_rows = 0; $total_size = 0; $groups = System::cache()->GetGroups(); foreach ($groups as $g) { $file_size = 0; $num_files = 0; $folder = System::cache()->Path . $g; $files = scandir($folder); foreach ($files as $file) { if ($file != '.' && $file != '..') { $f = $folder . '/' . $file; if (!is_dir($f)) { $file_size += filesize($f); } $num_files++; } } $func = SpeedButton('Очистить', ADMIN_FILE . '?exe=cache&a=clear&group=' . SafeDB($g, 255, str), 'images/admin/cleanup.png'); $rows = floor($num_files / 2); $text .= '<tr>' . '<td>' . SafeDB($g, 255, str) . '</td>' . '<td>' . SafeDB($folder, 255, str) . '</td>' . '<td>' . $rows . '</td>' . '<td>' . FormatFileSize($file_size) . '</td>' . '<td>' . $func . '</td>' . '</tr>'; $num_rows += $rows; $total_size += $file_size; } $text .= '</table><br />'; $text .= 'Итого <b>' . count($groups) . '</b> групп(ы), <b>' . $num_rows . '</b> записей и <b>' . FormatFileSize($total_size) . '</b> занято. ' . System::admin()->SpeedButton('Очистить все группы', ADMIN_FILE . '?exe=cache&a=cleanup', '', true, true); $text .= '<br /><br />'; AddText($text); }
function AdminUserAvatarsGallery() { global $galeryedit; TAddSubTitle('Галерея аватар'); if (isset($_GET['user']) && $_GET['user'] == '1') { $personal = true; $dir = System::config('general/personal_avatars_dir'); $dirlink = System::admin()->Link('Показать аватары из галереи', ADMIN_FILE . '?exe=user&a=avatars'); $users = System::database()->Select('users', "`type`='2'"); $c = sizeof($users); for ($i = 0; $i < $c; $i++) { $users[$users[$i]['avatar']] = $i; } } else { $personal = false; $dir = System::config('general/avatars_dir'); $dirlink = System::admin()->Link('Показать аватары пользователей', ADMIN_FILE . '?exe=user&a=avatars&user=1'); } $avatars2 = GetFiles($dir, false, true, '.gif.jpg.jpeg.png'); $avatars = array(); foreach ($avatars2 as $av) { $name = GetFileName($av, true); $sub = substr($name, -3); if ($sub != 'x24' && $sub != 'x64') { $avatars[] = $av; } } $c = count($avatars); $allsize = 0; $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; if ($c > 0) { $col = 0; for ($i = 0; $i < $c; $i++) { if ($col == 0) { $text .= '<tr>'; } $col++; $imagfn = $dir . $avatars[$i]; $size = getimagesize($imagfn); $fsize = filesize($imagfn); $allsize = $allsize + $fsize; if ($galeryedit) { $funcs = System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=user&a=delavatar&filename=' . $avatars[$i] . ($personal ? '&personal' : ''), 'images/admin/delete.png', 'Удалить аватар?'); } else { $funcs = ' '; } $text .= '<td align="center"> <table cellspacing="0" cellpadding="0" align="center" style="border:none; background: none;"> <tr style="border:none; background: none;"> <td style="border:none; background: none;"><a href="' . $imagfn . '" target="_blank"><img src="' . $imagfn . '" border="0" width="64" title="(' . $size[0] . ' x ' . $size[1] . ', ' . FormatFileSize($fsize) . ') ' . $avatars[$i] . '" /></a></td> <td valign="top" style="border:none; background: none;">' . $funcs . '</td> </tr> '; if ($personal && isset($users[$avatars[$i]])) { $text .= '<tr><td colspan="2" align="left" style="border:none; background: none;"><a href="' . ADMIN_FILE . '?exe=user&a=edituser&id=' . SafeDB($users[$users[$avatars[$i]]]['id'], 11, int) . '">' . SafeDB($users[$users[$avatars[$i]]]['name'], 255, str) . '</a></td></tr>'; } $text .= '</table></td>'; if ($col == 5) { $text .= '</tr>'; $col = 0; } } if ($col < 5) { $text .= '<td colspan="' . (5 - $col) . '"></td>'; $text .= '</tr>'; } } else { $text .= '<tr><td>В галерее нет ни одного аватара.</td></tr>'; } $text .= '</table>'; $info = '<table cellspacing="0" cellpadding="0" border="0" class="cfgtable"> <tr> <td width="34%">Аватар в галерее: ' . $c . '</td> <td width="33%">Общий размер: ' . FormatFileSize($allsize) . '</td> <td>' . $dirlink . '</td> </tr> </table>'; $text = $info . $text; AddCenterBox('Галерея аватар', $text); AddText($text); if (!$personal && $galeryedit) { System::admin()->FormTitleRow('Загрузить аватар'); FormRow('Выберите файл', System::site()->FFile('avatar')); AddForm(System::site()->FormOpen(ADMIN_FILE . '?exe=user&a=saveavatar', 'post', true), System::site()->Submit('Загрузить')); } AddText('<br />'); }
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ if (!defined('VALID_RUN')) { header("HTTP/1.1 404 Not Found"); exit; } if (isset($_GET['ok'])) { $ok = $_GET['ok']; } else { $ok = false; } if ($ok) { System::database()->DropTable(SafeEnv($_GET['name'], 255, str)); Audit('Управление БД: Удаление таблицы "' . $_GET['name'] . '"'); GO(ADMIN_FILE . '?exe=dbadmin'); } else { $name = SafeDB($_GET['name'], 255, str); AddCenterBox('Удаление таблицы'); System::admin()->HighlightConfirm('Вы действительно хотите удалить таблицу "' . $name . '"?', ADMIN_FILE . '?exe=dbadmin&a=droptable&name=' . $name . '&ok=1'); AdminFdbAdminGenTableMenu($name); }
function AdminCommentsEdit() { if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } $id = SafeEnv($_GET['id'], 11, int); $table = SafeEnv($_GET['table'], 255, str); System::database()->Select($table, "`id`='{$id}'"); $post = System::database()->FetchRow(); $user_id = SafeDB($post['user_id'], 11, int); $user_name = SafeDB($post['user_name'], 255, str); $user_homepage = SafeDB($post['user_homepage'], 255, str); $user_email = SafeDB($post['user_email'], 255, str); $user_hideemail = $post['user_hideemail'] == 1 ? true : false; $user_ip = SafeDB($post['user_ip'], 19, str); $post_message = SafeDB($post['post_message'], 0, str, false); if ($user_id == 0) { FormRow('Имя', System::admin()->Edit('user_name', $user_name, false, 'style="width:400px;" class="autofocus"')); FormRow('E-mail', System::admin()->Edit('user_email', $user_email, false, 'style="width:400px;"')); FormRow('Скрыть e-mail', System::admin()->Check('user_hideemail', '1', $user_hideemail)); FormRow('Сайт', System::admin()->Edit('user_homepage', $user_homepage, false, 'style="width:400px;"')); } FormRow('Текст', System::admin()->TextArea('post_message', $post_message, 'style="width:400px;height:200px;"' . ($user_id != 0 ? ' class="autofocus"' : ''))); $action = ADMIN_FILE . '?exe=comments&a=save&id=' . $id . '&table=' . $table . '&page=' . $page; AddCenterBox('Редактирование комментария'); AddForm('<form action="' . $action . '" method="post">', System::admin()->Button('Отмена', 'onclick="history.go(-1)"') . System::admin()->Submit('Сохранить')); }
function AdminConfigGroupDelete() { $back_url = ''; if (!AdminConfigPlugins()) { $back_url = ADMIN_FILE . '?exe=config_admin&a=view_groups&delok'; } else { $back_url = ADMIN_FILE . '?exe=config_admin&a=view_groups_plugins&plugins=1&delok'; } if (!isset($_GET['id'])) { GO($back_url); } else { $id = SafeEnv($_GET['id'], 11, int); } if (isset($_GET['ok']) && $_GET['ok'] == '1' || IsAjax()) { System::database()->Select(AdminConfigGroupTable(), "`id`='{$id}'"); $conf = System::database()->FetchRow(); System::database()->Delete(AdminConfigGroupTable(), "`id`='{$id}'"); System::database()->Delete(AdminConfigConfigTable(), "`group_id`='{$id}'"); Audit('Управление настройками: Удаление группы настроек "' . $conf['hname'] . '(' . $conf['name'] . ')" в "' . AdminConfigGroupTable() . '"'); GO($back_url); } else { $r = System::database()->Select(AdminConfigGroupTable(), "`id`='{$id}'"); AddCenterBox('Удаление группы навтроек'); System::admin()->HighlightConfirm('Это может повлиять на работу системы. Нажмите отмена, если не уверены. Удалить группу настроек "' . SafeDB($r[0]['hname'], 255, str) . '"?', ADMIN_FILE . '?exe=config_admin&a=delete&id=' . $id . '&ok=1' . (AdminConfigPlugins() ? '&plugins=1' : '')); } }
if ($action == 'editfield') { if (isset($_GET['where'])) { $where = $_GET['where']; $where_url = '&where=' . SafeDB($_GET['where'], 255, str); } $edit = true; $index = SafeEnv($_GET['index'], 255, int); $rows = System::database()->Select($table, $where); $row = $rows[$index]; } $i = 0; foreach ($columns as $col) { if ($edit) { $val = HtmlChars($row[$columns[$i]['name']]); $cap = 'Сохранить'; $title = 'Редактирование записи'; } else { $val = ''; $cap = 'Добавить'; $title = 'Добавление записи'; } if (strtolower($col['type']) != 'text') { FormRow('<font color="#0000FF">' . (isset($col['auto_increment']) && $col['auto_increment'] == true ? '<u>' . $col['name'] . '</u>' : $col['name']) . '</font>' . '<br /><font color="#666666">' . $col['type'] . (isset($col['length']) ? '(' . $col['length'] . ')</font>' : '</font>'), System::admin()->Edit($col['name'], $val, false, 'style="width: 400px;"' . ($i == 0 ? ' class="autofocus"' : ''))); } else { FormRow('<font color="#0000FF">' . $col['name'] . '</font>', System::admin()->TextArea($col['name'], $val, 'style="width: 400px; height: 200px;"' . ($i == 0 ? ' class="autofocus"' : ''))); } $i++; } AddCenterBox($title); AddForm('<form action="' . ADMIN_FILE . '?exe=dbadmin&a=' . ($edit ? 'editsave' : 'insertsave') . '&name=' . $table . ($edit ? '&index=' . $index : '') . $where_url . $back . '" method="post">', ($edit ? System::site()->Button('Отмена', 'onclick="history.go(-1)"') : '') . System::admin()->Submit($cap)); AdminFdbAdminGenTableMenu($table);
/** * Редактирование категории * @return void */ function AdminPagesCatEditor() { $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); $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']); FormRow('Родительская страница', System::site()->Select('parent_id', $cats_data, false, $parent_id == -1 ? 'class="autofocus"' : '')); FormRow('Заголовок', System::site()->Edit('title', $title, false, 'style="width:400px;" maxlength="255"' . ($parent_id != -1 ? ' class="autofocus"' : ''))); FormRow('Кто видит', System::site()->Select('view', $visdata)); FormRow('Показать в меню', System::admin()->Select('showinmenu', GetEnData($showinmenu, 'Да', 'Нет'))); FormRow('Включить', System::admin()->Select('enabled', GetEnData($enabled, 'Да', 'Нет'))); AddCenterBox($form_title); AddForm('<form action="' . ADMIN_FILE . '?exe=pages&a=savecat' . ($id != -1 ? '&id=' . $id : '') . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1)"') . System::site()->Submit($submit)); }
/** * Генерирует форму редактирования пользователя в админ-панели. * * @param $save_link Ссылка на обработчик формы (имя модуля и параметр action) * @param string $a Добавление или редавтирование пользователя (edit or add) * @param int $id Идентификатор пользователя * @param bool $isadmin Редактирование администратора (влияет на выборку и отключает активацию по email) * @param bool $EditProfile Редактирование своего профиля администратором (не может изменить свой статус если не системный администратор) * @return */ function AdminUserEditor($save_link, $a = 'add', $id = '0', $isadmin = false) { $active = array(false, false, false); $SystemAdmin = System::user()->isSuperUser(); $edit = $a == 'edit'; $editProfile = $edit && !$SystemAdmin && $id == System::user()->Get('u_id'); // Администратор редактирует свой профиль $editStatus = false; // Разрешено редактирование статуса $editType = false; // Разрешено редавтировать тип пользователя // Загружаем данные пользователя из БД if ($edit) { $user = System::database()->SelectOne('users', "`id`='{$id}'" . ($isadmin ? " and `type`='1'" : " and `type`='2'")); if (!$user) { AddTextBox('Ошибка', '<p align="center">Пользователь не найден, либо у вас не достаточно прав для редактирования администраторов.</p>'); return; } } // Устатанавливаем ограничения доступа if ($isadmin) { // Редатируем администратора if ($SystemAdmin) { // Только системные администаторы могут редактировать статус и тип администраторов if (!(groupIsSystem(SafeEnv($user['access'], 11, int)) && GetSystemAdminsCount() <= 1)) { // Если он не системный или системных больше 1 $editStatus = true; } $editType = $editStatus; } } else { // Если пользователь $editStatus = true; // Все администраторы с доступом могут редактировать статус пользователя $editType = $SystemAdmin; // Только системные администраторы могут создавать администраторов } if ($editType) { $user_types_db = System::database()->Select('usertypes'); $types = array('member' => array('member', 'Пользователь', false)); foreach ($user_types_db as $type) { $types[$type['id']] = array(SafeDB($type['id'], 11, int), SafeDB($type['name'], 255, str), false); } } if ($edit) { $login = SafeDB($user['login'], 30, str); $mail = SafeDB($user['email'], 50, str); $hideemail = $user['hideemail'] == 1 ? true : false; $snews = $user['servernews'] == 1 ? true : false; $name = SafeDB($user['name'], 50, str); $tname = SafeDB($user['truename'], 250, str); $age = SafeDB($user['age'], 11, str); $city = SafeDB($user['city'], 100, str); $url = SafeDB($user['url'], 250, str); $icq = SafeDB($user['icq'], 15, str); $gmt = SafeDB($user['timezone'], 255, str); $about = SafeDB($user['about'], 0, str); $avatar = SafeDB($user['avatar'], 250, str); $apersonal = SafeDB($user['a_personal'], 1, int); if ($editStatus) { if ($user['active'] == '1') { $active[0] = true; } elseif ($user['active'] == '0' && $user['activate'] == '') { $active[1] = true; } elseif ($user['active'] == '0' && $user['activate'] != '') { $active[2] = true; } } if ($editType) { if ($user['type'] == '1') { $types[$user['access']][2] = true; } else { $types['member'][2] = true; //пользователь } } $caption = 'Сохранить'; if ($isadmin) { if ($editProfile) { $title = 'Редактирование профиля'; } else { $title = 'Редактирование администратора'; } } else { $title = 'Редактирование пользователя'; } } else { $login = ''; $mail = ''; $snews = false; $hideemail = false; $name = ''; $tname = ''; $age = ''; $city = ''; $url = ''; $icq = ''; $gmt = System::config('general/default_timezone'); $about = ''; $avatar = ''; $apersonal = '0'; if ($editStatus) { $active[0] = true; } if ($editType) { $types['member'][2] = true; } $caption = 'Добавить'; $title = 'Добавить пользователя'; } FormRow('Логин', System::site()->Edit('login', $login, false, 'style="width:400px;" class="autofocus"')); FormRow('Пароль', System::site()->Edit('pass', '', true, 'style="width:400px;"')); FormRow('Повторите пароль<br /><small>(для проверки)</small>', System::site()->Edit('rpass', '', true, 'style="width:400px;"')); FormRow('E-mail', System::site()->Edit('email', $mail, false, 'style="width:300px;"') . ' <label for="hideemail">Скрыть</label> ' . System::site()->Check('hideemail', '1', $hideemail, 'id="hideemail"')); FormRow('<label for="snews">Рассылка</label>', System::site()->Check('snews', '1', $snews, 'id="snews"')); FormRow('Ник', System::site()->Edit('nikname', $name, false, 'style="width:400px;"')); FormRow('Настоящее имя', System::site()->Edit('realname', $tname, false, 'style="width:400px;"')); FormRow('Возраст', System::site()->Edit('age', $age, false, 'style="width:400px;"')); FormRow('Город', System::site()->Edit('city', $city, false, 'style="width:400px;"')); FormRow('Сайт', System::site()->Edit('homepage', $url, false, 'style="width:400px;"')); FormRow('ICQ', System::site()->Edit('icq', $icq, false, 'style="width:400px;"')); $gmt = GetGmtData($gmt); FormRow('Часовой пояс', System::site()->Select('gmt', $gmt, false, 'style="width:400px;"')); FormRow('О себе', System::site()->TextArea('about', $about, 'style="width:400px; height:200px;"')); $avatars = GetGalleryAvatarsData($avatar, $apersonal); if ($apersonal == '1') { $selected = GetPersonalAvatar($id); } else { $selected = GetGalleryAvatar($avatars[1]); } System::site()->AddJS(' ShowAvatar = function(){ if(document.userform.avatar.value==\'\'){ document.userform.avatarview.src = \'' . (System::config('user/secure_avatar_upload') ? 'index.php?name=plugins&p=avatars_render&user='******'general/personal_avatars_dir') . $avatar) . '\'; }else{ document.userform.avatarview.src = \'' . (System::config('user/secure_avatar_upload') ? 'index.php?name=plugins&p=avatars_render&aname=' : System::config('general/avatars_dir')) . '\'+document.userform.avatar.value; } }'); FormRow('Аватар', System::site()->Select('avatar', $avatars[0], false, 'onchange="ShowAvatar();"')); FormRow('', '<img id="avatarview" src="' . $selected . '" border="0">'); FormRow('Загрузить аватар', System::site()->FFile('upavatar')); if ($editStatus) { FormRow('Активация', System::site()->Radio('activate', 'auto', $active[0]) . 'Активировать' . System::site()->Radio('activate', 'manual', $active[1]) . 'Не активировать' . (!$isadmin ? System::site()->Radio('activate', 'mail', $active[2]) . 'По E-mail' : '')); } if ($editType) { $user_types = array(); foreach ($types as $type) { System::site()->DataAdd($user_types, $type[0], $type[1], $type[2]); } FormRow('Статус', System::site()->Select('status', $user_types)); } TAddSubTitle($title); AddCenterBox($title); AddForm('<form name="userform" action="' . ADMIN_FILE . '?exe=' . $save_link . '&id=' . $id . '" method="post" enctype="multipart/form-data">', System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit($caption)); }
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ // Оптимизация всех таблиц БД AddCenterBox('Оптимизация'); if (System::database()->Name != 'MySQL') { System::admin()->HighlightError('Только MySQL базы данных.'); return; } $iferrors = false; $tables = System::database()->GetTableInfo(); System::database()->MySQLQuery('LOCK TABLES'); foreach ($tables as $table) { $table = System::database()->Prefix() . $table['name']; if (System::database()->MySQLQuery('OPTIMIZE TABLE `' . $table . '`') == false) { System::admin()->HighlightError(System::database()->MySQLGetErrMsg() . ' (' . $table . ')'); $iferrors = true; } } Audit('Управление БД: Оптимизация'); System::database()->MySQLQuery('UNLOCK TABLES'); if ($iferrors) { System::admin()->Highlight('Произошли ошибки при оптимизации некоторых таблиц.'); } else { System::admin()->Highlight('Все таблицы успешно оптимизированы.'); }
function AdminGalleryUpload() { // TODO: неправильный порядок изображений при мультизагрузке if (!isset($_POST['action']) || !isset($_GET['formid']) || !isset($_SESSION['uploadforms'][$_GET['formid']])) { AdminGalleryUploadForm(); return; } global $GalleryDir, $ThumbsDir; $formid = $_GET['formid']; // Загрузка фотографий if ($_POST['action'] == 'upload') { // SwfUpload кодирует имена файлов в UTF-8 $_FILES['up_image']['name'] = Utf8ToCp1251($_FILES['up_image']['name']); $Error = false; $_SESSION['uploadforms'][$formid]['photos'][] = LoadImage('up_image', $GalleryDir, $ThumbsDir, System::config('gallery/thumb_max_width'), System::config('gallery/thumb_max_height'), '', $Error, true, System::config('gallery/optimize_originals'), System::config('gallery/original_width'), System::config('gallery/original_height')); if ($Error) { exit('ERROR 2'); } exit('OK'); } // Предпросмотр добавляемых фотографий $_SESSION['uploadforms'][$formid]['category'] = $_POST['category']; $_SESSION['uploadforms'][$formid]['allow_comments'] = EnToInt($_POST['allow_comments']); $_SESSION['uploadforms'][$formid]['allow_votes'] = EnToInt($_POST['allow_votes']); $_SESSION['uploadforms'][$formid]['show'] = EnToInt($_POST['show']); $_SESSION['uploadforms'][$formid]['view'] = ViewLevelToInt($_POST['view']); AddCenterBox('Мультизагрузка - предпросмотр'); $count_photos = count($_SESSION['uploadforms'][$formid]['photos']); $text = '<form action="' . ADMIN_FILE . '?exe=gallery&a=saveuploaded&formid=' . $formid . '" method="post">'; $submits = System::admin()->Submit('Отмена', 'name="submit_cancel" value="cancel"') . System::admin()->Submit('Сохранить', 'name="submit_save" value="save"'); $text .= '<div class="cfgboxsubmit"><div style="float: left;">Загружено ' . $count_photos . ' изображений.</div>' . $submits . '</div>'; foreach ($_SESSION['uploadforms'][$formid]['photos'] as $id => $photo) { $func = System::admin()->SpeedAjax('Удалить', ADMIN_FILE . '?exe=gallery&a=deleteuploaded&id=' . $id . '&formid=' . $formid, 'images/admin/delete.png', '', '', "jQuery('#photo_box_{$id}').fadeOut();"); $text .= Indent(' <div class="cfgbox" id="photo_box_' . $id . '"> <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;"> <tr> <td style="vertical-align: top; width: 160px;"> <a href="' . $GalleryDir . $photo . '" target="_blank"><img src="' . $ThumbsDir . $photo . '" /></a> ' . $photo . ' </td> <td style="vertical-align: top;"> <table cellspacing="2" cellpadding="4" style="width: 100%;" class="cfgtable"> <tr> <td>Заголовок</td> <td colspan="3" style="text-align: left;">' . System::admin()->Edit('title_' . $id, '', false, 'maxlength="250" style="width:400px;"') . '</td> </tr> <tr> <td>Описание (HTML)</td> <td colspan="3" style="text-align: left;">' . System::admin()->TextArea('description_' . $id, '', 'style="width: 400px; height: 120px;"') . '</td> </tr> <tr> <td>Автор</td> <td style="text-align: left;">' . System::admin()->Edit('author_' . $id, '', false, 'maxlength="250" style="width:200px;"') . '</td> <td>Email автора</td> <td style="text-align: left;">' . System::admin()->Edit('email_' . $id, '', false, 'maxlength="250" style="width:200px;"') . '</td> </tr> <tr> <td>Сайт автора</td> <td colspan="3" style="text-align: left;">' . System::admin()->Edit('www_' . $id, '', false, 'maxlength="250" style="width:200px;"') . '</td> </tr> </table> </td> <td style="vertical-align: top; text-align: right; width: 50px;">' . $func . '</td> </tr> </table> </div> '); } $text .= '<div class="cfgboxsubmit">' . $submits . '</div>'; $text .= '</form>'; AddText($text); }
function AdminForumEditor() { $site = System::site(); $f_title = ''; $f_desc = ''; if (CheckGet('parent')) { $f_parent = SafeDB($_GET['parent'], 11, int); } else { $f_parent = 0; } $f_view = 4; $f_status = 1; $f_admin_theme_add = array(false, false); $f_new_message_email = array(false, true); $f_no_link_guest = array(false, false); $rang_access = 0; $rang_add_theme = 0; $rang_message = 0; $close_topic = array(false, false); if (isset($_GET['id'])) { // Редактирование $id = SafeDB($_GET['id'], 11, int); System::database()->Select('forums', "`id`='{$id}'"); $forum = System::database()->FetchRow(); $f_title = SafeDB($forum['title'], 255, str); $f_desc = SafeDB($forum['description'], 0, str); $f_parent = SafeDB($forum['parent_id'], 11, int); $f_admin_theme_add[(int) $forum['admin_theme_add']] = true; $f_new_message_email[(int) $forum['new_message_email']] = true; $f_no_link_guest[(int) $forum['no_link_guest']] = true; $rang_access = SafeDB($forum['rang_access'], 11, int); $rang_add_theme = SafeDB($forum['rang_add_theme'], 11, int); $rang_message = SafeDB($forum['rang_message'], 11, int); $close_topic[(int) $forum['close_topic']] = true; $f_view = SafeDB($forum['view'], 1, int); $f_status = SafeDB($forum['status'], 1, int); $id_param = '&id=' . $id; $b_cap = 'Сохранить изменения'; if ($f_parent == 0) { $c_cap = 'Редактирование категории'; } else { $c_cap = 'Редактирование форума'; } } else { // Добавление $f_title = ''; $f_admin_theme_add[0] = true; $f_new_message_email[1] = true; $f_no_link_guest[0] = true; $close_topic[0] = true; $id_param = ''; $b_cap = 'Добавить'; if ($f_parent == 0) { $c_cap = 'Добавить категорию'; } else { $c_cap = 'Добавить форум'; } } FormRow('Название', $site->Edit('title', $f_title, false, 'style="width:400px;" maxlength="255" class="autofocus"')); if ($f_parent != 0) { $where = ''; if (isset($_GET['id'])) { $where = " `id`<>'" . SafeEnv($_GET['id'], 11, int) . "'"; } $forums = System::database()->Select('forums', $where); $cat = false; if (count($forums) == 0) { $cat = false; } else { foreach ($forums as $forum) { if ($forum['parent_id'] == 0) { $cat = true; } } } SortArray($forums, 'order'); $tree = ForumTree::Instance($forums); $tree->NumItemsCaption = ''; $tree->TopCatName = 'Нет родительского раздела'; $data = array(); if ($cat) { $data = $tree->GetCatsDataF($f_parent, true, true); } else { $site->DataAdd($data, 0, $tree->TopCatName, true); } FormRow('Родительский раздел', $site->Select('sub_id', $data)); FormTextRow('Описание', $site->HtmlEditor('desc', $f_desc, 600, 200)); } System::admin()->FormTitleRow('Настройки форума'); $endata = array(); $site->DataAdd($endata, '1', 'Да', $f_admin_theme_add[1]); $site->DataAdd($endata, '0', 'Нет', $f_admin_theme_add[0]); FormRow('', 'Только администраторы могут создавать новые темы: ' . $site->Select('admin_theme_add', $endata)); $endata = array(); $site->DataAdd($endata, '1', 'Да', $f_no_link_guest[1]); $site->DataAdd($endata, '0', 'Нет', $f_no_link_guest[0]); FormRow('', 'Скрывать ссылки от гостей: ' . $site->Select('no_link_guest', $endata)); $endata = array(); $site->DataAdd($endata, '1', 'Да', $f_new_message_email[1]); $site->DataAdd($endata, '0', 'Нет', $f_new_message_email[0]); FormRow('', 'Разрешить подписку на уведомление о новых сообщениях в теме: ' . $site->Select('new_message_email', $endata)); $endata = array(); $site->DataAdd($endata, '1', 'Да', $close_topic[1]); $site->DataAdd($endata, '0', 'Нет', $close_topic[0]); FormRow('', 'Закрыть для обсуждения (будет доступен только просмотр): ' . $site->Select('close_topic', $endata)); System::admin()->FormTitleRow('Настройка прав доступа по рангам пользователей'); FormRow('Доступ (с меньшим рангом доступ будет закрыт)', ForumAdminGetUsersTypesComboBox('rang_access', $rang_access)); FormRow('Создание тем (с меньшим рангом темы создавать будет запрещено)', ForumAdminGetUsersTypesComboBox('rang_add_theme', $rang_add_theme)); FormRow('Создание сообщений в теме (с меньшим рангом сообщения создавать будет запрещено)', ForumAdminGetUsersTypesComboBox('rang_message', $rang_message)); System::admin()->FormTitleRow('Параметры видимости'); FormRow('Видят', $site->Select('view', GetUserTypesFormData($f_view))); FormRow('Включить', $site->Select('status', GetEnData($f_status, 'Да', 'Нет'))); FormRow('Внимание', 'Ограничения прав и видимости действует на все дочерние форумы.'); AddCenterBox($c_cap); AddForm($site->FormOpen(ADMIN_FILE . '?exe=forum&a=forum_save' . $id_param), $site->Submit($b_cap)); }
$totalrows = 0; $light = array(); $i = 0; foreach ($tables as $r) { $i++; $name = SafeDb($r['name'], 255, str); $a = ''; if ($sort == 'name') { $F = SafeDb($r['name'], 1, str); if (!isset($light[$F])) { $light[$F] = $F; $a = '<span style="float:right; font-size:18px; margin-right:10px;"><b>' . strtoupper($F) . '</b></span>'; } } $func = SpeedButton('PHP код для создания', ADMIN_FILE . '?exe=dbadmin&a=viewtablecode&name=' . $name, 'images/admin/php.png'); $func .= SpeedButton('Переименовать', ADMIN_FILE . '?exe=dbadmin&a=renametable&name=' . $name, 'images/admin/rename.png'); if ($last_backup_name != '') { $func .= System::admin()->SpeedConfirm('Восстановить из последней резервной копии', ADMIN_FILE . '?exe=dbadmin&a=backup_restore&name=' . $last_backup_name . '&table=' . $name, 'images/admin/restore.png', 'Все текущие данные будут затёрты. Восстановить таблицу из последней резервной копии БД?'); } $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=dbadmin&a=droptable&name=' . $name . '&ok=0', 'images/admin/delete.png', 'Удалить таблицу?'); $text .= '<tr>' . '<td style="text-align:left; padding-left:10px;">' . $i . $a . '</td>' . '<td align="left" style="text-align:left; padding-left:10px;"><b>' . System::admin()->Link($name, ADMIN_FILE . '?exe=dbadmin&a=structure&name=' . $name) . '</b></td>' . '<td>' . $r['num_rows'] . '</td>' . '<td>' . FormatFileSize($r['size']) . '</td>' . '<td>' . (isset($r['type']) ? $r['type'] : 'По умолчанию') . '</td>' . '<td class="cfgtd">' . $func . '</td>' . '</tr>'; $totalsize += $r['size']; $totalrows += $r['num_rows']; System::admin()->BreadCrumbMenuItem($name, 'exe=dbadmin&a=structure&name=' . $name); } $text .= '</table><br><br>'; $top_text .= '<strong>Таблиц</strong>: ' . System::database()->NumRows() . '<br>'; $top_text .= '<strong>Всего записей</strong>: ' . $totalrows . '<br>'; $top_text .= '<strong>Общий размер</strong>: ' . FormatFileSize($totalsize) . '<br>'; AddCenterBox('Обзор таблиц (' . System::database()->NumRows() . ')'); AddText($text);
function AdminFormsEditFields() { AddCenterBox('Редактирование поля'); AdminFormsFieldEditor('edit'); }
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ if (!defined('VALID_RUN')) { header("HTTP/1.1 404 Not Found"); exit; } if (isset($_GET['ok'])) { $ok = $_GET['ok']; } else { $ok = false; } if ($ok) { System::database()->Truncate(SafeEnv($_GET['name'], 255, str)); Audit('Управление БД: Очистка таблицы "' . $_GET['name'] . '"'); GO(ADMIN_FILE . '?exe=dbadmin&a=review&name=' . SafeDB($_GET['name'], 255, str)); } else { $name = SafeDB($_GET['name'], 255, str); AddCenterBox('Очистка таблицы'); System::admin()->HighlightConfirm('Вы действительно хотите очистить таблицу "' . $name . '" от записей?', ADMIN_FILE . '?exe=dbadmin&a=truncatetable&name=' . $name . '&ok=1'); AdminFdbAdminGenTableMenu($name); }
function AdminSiteMessagesEditor() { $title = ''; $text = ''; $showin = array('ALL_EXCEPT'); $extrauri = array(); $time = '0'; $view = 4; $enabled = 1; $view_title = array(false, false); $position = array(false, false); $resettime = ''; if (!isset($_GET['id'])) { $view_title[1] = true; $position[1] = true; $url = ''; $btitle = 'Создать сообщение'; $method = 'Создать'; $a = 'add'; } else { $id = SafeEnv($_GET['id'], 11, int); System::database()->Select('messages', "`id`='{$id}'"); $msg = System::database()->FetchRow(); $title = SafeDB($msg['title'], 250, str); $text = SafeDB($msg['text'], 0, str, false); $time = SafeDB($msg['expire'], 11, int); if ($time != '0') { $total = TotalTime(time(), SafeDB($msg['date'], 11, int) + Day2Sec * SafeDB($msg['expire'], 11, int)); $resettime = 'Осталось времени ' . $total['sdays'] . ' и ' . $total['shours']; } $showin = unserialize($msg['showin']); $extrauri = unserialize($msg['showin_uri']); $view_title[SafeDB($msg['view_title'], 1, int)] = true; $position[SafeDB($msg['position'], 1, int)] = true; $view = SafeDB($msg['view'], 1, int); $enabled = SafeDB($msg['active'], 1, int); $url = '&id=' . $id; $btitle = 'Редактирование сообщения'; $method = 'Сохранить изменения'; $a = 'edit'; } FormRow('Заголовок', System::site()->Edit('title', $title, false, 'maxlength="250" style="width:400px;" class="autofocus"')); FormRow('Показывать заголовок', System::site()->Radio('vtitle', 'on', $view_title[1]) . 'Да ' . System::site()->Radio('vtitle', 'off', $view_title[0]) . 'Нет'); FormTextRow('Текст сообщения', System::site()->HtmlEditor('text', $text, 625, 300)); FormRow('Отображать дней:<br /><small> (0 - неограниченно)</small>', System::site()->Edit('time', $time, false, 'maxlength="3" style="width:40px;"') . $resettime); if ($a == 'edit') { FormRow('Сбросить таймер', System::site()->Check('resettime', '1', false)); } VisibilityConditionsAdmin($showin, $extrauri); System::site()->DataAdd($posd, 'top', 'Вверху', $position[1]); System::site()->DataAdd($posd, 'bottom', 'Внизу', $position[0]); FormRow('Положение', System::site()->Select('position', $posd)); FormRow('Кто видит', System::site()->Select('view', GetUserTypesFormData($view))); FormRow('Включить', System::site()->Select('enabled', GetEnData($enabled))); AddCenterBox($btitle); AddForm('<form action="' . ADMIN_FILE . '?exe=messages&a=save' . $url . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1)"') . System::site()->Submit($method)); }
function AdminArticlesEditor() { global $editarticles; if (!$editarticles) { System::admin()->AccessDenied(); } $cat_id = isset($_GET['to']) ? SafeDB($_GET['to'], 11, int) : 0; $author = ''; $email = ''; $www = ''; $title = ''; $description = ''; $article = ''; $image = ''; $auto_br_desc = false; $auto_br_article = false; $allow_comments = true; $allow_votes = true; $view = 4; $active = true; //Модуль SEO $seo_title = ''; $seo_keywords = ''; $seo_description = ''; // $form = 0; $product_id = ''; if (!isset($_GET['id'])) { $action = 'add'; $top = 'Добавить статью'; $cap = 'Добавить'; } else { $id = SafeEnv($_GET['id'], 11, str); System::database()->Select('articles', "`id`='{$id}'"); $art = System::database()->FetchRow(); $cat_id = SafeDB($art['cat_id'], 11, int); $author = SafeDB($art['author'], 200, str); $email = SafeDB($art['email'], 50, str); $www = SafeDB($art['www'], 250, str); $title = SafeDB($art['title'], 255, str); $description = SafeDB($art['description'], 0, str, false); $article = SafeDB($art['article'], 0, str, false); $image = SafeDB($art['image'], 250, str); $auto_br_article = SafeDB($art['auto_br_article'], 1, bool); $auto_br_desc = SafeDB($art['auto_br_desc'], 1, bool); $active = SafeDB($art['active'], 1, bool); $allow_comments = SafeDB($art['allow_comments'], 1, int); $allow_votes = SafeDB($art['allow_votes'], 1, int); $view = SafeDB($art['view'], 1, int); //Модуль SEO $seo_title = SafeDB($art['seo_title'], 255, str); $seo_keywords = SafeDB($art['seo_keywords'], 255, str); $seo_description = SafeDB($art['seo_description'], 255, str); // $form = SafeDB($art['form'], 11, int); $product_id = SafeDB($art['product_id'], 255, str); $action = 'save&id=' . $id; $top = 'Редактирование статьи'; $cap = 'Сохранить изменения'; } System::admin()->AddJS(Indent(' ArticlesPreviewOpen = function(){ if(tinyMCE){ tinyMCE.triggerSave(); } var form_data = Admin.SerializeFormData(document.forms.edit_form); var left = parseInt(screen.width / 2) - 400; var top = parseInt(screen.height / 10); var wp = window.open("", "Preview", "resizable=yes,scrollbars=yes,menubar=no,status=no,location=no,width=800,height=600,left="+left+",top="+top+""); wp.document.open(); $.ajax({ type: "POST", url: "' . ADMIN_FILE . '?exe=articles&a=preview", data: form_data, dataType: "html", success: function(data){ wp.document.write(data); wp.document.close(); } }); } ')); $cats_data = AdminArticlesGetTree()->GetCatsData($cat_id); if (count($cats_data) == 0) { $back_to_form = SaveRefererUrl(); AddTextBox($top, 'Нет категорий для добавления! ' . System::admin()->SpeedButton('Добавить категорию', ADMIN_FILE . '?exe=articles&a=cateditor&back=' . $back_to_form, '', true, true)); return; } FormRow('В категорию', System::site()->Select('category', $cats_data, false, $cat_id == 0 ? 'class="autofocus"' : '')); FormRow('Заголовок', System::site()->Edit('title', $title, false, 'maxlength="250" style="width:400px;"' . ($cat_id != 0 ? 'class="autofocus"' : ''))); //Модуль SEO FormRow('[seo] Заголовок страницы', System::site()->Edit('seo_title', $seo_title, false, 'style="width:400px;"')); FormRow('[seo] Ключевые слова', System::site()->Edit('seo_keywords', $seo_keywords, false, 'style="width:400px;"')); FormRow('[seo] Описание', System::site()->Edit('seo_description', $seo_description, false, 'style="width:400px;"')); // // Веб форма $forms = System::database()->Select('forms', "`active`='1'"); $forms_data = array(); System::site()->DataAdd($forms_data, '0', 'Нет', $form == 0); foreach ($forms as $f) { System::site()->DataAdd($forms_data, SafeDB($f['id'], 11, int), SafeDB($f['hname'], 255, str), $f['id'] == $form); } FormRow('Форма', System::site()->Select('form', $forms_data)); FormRow('Код товара', System::site()->Edit('product_id', $product_id, false, 'maxlength="250" style="width:400px;"')); AdminImageControl('Изображение', 'Загрузить изображение', $image, System::config('articles/images_dir')); FormTextRow('Короткая статья (HTML)', System::site()->HtmlEditor('description', $description, 600, 200)); FormRow('', 'Преобразовать текст в HTML: ' . System::site()->Select('auto_br_desc', GetEnData($auto_br_desc, 'Да', 'Нет'))); FormTextRow('Полная статья (HTML)', System::site()->HtmlEditor('article', $article, 600, 400)); FormRow('', 'Преобразовать текст в HTML: ' . System::site()->Select('auto_br_article', GetEnData($auto_br_article, 'Да', 'Нет'))); FormRow('Автор', System::site()->Edit('author', $author, false, 'style="width:400px;" maxlength="50"')); FormRow('E-mail автора', System::site()->Edit('email', $email, false, 'style="width:400px;" maxlength="50"')); FormRow('Сайт автора', System::site()->Edit('www', $www, false, 'style="width:400px;" maxlength="250"')); FormRow('Комментарии', System::site()->Select('allow_comments', GetEnData($allow_comments, 'Разрешить', 'Запретить'))); FormRow('Оценки', System::site()->Select('allow_votes', GetEnData($allow_votes, 'Разрешить', 'Запретить'))); FormRow('Кто видит', System::site()->Select('view', GetUserTypesFormData($view))); FormRow('Активна', System::site()->Select('active', GetEnData($active, 'Да', 'Нет'))); AddCenterBox($top); if (!isset($_REQUEST['back'])) { $_REQUEST['back'] = SaveRefererUrl(ADMIN_FILE . '?exe=articles'); } AddForm('<form name="edit_form" action="' . ADMIN_FILE . '?exe=articles&a=' . $action . '&back=' . SafeDB($_REQUEST['back'], 255, str) . '" method="post" enctype="multipart/form-data">', System::site()->Button('Отмена', 'onclick="history.go(-1)"') . System::site()->Button('Предпросмотр', 'onclick="ArticlesPreviewOpen();"') . System::site()->Submit($cap)); }
function AdminsEditGroup() { global $action; if ($action == 'editgroup') { System::database()->Select('usertypes', "`id`='" . SafeEnv($_GET['id'], 11, int) . "'"); $group = System::database()->FetchRow(); $name = SafeDB($group['name'], 255, str); $color = SafeDB($group['color'], 9, str); $access = SafeDB($group['access'], 0, str, false, false); $image = SafeDB($group['image'], 250, str); $method = 'editsave&id=' . SafeEnv($_GET['id'], 11, int); $title = 'Редактирование группы'; if ($group['system']) { $other = 'disabled'; } else { $other = ''; } } elseif ($action == 'addgroup') { $name = ''; $color = '#000000'; $image = ''; $access = serialize(array()); $method = 'addsave'; $title = 'Добавить группу'; $other = ''; } FormRow('Название', System::site()->Edit('name', $name, false, 'style="width:400px;" class="autofocus"')); FormRow('Цвет', System::site()->Edit('color', $color, false, 'style="width:400px;"')); FormRow('Картинка', System::site()->Edit('image', $image, false, 'style="width:400px;"')); $access = AdminsGetAccessArray($access); $ac = ''; foreach ($access as $a) { $ac .= '<table width="100%" cellspacing="0" cellpadding="3" style="border:1px #ABC5D8 solid;margin-bottom:2px;">'; for ($i = 0, $c = count($a); $i < $c; $i++) { $ac .= '<tr> <td style="border:none;"><label>' . System::site()->Check('access[]', $a[$i][0] . ',' . $a[$i][1], $a[$i][3], $other) . '<span style="display: inline-block; vertical-align: top; padding-top: 3px;">' . $a[$i][2] . '</span></label></td> </tr>'; } $ac .= '</table>'; } FormRow('Доступ', $ac); AddCenterBox($title); AddForm('<form action="' . ADMIN_FILE . '?exe=admins&a=' . $method . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit('Сохранить')); }
/** * Редактор категорий * @param null $CatId * @param null $ToId * @param string $OtherUrlParams * @return void */ public function CatEditor($CatId = null, $ToId = null, $OtherUrlParams = '') { $title = ''; $desc = ''; $icon = ''; $boxtitle = 'Добавить категорию'; $save_met = $this->save_met; if ($CatId != null) { $cat = System::database()->SelectOne($this->Table, "`id`='{$CatId}'"); $title = SafeDB($cat['title'], 255, str); $desc = SafeDB($cat['description'], 0, str, false); $icon = SafeDB($cat['icon'], 255, str); $parent = SafeDB($cat['parent'], 11, int); $boxtitle = 'Редактирование категории'; $save_met = $this->save_met . '&' . $this->id_par_name . '=' . $CatId; $cmd = 'Сохранить изменения'; } else { if ($ToId != null) { $parent = $ToId; } elseif (isset($_GET['_cat_adto'])) { $parent = SafeEnv($_GET['_cat_adto'], 11, int); } else { $parent = -1; } $cmd = 'Добавить'; } $cats_data = $this->GetCatsData($parent, false, true, $CatId, true); FormRow('В категорию', System::site()->Select('cat', $cats_data, false, $parent == -1 ? 'class="autofocus"' : '')); FormRow('Имя категории', System::site()->Edit('title', $title, false, 'maxlength="250" style="width:400px;"' . ($parent != -1 ? 'class="autofocus"' : ''))); FormRow('Иконка', System::site()->Edit('icon', $icon, false, 'maxlength="250" style="width:400px;"')); FormTextRow('Описание', System::site()->HtmlEditor('desc', $desc)); AddCenterBox($boxtitle); AddForm('<form action="' . ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $save_met . $OtherUrlParams . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit($cmd)); }
function AdminDownloadsFileEditor($action) { if (!System::user()->CheckAccess2('downloads', 'edit_files')) { System::admin()->AccessDenied(); } $category = isset($_GET['to']) ? SafeDB($_GET['to'], 11, int) : 0; $title = ''; $url = ''; $file_size = '0'; $size_type = 'b'; $shortdesc = ''; $description = ''; $image = ''; $author = ''; $author_site = ''; $author_email = ''; $file_ver = ''; $allow_comments = true; $allow_votes = true; $view = 4; $active = true; if (!isset($_GET['id'])) { $action = 'addfilesave'; $top = 'Добавить файл'; $cap = 'Добавить'; } else { $id = SafeEnv($_GET['id'], 11, int); System::database()->Select('downloads', "`id`='{$id}'"); $file = System::database()->FetchRow(); $category = SafeDB($file['category'], 11, int); $title = SafeDB($file['title'], 250, str); $url = SafeDB($file['url'], 250, str); $file_size = SafeDB($file['size'], 11, real); $size_type = SafeDB($file['size_type'], 1, str); $shortdesc = SafeDB($file['shortdesc'], 0, str, false); $description = SafeDB($file['description'], 0, str, false); $image = SafeDB($file['image'], 250, str); $author = SafeDB($file['author'], 200, str); $author_site = SafeDB($file['author_site'], 250, str); $author_email = SafeDB($file['author_email'], 50, str); $file_ver = SafeDB($file['file_version'], 250, str); $allow_comments = SafeDB($file['allow_comments'], 1, int); $allow_votes = SafeDB($file['allow_votes'], 1, int); $view = SafeDB($file['view'], 1, int); $active = SafeDB($file['active'], 1, int); $action = 'editfilesave&id=' . $id; $top = 'Редактирование файла'; $cap = 'Сохранить изменения'; } $cats_data = AdminDownloadsGetTree()->GetCatsData($category); if (count($cats_data) == 0) { $back_to_form = SaveRefererUrl(); AddTextBox($top, 'Нет категорий для добавления! ' . System::admin()->SpeedButton('Добавить категорию', ADMIN_FILE . '?exe=downloads&a=cateditor&back=' . $back_to_form, '', true, true)); return; } $filesize_data = array(); System::site()->DataAdd($filesize_data, 'b', 'Байт', $size_type == 'b'); System::site()->DataAdd($filesize_data, 'k', 'Килобайт', $size_type == 'k'); System::site()->DataAdd($filesize_data, 'm', 'Мегабайт', $size_type == 'm'); System::site()->DataAdd($filesize_data, 'g', 'Гигабайт', $size_type == 'g'); $max_file_size = ini_get('upload_max_filesize'); AddCenterBox($top); FormRow('В категорию', System::site()->Select('category', $cats_data, false, $category == 0 ? 'class="autofocus"' : '')); FormRow('Название', System::site()->Edit('title', $title, false, 'style="width:400px;"' . ($category != 0 ? ' class="autofocus"' : ''))); FormRow('Путь к файлу', System::site()->Edit('url', $url, false, 'style="width:400px;"')); //FormRow('Путь к файлу', System::site()->FileManager( 'url', $url, 400)); FormRow('Загрузить файл<br />(<small>Максимальный размер файла: ' . $max_file_size . '</small>)', System::site()->FFile('upload_file') . '<br /><div style="width: 400px; word-wrap:break-word;">Разрешенные форматы:<br />' . System::config('downloads/file_exts') . '</div>'); FormRow('Размер файла', System::site()->Edit('size', $file_size, false, 'style="width:200px;"') . ' ' . System::site()->Select('filesize_type', $filesize_data)); AdminImageControl('Изображение', 'Загрузить изображение', $image, System::config('downloads/images_dir')); FormTextRow('Краткое описание', System::site()->HtmlEditor('shortdesc', $shortdesc, 600, 200)); FormTextRow('Полное описание', System::site()->HtmlEditor('description', $description, 600, 400)); FormRow('Версия файла', System::site()->Edit('version', $file_ver, false, 'style="width:400px;"')); FormRow('Автор', System::site()->Edit('author', $author, false, 'style="width:400px;"')); FormRow('E-mail автора', System::site()->Edit('author_email', $author_email, false, 'style="width:400px;"')); FormRow('Сайт автора', System::site()->Edit('author_site', $author_site, false, 'style="width:400px;"')); FormRow('Комментарии', System::site()->Select('allow_comments', GetEnData($allow_comments, 'Разрешить', 'Запретить'))); FormRow('Оценки', System::site()->Select('allow_votes', GetEnData($allow_votes, 'Разрешить', 'Запретить'))); FormRow('Кто видит', System::site()->Select('view', GetUserTypesFormData($view))); FormRow('Активен', System::site()->Select('active', GetEnData($active, 'Да', 'Нет'))); if (!isset($_REQUEST['back'])) { $_REQUEST['back'] = SaveRefererUrl(ADMIN_FILE . '?exe=downloads'); } AddForm('<form action="' . ADMIN_FILE . '?exe=downloads&a=' . $action . '&back=' . SafeDB($_REQUEST['back'], 255, str) . '" method="post" enctype="multipart/form-data" name="edit_form">', System::site()->Button('Отмена', 'onclick="history.go(-1)"') . System::site()->Submit($cap)); }
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 AdminSmiliesAutoAdd() { global $mod, $smilies_dir; AddCenterBox('Авто-добавление смайликов'); $smilies = System::database()->Select('smilies'); $xor_smilies = array(); foreach ($smilies as $smile) { $xor_smilies[] = $smile['file']; } $find_smilies = AdminSmiliesFind($smilies_dir, $xor_smilies); if (count($find_smilies) == 0) { System::admin()->Highlight('Новых файлов не найдено. Загрузите изображения смайликов в папку: <b>' . $smilies_dir . '</b>.'); return; } $text = ''; $text .= System::site()->FormOpen(ADMIN_FILE . '?exe=smilies&a=autosave'); $text .= '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr> <th>Добавить</th> <th>Изображение</th> <th>Код</th> <th>Описание</th> <th>Имя файла</th> <th>Показать</th> <th>Удалить</th> </tr>'; foreach ($find_smilies as $sm) { $file = SafeDB($sm['file'], 255, str); $func = System::admin()->SpeedConfirm('Удалить файл', $mod . '&a=deletefile&name=' . $file, 'images/admin/delete.png', 'Удалить файл с сервера?'); $text .= '<tr>' . '<td>' . System::site()->Check('smilies[]', $file, true) . '</td>' . '<td><img src="' . $smilies_dir . $file . '"></td>' . '<td>' . System::site()->Edit('code[' . $file . ']', SafeDB($sm['code'], 255, str), false, 'style="width:160px;"') . '</td>' . '<td>' . System::site()->Edit('desc[' . $file . ']', SafeDB($sm['desc'], 255, str), false, 'style="width:160px;"') . '</td>' . '<td>' . $file . '</td>' . '<td>' . System::site()->Check('en[' . $file . ']', '1', true) . '</td>' . '<td>' . $func . '</td>' . '</tr>'; } $text .= '</table>'; $text .= System::site()->Submit('Добавить') . '<br /><br />'; $text .= System::site()->FormClose(); AddText($text); }
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ if (!defined('VALID_RUN')) { header("HTTP/1.1 404 Not Found"); exit; } if (isset($_POST['newname'])) { System::database()->RenameTable(SafeEnv($_GET['name'], 255, str), SafeEnv($_POST['newname'], 255, str)); Audit('Управление БД: Переименование таблицы "' . $_GET['name'] . '" в "' . $_POST['newname'] . '"'); GO(ADMIN_FILE . '?exe=dbadmin'); } else { AddCenterBox('Переименовать таблицу "' . SafeDB($_GET['name'], 255, str) . '"'); FormRow('Новое имя', $site->Edit('newname', SafeDB($_GET['name'], 255, str), false, 'style="width: 210px;" class="autofocus"')); AddForm('<form action="' . ADMIN_FILE . '?exe=dbadmin&a=renametable&name=' . SafeEnv($_GET['name'], 255, str) . '" method="post">', $site->Button('Отмена', 'onclick="history.go(-1);"') . $site->Submit('Переименовать')); }
function AdminGuestBookAnswerEditor() { if (!System::user()->CheckAccess2('guestbook', 'answer')) { System::admin()->AccessDenied(); } $id = SafeEnv($_GET['id'], 11, int); System::database()->Select('guestbook', "`id`='" . $id . "'"); if (System::database()->NumRows() > 0) { AddCenterBox('Ответ на сообщение'); $msg = System::database()->FetchRow(); if ($msg['answers'] == '') { $answers = array(); } else { $answers = unserialize($msg['answers']); } if (array_key_exists(System::user()->Name(), $answers)) { $ans = $answers[System::user()->Name()]; } else { $ans = ''; } FormRow('Ответ', System::site()->TextArea('answer', HtmlChars($ans), 'style="width:400px;height:200px;" class="autofocus"')); if (isset($_GET['back'])) { $back = '&back=' . SafeDB($_GET['back'], 255, str); } else { $back = ''; } AddForm('<form action="' . ADMIN_FILE . '?exe=guestbook&a=saveanswer&id=' . $id . $back . '" method="POST">', System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit('Сохранить')); } else { GO(ADMIN_FILE . '?exe=guestbook'); } }
if (!isset($col['default'])) { $col['default'] = ''; } if (!isset($col['attributes'])) { $col['attributes'] = ''; } if (!isset($col['auto_increment'])) { $col['auto_increment'] = false; } $func = ''; $func .= SpeedButton('Просмотреть информацию для установки', ADMIN_FILE . '?exe=dbadmin&a=viewcollinfo&name=' . $name . '&collid=' . $i, 'images/admin/info.png'); $func .= System::admin()->SpeedConfirm('Удалить колонку', ADMIN_FILE . '?exe=dbadmin&a=deletecoll&name=' . $name . '&collid=' . $i, 'images/admin/delete.png', 'Удалить колонку?'); $text .= '<tr> <td>' . $i . '</td> <td>' . SafeDB($col['name'], 255, str) . '</td> <td>' . SafeDB($col['type'], 255, str) . (isset($col['length']) ? '(' . SafeDB($col['length'], 11, int) . ')' : '') . '</td> <td>' . SafeDB($col['attributes'], 255, str) . '</td> <td>' . ($col['notnull'] ? '<font color="#0000FF">Нет</font>' : '<font color="#FF0000">Да</font>') . '</td> <td>' . SafeDB($col['default'], 255, str) . '</td> <td>' . ($col['auto_increment'] ? '<font color="#FF0000">Да</font>' : '<font color="0000FF">Нет</a>') . '</td> <td>' . $func . '</td>'; System::site()->DataAdd($selcoldata, $i, SafeDB($col['name'], 255, str), $i == $colcount); $i++; } $text .= '</table><br />'; AddCenterBox('Структура таблицы "' . $name . '"'); AddText($text); System::admin()->FormTitleRow('Вставить колонку'); FormRow('После', System::site()->Select('toindex', $selcoldata)); AddForm('<form action="' . ADMIN_FILE . '?exe=dbadmin&a=newcoll&name=' . $name . '" method="post">', $site->Submit('Далее', 'title="Перейти к след. шагу добавления колонки."')); AdminFdbAdminGenTableMenu($name);
function AdminMailList() { if (!isset($_GET['topic_id'])) { GO(ADMIN_FILE . '?exe=mail'); } $topic_id = SafeEnv($_GET['topic_id'], 11, int); System::database()->Select('mail_topics', "`id`='{$topic_id}'"); if (System::database()->NumRows() == 0) { AddTextBox("Внимание!", 'Тема не найдена.'); return; } $topic = System::database()->FetchRow(); System::database()->Select('mail_list', "`topic_id`='{$topic_id}'"); $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>E-mail</th><th>Пользователь</th><th>Формат</th><th>Функции</th></tr>'; $c_all = 0; $c_users = 0; $c_html = 0; while ($row = System::database()->FetchRow()) { $c_all++; if ($row['user_id'] == '0') { $isuser = '******'; } else { $isuser = '******'; $c_users++; } if ($row['html'] == '0') { $html = 'Текст'; } else { $html = 'HTML'; $c_html++; } $func = ''; $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=mail&a=delete_email&topic_id=' . SafeDB($row['topic_id'], 11, int) . '&email=' . SafeDB($row['email'], 50, str) . '&ok=0', 'images/admin/delete.png', 'Удалить подписчика?'); $text .= '<tr><td>' . PrintEmail($row['email']) . '</a></td><td>' . $isuser . '</td><td>' . $html . '</td><td>' . $func . '</td></tr>'; } $text .= '<tr><td>' . $c_all . '</a></td><td>' . $c_users . '</td><td>' . $c_html . '</td><td> </td></tr>'; $text .= '</table>'; AddCenterBox('Список подписчиков на рассылку "' . SafeDB($topic['title'], 250, str) . '"'); AddText($text); $format = array(); System::admin()->DataAdd($format, '1', 'HTML'); System::admin()->DataAdd($format, '0', 'Текст'); System::admin()->FormTitleRow('Добавить E-mail'); System::admin()->FormRow('E-mail', System::admin()->Edit('email', '', false, 'style="width: 260px;"')); System::admin()->FormRow('Формат рассылки', System::admin()->Select('html', $format)); System::admin()->AddForm('<form action="' . ADMIN_FILE . '?exe=mail&a=add_email&topic_id=' . $topic_id . '" method="post">', System::admin()->Submit('Добавить')); }
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ AddCenterBox('Резервные копии'); $backup_dir = System::config('backup_dir'); if (!is_writable($backup_dir)) { System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Нет прав на запись в папку ' . $backup_dir . '. Создание резервных копий не возможно.'); } System::admin()->AddJS(' CreateBackup = function(){ Admin.ShowSplashScreen("Создание резервной копии"); $.ajax({ type: "POST", url: "' . ADMIN_FILE . '?exe=dbadmin&a=backup_create", data: {}, success: function(data){ Admin.LoadPage("' . ADMIN_FILE . '?exe=dbadmin&a=backups", undefined, "Обновление страницы"); Admin.HideSplashScreen(); } }); }; '); $backup_files = GetFiles($backup_dir, false, true, '.zip'); rsort($backup_files, SORT_STRING); $backup_files2 = array(); foreach ($backup_files as $file) { if (GetSecondFileExt($file, true) == System::database()->Name) { $backup_files2[] = $file;
<?php /* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ if (!defined('VALID_RUN')) { header("HTTP/1.1 404 Not Found"); exit; } $name = SafeEnv($_GET['name'], 255, str); $namedb = SafeDB($_GET['name'], 255, str); AddCenterBox('Обзор таблицы "' . $namedb . '"'); $where = ''; $where_url = ''; if (isset($_GET['where'])) { $where = $_GET['where']; $where_url = '&where=' . $_GET['where']; } $info = System::database()->GetTableColumns($name); $rows = System::database()->Select($name, $where); if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 11, int); } else { $page = 1; } $rows_on_page = 40; if (count($rows) > $rows_on_page) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($rows, $rows_on_page, ADMIN_FILE . '?exe=dbadmin&a=review&name=' . $name); $nav = true;
function AdminBlocksEdit($a) { global $config, $site, $user; // Для обратной совместимости со старыми блоками $showin = array('ALL_EXCEPT'); $showin_uri = array(); $template = ''; $b_vi = 4; $b_en = 1; if (isset($_POST['type']) || $a == 'edit') { $b_pos = array('L' => false, 'R' => false, 'T' => false, 'B' => false); $b_pos = array('L' => false, 'R' => false, 'T' => false, 'B' => false, 'A' => false); $b_title = ''; $b_vi = 4; $b_en = 1; $block_config = ''; // Используется в подключаемых файлах if ($a == 'edit') { System::database()->Select('blocks', "`id`='" . SafeEnv($_GET['id'], 11, int) . "'"); $r = System::database()->FetchRow(); $b_title = SafeDB($r['title'], 255, str); $b_pos[SafeDB($r['position'], 1, str)] = true; $b_vi = SafeDB($r['view'], 1, int); $b_en = SafeDB($r['enabled'], 1, bool); $b_type = SafeDB($r['type'], 255, str); $template = SafeDB($r['template'], 255, str); $block_config = $r['config']; // Используется в подключаемых файлах $title = 'Редактирование блока'; $a_form = ADMIN_FILE . '?exe=blocks&a=update&id=' . SafeEnv($_GET['id'], 11, int); $button = 'Сохранить изменения'; if ($r['showin'] != '') { $showin = unserialize($r['showin']); } if ($r['showin_uri'] != '') { $showin_uri = unserialize($r['showin_uri']); } } else { $a_form = ADMIN_FILE . '?exe=blocks&a=newsave'; $b_type = SafeEnv($_POST['type'], 255, str); $title = 'Настройка блока'; $button = 'Создать'; $showin[] = array('ALL_EXCEPT'); } FormRow('Заголовок', System::site()->Edit('title', $b_title, false, 'style="width:400px;" class="autofocus"')); $constructor = System::config('blocks_dir') . $b_type . '/constructor.php'; if (is_file($constructor)) { include_once $constructor; } $btems = GetBlockTemplates(); $temdata = array(); foreach ($btems as $tem) { System::site()->DataAdd($temdata, $tem, $tem, $tem == $template); } FormRow('Шаблон блока', System::site()->Select('template', $temdata)); System::site()->DataAdd($posdata, 'Left', 'Колонка слева', $b_pos['L']); System::site()->DataAdd($posdata, 'Right', 'Колонка справа', $b_pos['R']); System::site()->DataAdd($posdata, 'Top', 'В центре сверху', $b_pos['T']); System::site()->DataAdd($posdata, 'Bottom', 'В центре снизу', $b_pos['B']); //System::site()->DataAdd($posdata, 'ABottom', 'A В центре снизу', $b_pos['A']); FormRow('Позиционирование', System::site()->Select('position', $posdata)); VisibilityConditionsAdmin($showin, $showin_uri); FormRow('Кто видит', System::site()->Select('view', GetUserTypesFormData($b_vi))); FormRow('Включить', System::site()->Select('enabled', GetEnData($b_en, 'Да', 'Нет'))); AddCenterBox($title); AddForm('<form action="' . $a_form . '" method="post">' . System::site()->Hidden('type', $b_type), System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit($button)); } else { GO(ADMIN_FILE); } }
function AdminFeedBackEditor() { $name = ''; $email = ''; $active = array(false, false); if (!isset($_GET['id'])) { $active[1] = true; $headt = 'Добавить департамент'; $bbb = 'Добавить'; } elseif (isset($_GET['id'])) { $id = SafeEnv($_GET['id'], 11, int); System::database()->Select('feedback', "`id`='" . $id . "'"); $fb = System::database()->FetchRow(); $name = SafeDB($fb['name'], 255, str); $email = SafeDB($fb['email'], 50, str); $active[$fb['active']] = true; $headt = 'Редактирование департамента'; $bbb = 'Сохранить изменения'; } FormRow('Название', System::site()->Edit('name', $name, false, 'style="width:200px;" class="autofocus"')); FormRow('E-mail', System::site()->Edit('email', $email, false, 'style="width:200px;"')); FormRow('Включить', System::site()->Select('enabled', GetEnData($active[1]))); AddCenterBox($headt); AddForm('<form action="' . ADMIN_FILE . '?exe=feedback&a=save' . (isset($id) ? '&id=' . $id : '') . '" method="post">', System::site()->Submit($bbb)); }