Example #1
0
function print_index_tabs($option = -1)
{
    global $globals, $db, $current_user;
    if ($globals['mobile'] && !$current_user->has_subs || !empty($globals['submnm']) && !$current_user->user_id) {
        return;
    }
    $items = array();
    $items[] = array('id' => 0, 'url' => $globals['meta_skip'], 'title' => _('Todas'));
    if (isset($current_user->has_subs)) {
        $items[] = array('id' => 7, 'url' => $globals['meta_subs'], 'title' => _('Suscripciones'));
    }
    if (!$globals['mobile'] && empty($globals['submnm']) && ($subs = SitesMgr::get_sub_subs())) {
        foreach ($subs as $sub) {
            $items[] = array('id' => 9999, 'url' => 'm/' . $sub->name, 'selected' => false, 'title' => $sub->name);
        }
    }
    // RSS teasers
    switch ($option) {
        case 7:
            // Personalised, published
            $feed = array("url" => "?subs=" . $current_user->user_id, "title" => _('Suscripciones'));
            break;
        default:
            $feed = array("url" => '', "title" => "");
            break;
    }
    if ($current_user->user_id > 0) {
        $items[] = array('id' => 1, 'url' => '?meta=_friends', 'title' => _('Amigos'));
    }
    $vars = compact('items', 'option', 'feed');
    return Haanga::Load('print_tabs.html', $vars);
}
Example #2
0
function print_subs_form($selected = false)
{
    global $db, $globals, $current_user;
    function id($s)
    {
        return $s->id;
    }
    if (!empty($globals['submnm'])) {
        $subs = false;
    } else {
        $subs = SitesMgr::get_sub_subs();
        $ids = array_map('id', $subs);
        // A link in a sub is edited from another sub, or from the main site
        // Add its selected sub.
        if ($selected != false && !in_array($selected, $ids)) {
            $e = SitesMgr::get_info($selected);
            if ($e) {
                array_unshift($subs, $e);
                // Add to the form
                array_unshift($ids, $selected);
                // Avoid to show it again if subscribed to
            }
        }
        $extras = SitesMgr::get_subscriptions($current_user->user_id);
        // Don't repeat the same subs
        $subscriptions = array();
        foreach ($extras as $s) {
            if (!in_array($s->id, $ids)) {
                $subscriptions[] = $s;
            }
        }
    }
    if ($selected == false) {
        $selected = SitesMgr::my_id();
    }
    $vars = compact('selected', 'subs', 'subscriptions');
    return Haanga::Load('form_subs.html', $vars);
}
Example #3
0
function print_shakeit_tabs($option = -1)
{
    global $globals, $current_user, $db;
    $items = array();
    $items[] = array('id' => 1, 'url' => 'queue' . $globals['meta_skip'], 'title' => _('todas'));
    if ($current_user->has_subs) {
        $items[] = array('id' => 7, 'url' => 'queue' . $globals['meta_subs'], 'title' => _('suscripciones'));
    }
    if (empty($globals['submnm']) && !$globals['mobile']) {
        $subs = SitesMgr::get_sub_subs();
        foreach ($subs as $sub) {
            $items[] = array('id' => 9999, 'url' => 'm/' . $sub->name . '/queue', 'selected' => false, 'title' => $sub->name);
        }
    }
    $items[] = array('id' => 8, 'url' => 'queue?meta=_*', 'title' => _('m/*'));
    $items[] = array('id' => 3, 'url' => 'queue?meta=_popular', 'title' => _('candidatas'));
    if ($current_user->user_id > 0) {
        $items[] = array('id' => 2, 'url' => 'queue?meta=_friends', 'title' => _('amigos'));
    }
    if (!$globals['bot']) {
        $items[] = array('id' => 5, 'url' => 'queue?meta=_discarded', 'title' => _('descartadas'));
    }
    // Print RSS teasers
    if (!$globals['mobile']) {
        switch ($option) {
            case 7:
                // Personalised, queued
                $feed = array("url" => "?status=queued&subs=" . $current_user->user_id, "title" => "");
                break;
            default:
                $feed = array("url" => "?status=queued", "title" => "");
                break;
        }
    }
    $vars = compact('items', 'option', 'feed');
    return Haanga::Load('print_tabs.html', $vars);
}