Просмотр файла info.php

Размер файла: 4.81Kb
<?php
// by Mike O. (mides), coolcms.mobi

require_once 'system/sys.php';
require_once 'system/cache.php';
require_once 'system/header.php';

switch ($act) {
    default:
        tp($lang['info']);
        echo '<a href="index.php?act=faq">'.$lang['faq'].'</a><br />';
        echo '<a href="index.php?act=terms">'.$lang['terms'].'</a><br />';
        echo '<a href="?act=bb">'.$lang['bb_codes'].'</a><br />';
        echo '<a href="?act=smiles">'.$lang['smiley_faces'].'</a><br />';
        echo '<a href="?act=users">'.$lang['users'].'</a> '.stats_users().'<br />';
        nav_main();
	break;	
    case 'bb':
        tp($lang['bb_codes']);
        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 />

        '.$lang['link_with_a_name'].': [url=http://'.$lang['link'].']'.$lang['name'].'[/url]';
        nav('?');
    break;

    case 'smiles':
        echo '<div class="title">'.$lang['smiley_faces'].'</div><div class="list">';
        $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)) {
            if (!isset($num) ) $num = 1;  
            $num++;
            $row_class = (!($num % 2)) ? 'row1' : 'row2';	
            echo '<div class="'.$row_class.'">'.bb($smile['code']).' '.$smile['code'].'</div>';
        }
        navig($page, '?act=smiles&amp;', $pages);
        nav('?');
    break;

    case 'users':
        tp($lang['users'].' '.stats_users());
        note();
        echo '<form action="?act=search" method="post" name="form">
        <input name="username" type="text" maxlength="12" size="10" />
        <input name="submit" type="submit" value="Найти" />
        </form><br />';

        $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 '<a href="profile.php?id='.$user['id'].'">'.login($user['id']).'</a> ('.$user['karma'].')<br />';
        }
        navig($page, '?act=users&amp;', $pages);
        nav('?');
    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('Результат поиска');
                    echo '<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 'system/tail.php';
?>