Пример #1
0
    do_header($login, 'profile', User::get_menu_items($view, $login));
}
// Used to show the user the number of unread answers to her comments
if ($current_user->user_id == $user->id) {
    $globals['extra_comment_conversation'] = ' [' . Comment::get_unread_conversations($user->id) . ']';
} else {
    $globals['extra_comment_conversation'] = '';
}
echo '<div id="singlewrap">' . "\n";
$url_login = urlencode($login);
switch ($view) {
    case 'subs':
        do_subs();
        break;
    case 'history':
        do_history();
        if (!$globals['bot']) {
            do_pages($rows, $page_size);
        }
        break;
    case 'commented':
        do_commented();
        if (!$globals['bot']) {
            do_pages($rows, $page_size, false);
        }
        break;
    case 'shaken':
        do_shaken();
        if (!$globals['bot']) {
            do_pages($rows, $page_size);
        }
Пример #2
0
    $history = $fcache->get('hash_history');
    if (!$history) {
        $history = array();
    }
    if (array_key_exists($chars, $history)) {
        return array_keys($history);
    }
    if (count($history) > $max) {
        $key_del = array_rand($history, 1);
        unset($history[$key_del]);
    }
    $history[$chars] = '';
    $fcache->add('hash_history', $history);
    return array_keys($history);
}
// GET route
$app->get('/', function () use($app) {
    $chars = 'DigHash';
    $random = get_randoms(20);
    $history = do_history($chars);
    $app->render('hash.html', array('chars' => $chars, 'hash_rst' => cal_hash($chars), 'random' => $random, 'history' => $history));
});
$app->get('/:chars.html', function ($chars) use($app) {
    $random = get_randoms(20);
    $history = do_history($chars);
    $app->render('hash.html', array('chars' => $chars, 'hash_rst' => cal_hash($chars), 'random' => $random, 'history' => $history));
});
$app->notFound(function () use($app) {
    $app->redirect('/', 301);
});
$app->run();