function AdminGalleryMainFunc() { global $edit_images, $GalleryDir, $ThumbsDir; UseScript('colorbox?theme=admin'); $back = SaveRefererUrl(); if (isset($_GET['cat']) && $_GET['cat'] > -1) { $cat = SafeEnv($_GET['cat'], 11, int); $where = "`cat_id`='{$cat}'"; } else { $cat = -1; $where = ""; } $data = AdminGalleryGetTree()->GetCatsData($cat, true); System::site()->DataAdd($data, -1, 'Все изображения', $cat == -1); if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 11, int); $page_param = '&page=' . SafeDB($_GET['page'], 11, int); } else { $page = 1; $page_param = ''; } AddCenterBox('Фото'); System::admin()->AddJS(Indent(' GallerySelectCat = function(){ Admin.LoadPage("' . ADMIN_FILE . '?exe=gallery&cat="+$("#gallery-cat").val()); } ')); $text = '<div style="margin-bottom: 10px;">Категория: ' . System::site()->Select('cat', $data, false, 'id="gallery-cat" onchange="GallerySelectCat();"'); if ($cat < 0) { $text .= ' (Для сортировки изображений, выберите категорию)'; } $text .= '</div>'; AddText($text); $images = System::database()->Select('gallery', $where); $count_images = count($images) - 1; SortArray($images, 'order'); if (count($images) > System::config('gallery/images_on_page')) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($images, System::config('gallery/images_on_page'), ADMIN_FILE . '?exe=gallery' . ($cat > 0 ? '&cat=' . $cat : '')); $nav = true; } else { $nav = false; } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr>' . ($cat > 0 ? '<th>Сортировка</th>' : '') . '<th>Изображение</th><th>Просмотров</th><th>Видят</th><th>Статус</th><th>Функции</th></tr>'; foreach ($images as $i => $img) { $id = SafeDB($img['id'], 11, int); $title = SafeDB($img['title'], 255, str); if ($title == '') { $title = 'Изображение ' . $id; } if (System::config('gallery/show_thumbs')) { $img_filename = SafeDB($img['file'], 255, str); $size = FormatFileSize(filesize($GalleryDir . $img_filename)); $asize = getimagesize($GalleryDir . $img_filename); $asize = $asize[0] . 'x' . $asize[1]; $thumb = '<div style="margin: 5px 0;"><a href="' . $GalleryDir . $img_filename . '" target="_blank" class="colorbox">' . '<img title="' . $title . '" src="' . $ThumbsDir . $img_filename . (isset($_GET['update']) && $_GET['update'] == $id ? '?' . GenRandomString(5) : '') . '"></a></div>' . "({$asize}, {$size})"; } else { $thumb = ''; } $hits = SafeDB($img['hits'], 11, int); $st = $img['show'] == '1' ? 'Вкл.' : 'Выкл.'; $func = '-'; $move_menu = ''; $link_go = Ufu('index.php?name=gallery&op=view&img=' . $id . '&cat=' . SafeDB($img['cat_id'], 11, int), 'gallery/{cat}/{img}/'); $func = ''; $func .= System::admin()->SpeedButton('Перейти к странице на сайте', $link_go, 'images/link_go.png', false, false, 'target="_blank"'); if ($edit_images) { $edit_url = ADMIN_FILE . '?exe=gallery&a=editor&id=' . $id . '&back=' . $back; $title = '<b>' . System::admin()->Link($title, $edit_url) . '</b>'; $hits .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик просмотров', ADMIN_FILE . '?exe=gallery&a=resethits&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить счётчик просмотров?'); $st = System::admin()->SpeedStatus('Вкл.', 'Выкл.', ADMIN_FILE . '?exe=gallery&a=changestatus&id=' . $id, $img['show'] == '1'); $func .= System::admin()->SpeedButton('Редактировать', $edit_url, 'images/admin/edit.png'); $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=gallery&a=delete&id=' . $id . '&back=' . $back, 'images/admin/delete.png', 'Удалить изображение?'); $func .= '<div style="margin-top: 4px;">'; $func .= System::admin()->SpeedButton('Повернуть влево на 90°', ADMIN_FILE . '?exe=gallery&a=rotate&turn=left&id=' . $id . '&back=' . $back, 'images/admin/layer-rotate-left.png'); $func .= System::admin()->SpeedButton('Повернуть вправо на 90° ', ADMIN_FILE . '?exe=gallery&a=rotate&turn=right&id=' . $id . '&back=' . $back, 'images/admin/layer-rotate-right.png'); $func .= System::admin()->SpeedButton('Обновить эскиз', ADMIN_FILE . '?exe=gallery&a=refreshthumb&id=' . $id . '&back=' . $back, 'images/admin/refresh.png'); $func .= '</div>'; if ($count_images == 0) { // Единственный элемент в списке $move_menu .= ' - '; } else { if ($i != $count_images) { // Первый элемент $move_menu .= System::admin()->SpeedButton('Вниз', ADMIN_FILE . '?exe=gallery&a=move&to=down&id=' . $id . '&cat=' . $cat . $page_param, 'images/admin/down.png'); } if ($i != 0) { // Последний элемент $move_menu .= System::admin()->SpeedButton('Вверх', ADMIN_FILE . '?exe=gallery&a=move&to=up&id=' . $id . '&cat=' . $cat . $page_param, 'images/admin/up.png'); } } } $text .= Indent(' <tr> ' . ($cat > 0 ? '<td>' . $move_menu . '</td>' : '') . ' <td>' . $title . $thumb . '</td> <td>' . $hits . '</td> <td>' . ViewLevelToStr(SafeDB($img['view'], 1, int)) . '</td> <td>' . $st . '</td> <td>' . $func . '</td> </tr> '); } $text .= '</table>'; AddText($text); if ($nav) { AddNavigation(); } }
function AdminUserMain() { global $user, $editing; $searchm = false; if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } if (isset($_GET['show'])) { $show = $_GET['show']; } else { $show = ''; } //Пользователи online $sonline = false; $onlwhere = ''; $where = '`type`=\'2\''; if ($show == 'online') { $donline = $user->Online(); $donline = $donline['members']; $onlwhere = ''; foreach ($donline as $memb) { $onlwhere .= "or `id`='" . SafeDB($memb['u_id'], 11, int) . "'"; } $onlwhere = substr($onlwhere, 3); $sonline = true; if (count($donline) > 0) { $where = "`type`='2' and ({$onlwhere})"; $users = AdminUserGetUsers($where); } else { $users = array(); } $searchm = true; } else { $users = AdminUserGetUsers(); } //Поиск $criterion = ''; $sstr = ''; if (isset($_GET['criterion']) && isset($_GET['stext']) && $_GET['stext'] != '') { $searchm = true; $criterion = $_GET['criterion']; $sstr = SafeEnv($_GET['stext'], 255, str); switch ($criterion) { case 'nikname': AdminUserQueryStristrFilter($users, $sstr, 'name'); break; case 'email': AdminUserQueryStristrFilter($users, $sstr, 'email'); break; case 'rname': AdminUserQueryStristrFilter($users, $sstr, 'truename'); break; case 'age': AdminUserQueryStristrFilter($users, $sstr, 'age'); break; case 'city': AdminUserQueryStristrFilter($users, $sstr, 'city'); break; case 'site': AdminUserQueryStristrFilter($users, $sstr, 'url'); break; case 'icq': AdminUserQueryStristrFilter($users, $sstr, 'icq'); break; case 'gmt': AdminUserQueryStristrFilter($users, $sstr, 'timezone'); break; case 'active': AdminUserQueryStristrFilter($users, $sstr, 'active'); break; case 'points': AdminUserQueryStristrFilter2($users, $sstr, 'points'); break; case 'ip': AdminUserQueryStristrFilter($users, $sstr, 'lastip'); break; } Audit('Пользователи: Поиск пользователей, критерий: "' . $criterion . '", запрос: "' . $sstr . '"'); } $sstr = strval($sstr); $showd = array(); System::site()->DataAdd($showd, 'all', 'Все пользователи', $show == ''); System::site()->DataAdd($showd, 'online', 'Пользователи OnLine', $show == 'online'); $searchd = array(); System::site()->DataAdd($searchd, 'nikname', 'Ник', $criterion == 'nikname'); System::site()->DataAdd($searchd, 'email', 'E-mail', $criterion == 'email'); System::site()->DataAdd($searchd, 'rname', 'Настоящее имя', $criterion == 'rname'); System::site()->DataAdd($searchd, 'age', 'Возраст', $criterion == 'age'); System::site()->DataAdd($searchd, 'city', 'Город', $criterion == 'city'); System::site()->DataAdd($searchd, 'site', 'Сайт', $criterion == 'site'); System::site()->DataAdd($searchd, 'icq', 'ICQ', $criterion == 'icq'); System::site()->DataAdd($searchd, 'gmt', 'Часовой пояс', $criterion == 'gmt'); System::site()->DataAdd($searchd, 'active', 'Активен', $criterion == 'active'); System::site()->DataAdd($searchd, 'points', 'Пунктов более', $criterion == 'points'); System::site()->DataAdd($searchd, 'ip', 'IP', $criterion == 'ip'); System::admin()->AddJS(' SearchUsers = function(){ var cri = "&criterion="+$("#criterion").val(); var stext = "&stext="+$("#stext").val(); var online = "&show="+$("#online").val(); Admin.LoadPage("' . ADMIN_FILE . '?exe=user"+cri+stext+online, undefined, "Идёт поиск"); } '); TAddSubTitle('Главная'); AddCenterBox('Зарегистрированные пользователи (' . count($users) . ')'); $searchtool = '<style>.ustd td{ border: none; padding: 0; }</style>'; $searchtool .= '<table cellspacing="0" cellpadding="0" border="0" class="cfgtable"><tr><td>' . "\n"; $searchtool .= '<table cellspacing="0" cellpadding="0" border="0" width="100%" class="ustd"> <tr> <td>Поиск: </td> <td>' . System::site()->Select('criterion', $searchd, false, 'id="criterion"') . ' ' . System::site()->Edit('stext', $sstr, false, 'id="stext"') . ' ' . System::site()->Select('show', $showd, false, 'id="online"') . '</td> <td>' . System::admin()->SpeedConfirmJs('Поиск', 'SearchUsers();', 'images/search.png', '', true) . '</td> </tr> </table>' . "\n"; $searchtool .= '</td></tr></table>' . "\n"; AddText($searchtool); SortArray($users, 'regdate', true); // Сортируем по дате регистрации if (count($users) > System::config('user/users_on_page')) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($users, System::config('user/users_on_page'), ADMIN_FILE . '?exe=user' . ($searchm ? '&criterion=' . $criterion . '&stext=' . $sstr . '&show=' . $show : '')); $nav = true; } else { $nav = false; AddText('<br />'); } $text = ''; $text .= '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>Ник</th><th>E-mail</th><th>Дата региcтрации</th><th>Посл. посещение</th><th>Посещений</th><th>Пунктов</th><th>Активация</th><th>IP</th><th>Функции</th></tr>'; foreach ($users as $row) { $uid = SafeDB($row['id'], 11, int); if ($row['active'] == '1') { $active = 'Да'; } elseif ($row['active'] == '0' && $row['activate'] == '') { $active = 'Нет'; } elseif ($row['active'] == '0' && $row['activate'] != '') { $active = 'Ожидается'; } $funcs = ''; if ($editing) { $funcs .= System::admin()->SpeedButton('Редактировать', ADMIN_FILE . '?exe=user&a=edituser&id=' . $uid, 'images/admin/edit.png'); $funcs .= System::admin()->SpeedButton('Удалить', ADMIN_FILE . '?exe=user&a=deluser&id=' . $uid, 'images/admin/delete.png'); // Всё верно } $text .= '<tr> <td>' . ($editing ? '<b>' . System::admin()->Link(SafeDB($row['name'], 50, str), ADMIN_FILE . '?exe=user&a=edituser&id=' . $uid) . '</b>' : SafeDB($row['name'], 50, str)) . '</td> <td>' . PrintEmail($row['email']) . '</td> <td>' . TimeRender($row['regdate']) . '</td> <td>' . TimeRender($row['lastvisit']) . '</td> <td>' . SafeDB($row['visits'], 11, int) . '</td> <td>' . SafeDB($row['points'], 11, int) . '</td> <td>' . $active . '</td> <td>' . SafeDB($row['lastip'], 20, str) . '</td> <td>' . $funcs . '</td> </tr>'; } $text .= '</table>'; AddText($text); if ($nav) { AddNavigation(); } }
function AdminArticlesMain() { global $editarticles; // Фильтр, дает возможность показывать статьи определенной категории. if (isset($_GET['cat']) && $_GET['cat'] > -1) { $cat = SafeEnv($_GET['cat'], 11, int); $where = "`cat_id`='{$cat}'"; } else { $cat = -1; $where = ""; } $data = array(); $data = AdminArticlesGetTree()->GetCatsData($cat, true); System::site()->DataAdd($data, -1, 'Все статьи', $cat == -1); // Получаем номер страницы if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } AddCenterBox('Статьи'); // Форма фильтра по категориям System::admin()->AddJS(' ArticlesSelectCat = function(){ Admin.LoadPage("' . ADMIN_FILE . '?exe=articles&cat="+$("#article-cat").val()); } '); $text = '<div style="text-align: center; margin-bottom: 10px;">Категория: ' . System::site()->Select('cat', $data, false, 'id="article-cat" onchange="ArticlesSelectCat();"') . '</div>'; AddText($text); // Берем статьи из БД и включаем постраничную навигацию если нужно. $r = System::database()->Select('articles', $where); SortArray($r, 'public', true); // Сортируем по дате добавления if (count($r) > System::config('articles/articles_on_page')) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($r, System::config('articles/articles_on_page'), ADMIN_FILE . '?exe=articles' . ($cat > 0 ? '&cat=' . $cat : '')); $nav = true; } else { $nav = false; } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>Название</th><th>Прочитано</th><th>Оценки</th><th>Видят</th><th>Статус</th><th>Функции</th></tr>'; $back = SaveRefererUrl(); foreach ($r as $art) { $id = SafeDB($art['id'], 11, int); $cat_id = SafeDB($art['cat_id'], 11, int); $title = SafeDB($art['title'], 255, str); $hits = SafeDB($art['hits'], 11, int); $rating = '<img src="' . GetRatingImage(SafeDB($art['num_votes'], 11, int), SafeDB($art['all_votes'], 11, int)) . '" border="0" />'; $st = $art['active'] == '1' ? 'Вкл.' : 'Выкл.'; $link_go = Ufu("index.php?name=articles&op=read&art={$id}&cat={$cat_id}", 'articles/{cat}/{art}/'); $func = ''; $func .= System::admin()->SpeedButton('Перейти к странице на сайте', $link_go, 'images/link_go.png', false, false, 'target="_blank"'); if ($editarticles) { $title = '<b>' . System::admin()->Link($title, ADMIN_FILE . '?exe=articles&a=editor&id=' . $id . '&back=' . $back) . '</b>'; $hits .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик просмотров', ADMIN_FILE . '?exe=articles&a=resethits&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить счётчик просмотров?'); $rating .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик оценок (' . SafeDB($art['num_votes'], 11, int) . ' голосов)', ADMIN_FILE . '?exe=articles&a=resetrating&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить оценки?'); $st = System::admin()->SpeedStatus('Включена', 'Отключена', ADMIN_FILE . '?exe=articles&a=changestatus&id=' . $id, $art['active'] == '1'); $func .= System::admin()->SpeedButton('Редактировать', ADMIN_FILE . '?exe=articles&a=editor&id=' . $id . '&back=' . $back, 'images/admin/edit.png'); $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=articles&a=delete&id=' . $id . '&ok=1&back=' . $back, 'images/admin/delete.png', 'Удалить статью?'); } $text .= '<tr> <td>' . $title . '</td> <td>' . $hits . '</td> <td>' . ($art['allow_votes'] == '1' ? $rating : 'Запрещены') . '</td> <td>' . ViewLevelToStr(SafeDB($art['view'], 1, int)) . '</td> <td>' . $st . '</td> <td>' . $func . '</td> </tr>'; } $text .= '</table>'; AddText($text); if ($nav) { AddNavigation(); } }
<tr> <th>Действие</th> <th width="2"> </th>'; $nc = count($info); foreach ($info as $col) { $text .= '<th>' . $col['name'] . '</th>'; } $text .= '</tr>'; $i = $rows_on_page * $page - $rows_on_page; $back = SaveRefererUrl(); foreach ($rows as $col) { $func = ''; $func .= SpeedButton('Редактировать', ADMIN_FILE . '?exe=dbadmin&a=editfield&name=' . $namedb . '&index=' . $i . $where_url . '&back=' . $back, 'images/admin/edit.png'); $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=dbadmin&a=deleterow&name=' . $namedb . '&index=' . $i . $where_url . '&back=' . $back, 'images/admin/delete.png', 'Удалить запись?'); $func .= SpeedButton('PHP код вставки', ADMIN_FILE . '?exe=dbadmin&a=viewcode&name=' . $namedb . '&index=' . $i . $where_url, 'images/admin/php.png'); $text .= '<tr><td nowrap="nowrap">' . $func . '</td><td></td>'; for ($j = 0; $j < $nc; $j++) { $col_name = $info[$j]['name']; strlen($col[$col_name]) > 255 ? $p = '... ...' : ($p = ''); $text .= '<td>' . substr(HtmlChars($col[$col_name]), 0, 255) . $p . '</td>'; } $text .= '</tr>'; $i++; } $text .= '</table>'; AddText($text); if ($nav) { AddNavigation(); } AdminFdbAdminGenTableMenu($namedb);
function AdminCommentsMain() { System::admin()->AddCenterBox('Глобальная модерация комментариев'); if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } System::admin()->AddJS(' UpdateSelectComment = function(){ $(".comment_check").each(function(){ $("#comment"+$(this).val()).removeClass("commtable_selected"); }); $(".comment_check:checked").each(function(){ $("#comment"+$(this).val()).addClass("commtable_selected"); }); }; SelectAllComments = function(){ $(".comment_check").each(function(){ $(this).attr("checked", true); }); UpdateSelectComment(); }; DeleteComments = function(){ var del = ""; $(".comment_check:checked").each(function(){ del += "#"+$(this).val(); }); Admin.LoadPagePost("' . ADMIN_FILE . '?exe=comments&a=delete&page=' . $page . '", {delcomments: del}, "Удаление..."); }; '); $commentsOnPage = 50; // Выбираем комментарии из всех таблиц $where = ''; $posts = array(); $comments_tables = System::database()->Select('comments'); foreach ($comments_tables as $table) { $temp_posts = System::database()->Select($table['table'], $where); AdminConfigMarkPosts($temp_posts, $table); $posts = array_merge($posts, $temp_posts); } // Сортируем комментарии по дате(Новые сверху) SortArray($posts, 'post_date', true); // Добавляем постраничную навигацию if (count($posts) > $commentsOnPage) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($posts, $commentsOnPage, ADMIN_FILE . '?exe=comments'); $nav = true; } else { $nav = false; AddText('<br />'); } // Шапка if (count($posts) == 0) { System::admin()->Highlight('На сайте нет комментариев.'); return; } else { $text = ''; } $text .= '<table cellspacing="0" cellpadding="0" width="90%" align="center" class="commtable_header"> <tr> <th style="width: 160px;">Пользователь</th> <th style="width: 260px;">E-mail</th> <th style="width: 260px;">Сайт</th> <th style="width: 260px;">Дата и время</th> <th style="width: 70px;">IP</th> <th>Функции</th> </tr></table>'; // Выводим комментарии foreach ($posts as $post) { $post_id = SafeDB($post['id'], 11, int); $object_id = SafeDB($post['object_id'], 11, int); $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_ip = SafeDB($post['user_ip'], 19, str); $post_date = TimeRender($post['post_date']); $post_message = SafeDB($post['post_message'], 0, str, false); $post_message = nl2br($post_message); $edit = ADMIN_FILE . '?exe=comments&a=edit&id=' . $post_id . '&table=' . $post['_table'] . '&page=' . $page; if ($user_id != 0) { $userinfo = GetUserInfo($user_id); $user_name = $userinfo['name']; $user_homepage = $userinfo['url']; $user_email = PrintEmail($userinfo['email']); if ($userinfo['online']) { $online = '<b>Сейчас на сайте.</b>'; } else { $online = ''; } $avatar = '<img src="' . $userinfo['avatar_file'] . '" />'; $rank_image = '<img src="' . $userinfo['rank_image'] . '" />'; $rank_name = $userinfo['rank_name']; $regdate = 'Зарегистрирован: ' . TimeRender($userinfo['regdate'], false); $ruser = true; } else { $user_email = PrintEmail($user_email); $online = ''; $avatar = '<img src="' . GetPersonalAvatar(0) . '" />'; $rank_image = ''; $rank_name = ''; $regdate = ''; $ruser = false; } if ($user_homepage != '') { $user_homepage = '<a href="http://' . $user_homepage . '" target="_blank">' . $user_homepage . '</a>'; } else { $user_homepage = ' '; } if ($ruser) { $user_name = '<a href="' . Ufu("index.php?name=user&op=userinfo&user={$user_id}", 'user/{user}/info/') . '" target="_blank">' . $user_name . '</a>'; } $link_go = ADMIN_FILE . '?exe=comments&a=find&table=' . SafeDB($post['_id'], 11, int) . '&post_id=' . $post_id; $func = ''; if ($post['_url'] != '') { $func .= System::admin()->SpeedButton('Найти комментарий', $link_go, 'images/search.png', false, false, 'target="_blank"'); } $func .= SpeedButton('Редактировать', $edit, 'images/admin/edit.png'); $text .= Indent(' <table cellspacing="0" cellpadding="0" width="90%" align="center" class="commtable" id="comment' . $post_id . '--' . $post['_table'] . '--' . $object_id . '"> <tr> <th style="width: 160px;"><b>' . $user_name . '</b></th> <th style="width: 260px;">' . $user_email . '</th> <th style="width: 260px;">' . $user_homepage . '</th> <th style="width: 260px;">' . $post_date . '</th> <th style="width: 70px;">' . $user_ip . '</th> <th>' . $func . '</th> <th>' . System::admin()->Check('delcomments[]', $post_id . '--' . $post['_table'] . '--' . $object_id, false, 'class="comment_check" onchange="UpdateSelectComment();"') . '</th> </tr> <tr> <td valign="top" width="140">' . $avatar . '<br>' . $rank_image . '<br>' . $rank_name . '</td> <td colspan="6" class="commtable_text">' . $post_message . '</td> </tr> </table> '); } // Подвал AddText($text); if ($nav) { AddNavigation(); } $text = ''; if (count($posts) > 0) { $text .= '<div style="text-align: right;">' . System::admin()->SpeedConfirmJs('Выделить все', 'SelectAllComments();', '', '', true) . ' ' . System::admin()->SpeedConfirmJs('Удалить выделенные', 'DeleteComments();', 'images/admin/delete.png', 'Удалить выделенные комментарии?', true) . '</div>'; } AddText($text); }
function AdminMailHistory() { System::admin()->AddCenterBox('История рассылки'); if (isset($_GET['topic_id'])) { $topic = SafeEnv($_GET['topic_id'], 11, int); } elseif (isset($_POST['topic'])) { $topic = SafeEnv($_POST['topic_id'], 11, int); } else { System::admin()->Highlight('Тема не указана.'); return; } $msgs = System::database()->Select('mail_history', ''); if (System::database()->NumRows() == 0) { System::admin()->Highlight('Рассылок по данной теме не проводилось.'); return; } if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } SortArray($msgs, 'date', true); $num = 10; if (count($msgs) > $num) { $nav = new Navigation($page); $nav->GenNavigationMenu($msgs, $num, ADMIN_FILE . '?exe=mail&a=history&topic_id=' . $topic); $nav = true; } else { $nav = false; } $text = '<table cellspacing="0" cellpadding="0" align="center" class="commtable_header" style="width:80%;"> <tr> <th style="width: 120px;">Дата</th> <th style="width: 510px;">Тема</th> <th>Функции</th> </tr></table>'; foreach ($msgs as $msg) { $mid = SafeDB($msg['id'], 11, int); $subject = SafeDB($msg['subject'], 255, str); $date = SafeDB($msg['date'], 11, int); $from = SafeDB($msg['from'], 255, str); $from_email = SafeDB($msg['from_email'], 255, str); $mailtext = nl2br(SafeDB($msg['plain_text'], 0, str)); $func = ''; $func .= System::admin()->SpeedButton('Редактировать письмо', ADMIN_FILE . '?exe=mail&a=edit&id=' . $mid . '&topic_id=' . $topic, 'images/admin/edit.png'); $func .= System::admin()->SpeedConfirm('Удалить письмо', ADMIN_FILE . '?exe=mail&a=delete&id=' . $mid . '&topic_id=' . $topic . '&ok=0', 'images/admin/delete.png', 'Удалить письмо из истории?'); $text .= '<table cellspacing="0" cellpadding="0" class="commtable" style="width:80%;">'; $text .= '<tr> <th style="text-align: left; width: 120px;">' . TimeRender($date) . '</td> <th style="text-align: left; width: 510px;">' . $subject . '</td> <th>' . $func . '</td> </tr>'; $text .= '<tr><td colspan="3" class="commtable_text">' . $mailtext . '</td></tr>'; $text .= '</table>'; } AddText($text); if ($nav) { AddNavigation(); } }
function AdminGuestBookPremoderationMain() { System::admin()->AddCenterBox('Премодерация'); $premoderation = System::user()->CheckAccess2('guestbook', 'premoderation'); $premoderate = System::database()->Select('guestbook', "`premoderate`='0'"); if (System::database()->NumRows() == 0) { System::admin()->Highlight('В премодерации нет сообщений.'); return; } if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } SortArray($premoderate, 'date', true); $num = System::config('gb/msgonpage'); if (count($premoderate) > $num) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($premoderate, $num, ADMIN_FILE . '?exe=guestbook&a=premoderation'); $nav = true; } else { $nav = false; } $text = ''; $back = SaveRefererUrl(); foreach ($premoderate as $pre) { if ($pre['url'] == '') { $url = 'Нет'; } else { $url = '<a href="http://' . SafeDB($pre['url'], 250, str) . '" target="_blank">' . SafeDB($pre['url'], 250, str) . '</a>'; } if ($pre['email'] == '') { $name = SafeDB($pre['name'], 50, str); } else { $name = PrintEmail($pre['email'], $pre['name']); } $mid = SafeDB($pre['id'], 11, int); $del = System::admin()->SpeedConfirm('Удалить сообщение', ADMIN_FILE . '?exe=guestbook&a=delete&id=' . $mid . '&back=' . $back, 'images/admin/delete.png', 'Удалить сообщение?'); $func2 = ''; $func2 = System::admin()->Link('Разрешить', ADMIN_FILE . '?exe=guestbook&a=prem_yes&id=' . $mid . '&back=' . $back); $text .= '<table cellspacing="0" cellpadding="0" class="commtable" style="width:75%;">'; $text .= '<tr> <th style="text-align: left; width: 180px;">' . $name . '</th> <th style="width: 160px;">Сайт: ' . $url . '</th> <th style="width: 120px;">ICQ: ' . SafeDB($pre['icq'], 15, str) . '</th> <th style="width: 120px;">IP: ' . SafeDB($pre['user_ip'], 20, str) . '</th> <th> ' . $del . ' </th> </tr>'; $text .= '<tr><td colspan="5" style="text-align:left;padding:10px;" class="commtable_text">' . SafeDB($pre['message'], 0, str) . '</td></tr>'; $text .= '<tr><th>Дата: ' . TimeRender($pre['date']) . '</th><th colspan="4" style="text-align:right;">' . $func2 . '</th></tr>'; $text .= '</table>'; } AddText($text); if ($nav) { AddNavigation(); } AddText('<div style="text-align: center;">' . System::admin()->SpeedConfirm('Разрешить все', ADMIN_FILE . '?exe=guestbook&a=prem_yes_all&back=' . $back, 'images/admin/accept.png', 'Разрешить все сообщения?', true, true) . ' ' . System::admin()->SpeedConfirm('Удалить все', ADMIN_FILE . '?exe=guestbook&a=prem_del_all&back=' . $back, 'images/admin/delete.png', 'Удалить все сообщения?', true, true) . '</div>'); }
function AdminAuditReferers() { System::admin()->AddCenterBox('Переходы с сайтов (Рефералы)'); $query = System::database()->Select('referers', ''); SortArray($query, 'count', true); $allcount = 0; $count = count($query); if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } $num = 50; if ($count > $num) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($query, $num, ADMIN_FILE . '?exe=audit&a=referers'); $nav = true; } else { $nav = false; } if ($count == 0) { System::admin()->Highlight('Рефералов не было обнаружено.'); } elseif ($count >= 1) { $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= Indent('<tr> <th>Реферал</th> <th>Переходов</th> </tr>'); foreach ($query as $q) { $referer = 'http://' . $q['referer']; $title = AdminAuditDecodeUrl($referer); $count = SafeDB($q['count'], 11, int); $allcount += $count; $text .= '<tr> <td><a href="' . $referer . '" target="_blank">' . $title . '</a></td> <td>' . $count . '</td> </tr>'; } $text .= '</table>'; $text .= 'Всего переходов на этой странице: <b>' . $allcount . '</b>. ' . System::admin()->SpeedConfirm('Очистить лог', ADMIN_FILE . '?exe=audit&a=clear_referers', '', 'Очистить лог рефералов?', true, true); AddText($text); if ($nav) { AddNavigation(); } } }
function AdminForumBasket($table = 'forum_basket_post') { global $config, $site; if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } if ($table == 'forum_basket_post') { $site->Title .= ' > Удаляемые сообщения'; $caption = 'Удаляемые сообщения'; } else { $site->Title .= ' > Удаляемые Темы'; $caption = 'Удаляемые Темы'; } $result = System::database()->Select($table); if (count($result) > 20) { $navigator = new Navigation($page); $navigator->GenNavigationMenu($result, 20, ADMIN_FILE . '?exe=forum&a=' . $table); $nav = true; } else { $nav = false; } $mop = 'showtopic&topic='; if ($table == 'forum_basket_post') { $table_caption = ' (сообщение)'; if (count($result) > 0) { $mposts = array(); $where = ''; foreach ($result as $mpost) { $where .= "`id`='" . $mpost['obj_id'] . "' or "; } $where = substr($where, 0, strlen($where) - 3); $result_posts = System::database()->Select('forum_posts', $where); if (count($result_posts) > 0) { foreach ($result_posts as $mpost) { $mposts[$mpost['id']] = $mpost['object']; $mpostsm[$mpost['id']] = $mpost['message']; } foreach ($result as $mpost) { $mpost['obj_id2'] = $mposts[$mpost['obj_id']]; $mpost['obj_id'] = $mpost['obj_id']; $mpost['date'] = $mpost['date']; $mpost['user'] = $mpost['user']; $mpost['reason'] = $mpost['reason']; $mpost['message'] = $mpostsm[$mpost['obj_id']]; $result2[] = $mpost; } $result = $result2; } } } else { $table_caption = ' (название темы)'; if (count($result) > 0) { $where = ''; foreach ($result as $mpost) { $where .= "`id`='" . $mpost['obj_id'] . "' or "; } $where = substr($where, 0, strlen($where) - 3); $result_topics = System::database()->Select('forum_topics', $where); if (count($result_topics) > 0) { foreach ($result_topics as $mtopic) { $mtopics[$mtopic['id']] = $mtopic['title']; } foreach ($result as $mtopic) { $mpost['obj_id'] = $mtopic['obj_id']; $mpost['date'] = $mtopic['date']; $mpost['user'] = $mtopic['user']; $mpost['reason'] = $mtopic['reason']; $mpost['message'] = $mtopics[$mtopic['obj_id']]; $result2[] = $mpost; } $result = $result2; } } } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>Кто удалил</th><th>Дата удаления</th><th>Дата окончательного удаления</th><th>Комментарий</th><th>Содержимое удаляемого <BR>' . $table_caption . '</th><th>Функции</th></tr>'; foreach ($result as $basket) { $mop = 'showtopic&topic=' . ($table == 'forum_basket_post' ? $basket['obj_id2'] : $basket['obj_id']); $restore_link = ADMIN_FILE . '?exe=forum&a=basket_restore&' . $table . '=' . $basket['obj_id']; $ainfo = GetUserInfo($basket['user']); $text .= '<tr> <td>' . $ainfo['name'] . '</td> <td>' . TimeRender($basket['date'], false, false) . '</td> <td>' . TimeRender($basket['date'] + 86400 * $config['forum']['clear_basket_day'], false, false) . '</td> <td>' . $basket['reason'] . '</td> <td>' . (isset($basket['message']) ? $basket['message'] : '') . '</td> <td><a href="' . $restore_link . '">Восстановить</a> <a href="index.php?name=forum&op=' . $mop . '" target="_blank">Просмотр</a></td> </tr>'; } $text .= '</table>'; AddTextBox($caption, $text); if ($nav) { AddNavigation(); } }
function AdminDownloadsMain() { $editfiles = System::user()->CheckAccess2('downloads', 'edit_files'); $back = SaveRefererUrl(); if (isset($_GET['cat']) && $_GET['cat'] > -1) { $cat = SafeEnv($_GET['cat'], 11, int); $where = "`category`='{$cat}'"; } else { $cat = -1; $where = ""; } $data = array(); $data = AdminDownloadsGetTree()->GetCatsData($cat, true); System::site()->DataAdd($data, -1, 'Все файлы', $cat == -1); if (isset($_GET['page'])) { $page = SafeEnv($_GET['page'], 10, int); } else { $page = 1; } AddCenterBox('Файлы'); System::admin()->AddJS(Indent(' DownloadsSelectCat = function(){ Admin.LoadPage("' . ADMIN_FILE . '?exe=downloads&cat="+$("#download-cat").val()); } ')); $text = '<div style="text-align: center; margin-bottom: 10px;">Категория: ' . System::site()->Select('cat', $data, false, 'id="download-cat" onchange="DownloadsSelectCat();"') . '</div>'; AddText($text); System::database()->Select('downloads', $where); SortArray(System::database()->QueryResult, 'public', true); if (count(System::database()->QueryResult) > System::config('downloads/filesonpage')) { $navigator = new Navigation($page); $navigator->GenNavigationMenu(System::database()->QueryResult, System::config('downloads/filesonpage'), ADMIN_FILE . '?exe=downloads' . ($cat > 0 ? '&cat=' . $cat : '')); $nav = true; } else { $nav = false; } $text = '<table cellspacing="0" cellpadding="0" class="cfgtable">'; $text .= '<tr><th>Заголовок</th><th>Скачиваний</th><th>Оценки</th><th>Видят</th><th>Статус</th><th>Функции</th></tr>'; while ($row = System::database()->FetchRow()) { $id = SafeDB($row['id'], 11, int); $title = SafeDB($row['title'], 255, str); $hits = SafeDB($row['hits'], 11, int); $rating = '<img src="' . GetRatingImage(SafeDB($row['votes_amount'], 11, int), SafeDB($row['votes'], 11, int)) . '" border="0" />'; $st = $row['active'] == '1' ? 'Вкл.' : 'Выкл.'; $func = '-'; if ($editfiles) { $title = '<b>' . System::admin()->Link($title, ADMIN_FILE . '?exe=downloads&a=editor&id=' . $id . '&back=' . $back) . '</b>'; $hits .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик скачиваний', ADMIN_FILE . '?exe=downloads&a=resetcounter&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить счётчик скачиваний?'); $rating .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик оценок (' . SafeDB($row['votes_amount'], 11, int) . ' голосов)', ADMIN_FILE . '?exe=downloads&a=resetrating&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить оценки?'); $st = System::admin()->SpeedStatus('Вкл.', 'Выкл.', ADMIN_FILE . '?exe=downloads&a=changestatus&id=' . $id, $row['active'] == '1'); $func = System::admin()->SpeedButton('Редактировать', ADMIN_FILE . '?exe=downloads&a=editor&id=' . $id . '&back=' . $back, 'images/admin/edit.png'); $func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=downloads&a=deletefile&id=' . $id . '&ok=0&back=' . $back, 'images/admin/delete.png', 'Удалить файл?'); } $text .= '<tr><td>' . $title . '</td> <td>' . $hits . '</td> <td>' . ($row['allow_votes'] == '1' ? $rating : 'Запрещены') . '</td> <td>' . ViewLevelToStr(SafeDB($row['view'], 1, int)) . '</td> <td>' . $st . '</td> <td>' . $func . '</td> </tr>'; } $text .= '</table>'; AddText($text); if ($nav) { AddNavigation(); } }