View file other/info.php

File size: 10.11Kb
<?php
// by Mike O. (mides), coolcms.org

$title = 'Информация, FAQ';
require_once '../includes/sys.php';
require_once '../includes/cache.php';
require_once '../includes/header.php';

switch ($act) {
    default:
        tp($lang['info']);
        echo '<div class="row"><a href="../index.php?act=faq">'.$lang['faq'].'</a></div>
        <div class="row"><a href="../index.php?act=rules">'.$lang['terms'].'</a></div>
		<div class="row"><a href="?act=stat">Общая статистика</a></div>
		<div class="row"><a href="status.php">Статусы пользователей</a></div>
        <div class="row"><a href="?act=bb">'.$lang['bb_codes'].'</a></div>
		<div class="row"><a href="?act=avatars">Список аватар</a></div>
		<div class="row"><a href="?act=smiles">'.$lang['smiley_faces'].'</a></div>
        <div class="row"><a href="?act=users">'.$lang['users'].' ('.stats_users().')</a></div>
		<div class="row"><a href="?act=newcomers">Новички ('.stats_newcomers().')</a></div>
		<div class="row"><a href="?act=admins">Администрация ('.stats_admins().')</a></div>
		<div class="row"><a href="?act=styles">Популярные стили</a></div>';
	break;	

    case 'avatars':
		tp('<a href="?">Инфо</a>&raquo; Аватары');
        $total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `avatars`"), 0);

        $pages = ceil($total / $config['onpage']);
        if ($page > $pages or $page == 0) {
            $page = 1;
        }
        $begin = ($page - 1) * $config['onpage'];

        $avatars = mysql_query("SELECT * FROM `avatars` ORDER BY `id` DESC LIMIT $begin, $config[onpage]");
        while ($avatar = mysql_fetch_assoc($avatars)) {
            echo '<div class="row">';
			if ($u['id']) {
				echo '<a href="?act=avatars&amp;select='.$avatar['id'].'"><img src="../'.$avatar['path'].'"> установ.</a>';
			} else {
				echo '<img src="../'.$avatar['path'].'">';
			}
			echo '</div>';
        }
		echo '<div class="body">';
		echo '<a href="?">Инфо</a>&raquo; Аватары';
        navig($page, '?act=avatars&amp;', $pages);
        echo '</div>';
		
		if ($_GET['select']) {
			$select_id = abs(intval($_GET['select']));
			$select_check = mysql_num_rows(mysql_query("SELECT `id` FROM `avatars` WHERE `id` = '$select_id'"));
			if ($select_check) {
				mysql_query("UPDATE `users` SET `avatar` = '$select_id', `avatar_photo` = 0 WHERE `id` = '$u[id]'");
				redirect('profile.php?id='.$u['id']);
			} else {
				redirect('?act=avatars');
			}
		}
    break;

	case 'stat':
		tp('<a href="?">Инфо</a>&raquo; Статистика');
		echo '<div class="body">'.stats_site().'</div>';
	break;

    case 'styles':
        tp('<a href="?">Инфо</a>&raquo; Популярные стили');
		echo '<div class="body">';
		if ($u['id']){
			echo 'Ваш стиль: <b>'.$u['style'].'</b><br /><br />';
		}
		
        $styles_r = mysql_query("SELECT COUNT(`style`) AS `used_by`, `style` FROM `users` GROUP BY `style` ORDER BY `used_by` DESC");
		while ($style = mysql_fetch_assoc($styles_r)) {
			$link = empty($u['id']) ? $style['style'] : '<a href="?act=styles&amp;st='.$style['style'].'">'.$style['style'].'</a>';
			echo '<div class="main">'.$link.' - '.$style['used_by'].' чел.</div>';
		}
		
		if ($u['id']) {
			if (isset($_GET['st'])) {
				$st = check($_GET['st']);
				if (file_exists('../styles/'.$st.'/style.css')) {
					mysql_query("UPDATE `users` SET `style` = '$st' WHERE `id` = '$u[id]'");
					redirect('?act=styles');
				}
			}
			
		}
		echo '</div>';
    break;

    case 'newcomers':
        tp('<a href="?">Инфо</a>&raquo; Новички');
        $total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `regtime` > '".(time()- 86400 * 3)."'"), 0);
		if ($total > 0) {
			$pages = ceil($total / $config['onpage']);
			if ($page > $pages or $page == 0) {
				$page = 1;
			}
			$begin = ($page - 1) * $config['onpage'];
	
			$usersnew_r = mysql_query("SELECT `id`, `regtime` FROM `users` WHERE `regtime` > '".(time()- 86400 * 3)."' ORDER BY `regtime` DESC LIMIT $begin, $config[onpage]");
			while ($usernew = mysql_fetch_assoc($usersnew_r)) {
				echo '<div class="row"><a href="profile.php?id='.$usernew['id'].'">'.username($usernew['id'], 2).' (рег.: '.ccdate($usernew['regtime'], 0).')</a></div>';
			}
		} else {
			echo '<div class="body">Новичков нет</div>';
		}
		echo '<div class="body">';
		navig($page, '?act=newcomers&amp;', $pages);
		echo '<a href="?">Инфо</a>&raquo; Новички</div>';
    break;

	case 'admins':
		tp('<a href="?">Инфо</a>&raquo; Администрация ('.stats_admins().')');
		echo '<div class="body">';
		$admin_r = mysql_query("SELECT `id` FROM `users` WHERE `access` > 0 ORDER BY `access` DESC");	
		while ($admin = mysql_fetch_assoc($admin_r)) {
			echo '<a href="profile.php?id='.$admin['id'].'">'.username($admin['id'], 2).'</a> ('.access2($admin['id']).')<br />';
		}
		
		if ($u['id']) {
			echo '<br /><b>Написать в приват</b><br /><form name="form" action="main.php?act=send&amp;ok=1" method="post" name="form"><select name="username">';
			$admin_pm_r = mysql_query("SELECT `id`, `username` FROM `users` WHERE `access` > 0 ORDER BY `access` DESC");
			while ($admin_pm = mysql_fetch_assoc($admin_pm_r)) {
				echo '<option value="'.$admin_pm['username'].'">'.$admin_pm['username'].'</option>';
			}
			echo '</select><br />
			Сообщение(max250):<br />
			<textarea name="text" cols="" rows="4"></textarea><br />
			<input name="submit" type="submit" value="Ok" />
			</form>';
		}
		echo '</div>';
	break;
	
    case 'bb':
        tp('<a href="?">Инфо</a>&raquo; '.$lang['bb_codes']);
		echo '<div class="body">';
        echo '[red]'.bb('[red]'.$lang['red_font'].'[/red]').'[/red]<br />
        [blue]'.bb('[blue]'.$lang['blue_font'].'[/blue]').'[/blue]<br />
        [black]'.bb('[black]'.$lang['black_font'].'[/black]').'[/black]<br />
        [green]'.bb('[green]'.$lang['green_font'].'[/green]').'[/green]<br />
        [orange]'.bb('[orange]'.$lang['orange_font'].'[/orange]').'[/orange]<br />
        [pink]'.bb('[pink]'.$lang['pink_font'].'т[/pink]').'[/pink]<br />
        [gray]'.bb('[gray]'.$lang['gray_font'].'[/gray]').'[/gray]<br />
        [big]'.bb('[big]'.$lang['big_font'].'[/big]').'[/big]<br />
        [small]'.bb('[small]'.$lang['small_font'].'[/small]').'[/small]<br />
        [b]'.bb('[b]'.$lang['bold_font'].'[/b]').'[/b]<br />
        [u]'.bb('[u]'.$lang['underline_font'].'[/u]').'[/u]<br />
        [i]'.bb('[i]'.$lang['incline_font'].'[/i]').'[/i]<br />
        [strike]'.bb('[strike]'.$lang['strike_font'].'[/strike]').'[/strike]<br /><br />

        Для вставки ссылки: http://ссылка_на_сайт<br />
		'.$lang['link_with_a_name'].': [url=http://'.$lang['link'].']'.$lang['name'].'[/url]';
		echo '</div>';
    break;

    case 'smiles':
		tp('<a href="?">Инфо</a>&raquo; Смайлы');
		echo '<div class="body">';
        $total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `smiles`"), 0);

        $pages = ceil($total / $config['onpage']);
        if ($page > $pages or $page == 0) {
            $page = 1;
        }
        $begin = ($page - 1) * $config['onpage'];

        $smiles_r = mysql_query("SELECT * FROM `smiles` ORDER BY `id` DESC LIMIT $begin, $config[onpage]");
        while ($smile = mysql_fetch_assoc($smiles_r)) {
            echo bb($smile['code']).' '.$smile['code'].'<hr>';
        }
        navig($page, '?act=smiles&amp;', $pages);
        echo '</div>';
    break;

    case 'users':
        tp('<a href="?">Инфо</a>&raquo; '.$lang['users'].' ('.stats_users().')');
		echo '<div class="body">';
        note();
        echo '<form name="form" action="?act=search" method="post" name="form">
        <input name="username" type="text" maxlength="12" size="10" />
        <input name="submit" type="submit" value="Найти" />
        </form></div>';

        $total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users`"), 0);

        $pages = ceil($total / $config['onpage']);
        if ($page > $pages or $page == 0) {
            $page = 1;
        }
        $begin = ($page - 1) * $config['onpage'];

        $users_r = mysql_query("SELECT `id`, `karma` FROM `users` ORDER BY `karma` DESC LIMIT $begin, $config[onpage]");
        while ($user = mysql_fetch_assoc($users_r)) {
            echo '<div class="row"><a href="profile.php?id='.$user['id'].'">'.username($user['id'], 2).' ('.$user['karma'].')</a></div>';
        }
		echo '<div class="body">';
        navig($page, '?act=users&amp;', $pages);
		echo '<a href="?">Инфо</a>&raquo; '.$lang['users'].'</div>';
    break;

    case 'search':
        if ($ok) {
            $id = empty($_POST['username']) ? 0 : abs(intval($_POST['username']));
            redirect('profile.php?id='.$id);
        } else {
            if (!empty($_POST['username'])) {
                $username = check($_POST['username']);
                $users_r = mysql_query("SELECT `id`, `username` FROM `users` WHERE `username` LIKE '%$username%'");
                if (mysql_num_rows($users_r)) {
                    tp('<a href="?">Инфо</a>&raquo; Результат поиска');
					echo '<div class="body">';
                    echo '<form name="form" action="?act=search&amp;ok=1" method="post" name="form"><select name="username">';
                    while ($user = mysql_fetch_assoc($users_r)) {
                            echo '<option value="'.$user['id'].'">'.$user['username'].'</option>';
                    }
                    echo '</select><br />
                    <input name="submit" type="submit" value="Okay" />
                    </form>';
                    nav('?act=users');
                } else {
                    $_SESSION['note'] = 'Ничего не найдено.';
                    redirect('?act=users');
                }
            } else {
                redirect('?act=users');
            }
        }
    break;
	
}

require_once '../includes/tail.php';
?>