Esempio n. 1
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if ($verify['username']) {
            $feed->user = $verify;
            $feed->username = $verify['username'];
            $feed->id = $verify['idu'];
        }
    }
    $feed->per_page = $settings['qperpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->l_per_post = $settings['lperpost'];
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('shared/rows');
    $rows = '';
    // If the $_GET keyword is empty [user]
    if ($_GET['q'] == '') {
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if ($_GET['filter'] == 'tracks') {
        list($tracks, $error) = $feed->searchTracks(0, $_GET['q']);
        $TMPL['messages'] = $tracks;
    } elseif ($_GET['filter'] == 'playlists') {
        $playlist = $feed->getPlaylists(0, 2, $_GET['q']);
        $error = $feed->showError('no_results', 1);
        $TMPL['messages'] = empty($playlist) ? $error[0] : $playlist;
    } else {
        $TMPL['messages'] = $feed->getSearch(0, $settings['qperpage'], $_GET['q'], $_GET['filter']);
    }
    $rows = $skin->make();
    $skin = new skin('search/sidebar');
    $sidebar = '';
    $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 10);
    $TMPL['filters'] = $feed->sidebarFilters($_GET['filter'], $_GET['q']);
    $TMPL['ad'] = generateAd($settings['ad6']);
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['top'] = $top;
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['search'] . ' - ' . htmlspecialchars($_GET['q']) . ' - ' . $settings['title'];
    $TMPL['header'] = pageHeader($LNG['search'] . ' - ' . $_GET['q']);
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 2
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->user = $verify;
            $feed->id = $verify['idu'];
            $feed->username = $verify['username'];
            $feed->per_page = $settings['perpage'];
            $feed->time = $settings['time'];
            $feed->censor = $settings['censor'];
            $feed->smiles = $settings['smiles'];
            $feed->c_per_page = $settings['cperpage'];
            $feed->c_start = 0;
            $feed->l_per_post = $settings['lperpost'];
            $feed->online_time = $settings['conline'];
            $feed->friends_online = $settings['ronline'];
            $feed->subscriptionsList = $feed->getSubs($verify['idu'], 0);
            $feed->subscribersList = $feed->getSubs($verify['idu'], 1);
            $feed->updateStatus($verify['offline']);
            // Useed in timeline javascript which checks for new messages
            $TMPL['subs'] = 1;
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('shared/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            list($timeline, $message) = $feed->getFeed(0, $_GET['filter']);
            $TMPL['messages'] = $timeline;
            $rows = $skin->make();
            $skin = new skin('feed/sidebar');
            $sidebar = '';
            $TMPL['editprofile'] = $feed->fetchProfileWidget($verify['username'], realName($verify['username'], $verify['first_name'], $verify['last_name']), $verify['image']);
            $TMPL['sidebar'] = $feed->sidebarTypes($_GET['filter'], $feed->subscriptions);
            $TMPL['dates'] = $feed->sidebarDates($_GET['filter'], $feed->subscriptions);
            $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 5);
            $TMPL['users'] = $feed->onlineUsers();
            $TMPL['subscriptions'] = $feed->sidebarSubs(0, 0);
            $TMPL['subscribers'] = $feed->sidebarSubs(1, 0);
            $TMPL['friendsactivity'] = $feed->sidebarFriendsActivity(20, 1);
            if (count($feed->subscriptionsList[0]) < 6) {
                $TMPL['suggestions'] = $feed->sidebarSuggestions();
            }
            $TMPL['ad'] = generateAd($settings['ad3']);
            $sidebar = $skin->make();
            $skin = new skin('shared/top');
            $top = '';
            // $TMPL['top'] = $feed->getForm();
            $TMPL['theme_url'] = $CONF['theme_url'];
            $TMPL['private_message'] = $verify['privacy'];
            $TMPL['avatar'] = $verify['image'];
            $TMPL['url'] = $CONF['url'];
            $top = $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['top'] = $top;
            $TMPL['rows'] = $rows;
            $TMPL['sidebar'] = $sidebar;
            // If the username input string is an e-mail, switch the query
            if (isset($_SESSION['username'])) {
                if (filter_var($_SESSION['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                }
            } elseif (isset($_COOKIE['username'])) {
                if (filter_var($_COOKIE['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                }
            }
            while ($row = $result->fetch_assoc()) {
                $status = $row['status'];
            }
            if ($status == 0) {
                header("Location: " . $CONF['url'] . "/index.php?a=contact");
            } elseif ($status == 1) {
                header("Location: " . $CONF['url'] . "/index.php?a=employee");
            }
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['title_feed'] . ' - ' . $settings['title'];
    $skin = new skin('shared/timeline');
    return $skin->make();
}
Esempio n. 3
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    $_GET['u'] = htmlspecialchars($_GET['u']);
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        }
        // If the $_GET user is empty, define default user as current logged in user, else redirect to home-page
        if ($_GET['u'] == '') {
            $_GET['u'] = !empty($verify['username']) ? $verify['username'] : header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        }
    }
    // Start displaying the Feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = $settings['perpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->c_per_page = $settings['cperpage'];
    $feed->c_start = 0;
    $feed->l_per_post = $settings['lperpost'];
    if ($verify['username']) {
        $feed->updateStatus($verify['offline']);
    }
    // If the $_GET user is empty, define default user as current logged in user, else redirect to home-pag
    if ($_GET['u'] == '') {
        $_GET['u'] = !empty($feed->username) ? $feed->username : header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $feed->profile = $_GET['u'];
    $feed->profile_data = $feed->profileData($_GET['u']);
    $feed->subscriptionsList = $feed->getSubs($feed->profile_data['idu'], 0, null);
    $feed->subscribersList = $feed->getSubs($feed->profile_data['idu'], 1, null);
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('shared/rows');
    $rows = '';
    if (empty($_GET['filter'])) {
        $_GET['filter'] = '';
    }
    // Allowed types
    list($timeline, $message) = $feed->getProfile(0, $_GET['filter']);
    if ($_GET['r'] == 'subscriptions') {
        if ($message !== 1) {
            $feed->s_per_page = $settings['sperpage'];
            $feed->subsList = $feed->getSubs($feed->profile_data['idu'], 0, 0);
            $TMPL['messages'] = $feed->listSubs(0);
        } else {
            $TMPL['messages'] = $timeline;
        }
        $title = $LNG['subscriptions'];
    } elseif ($_GET['r'] == 'subscribers') {
        if ($message !== 1) {
            $feed->s_per_page = $settings['sperpage'];
            $feed->subsList = $feed->getSubs($feed->profile_data['idu'], 1, 0);
            $TMPL['messages'] = $feed->listSubs(1);
        } else {
            $TMPL['messages'] = $timeline;
        }
        $title = $LNG['subscribers'];
    } elseif ($_GET['r'] == 'likes') {
        if ($message !== 1) {
            $likes = $feed->getLikes(0, 1);
            $TMPL['messages'] = $likes[0];
        } else {
            $TMPL['messages'] = $timeline;
        }
        $title = $LNG['likes'];
    } elseif ($_GET['r'] == 'playlists') {
        if ($message !== 1) {
            $TMPL['messages'] = $feed->getPlaylists(0, 1);
        } else {
            $TMPL['messages'] = $timeline;
        }
        $title = $LNG['playlists'];
    } else {
        $TMPL['messages'] = $timeline;
    }
    $rows = $skin->make();
    $skin = new skin('profile/sidebar');
    $sidebar = '';
    // If the username doesn't exist
    if ($message !== 1) {
        $TMPL['about'] = $feed->fetchProfileInfo($feed->profileData($_GET['u']));
        $TMPL['dates'] = $feed->sidebarDates($_GET['filter'], 'profile');
        $TMPL['ad'] = generateAd($settings['ad4']);
    } else {
        $skin = new skin('profile/sidebar');
        $sidebar = '';
        $TMPL['ad'] = generateAd($settings['ad4']);
    }
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    $TMPL['cover'] = $feed->fetchProfile($feed->profile_data);
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = (!empty($title) ? $title : $LNG['title_profile']) . ' - ' . realName($_GET['u'], $feed->profile_data['first_name'], $feed->profile_data['last_name'], 1) . ' - ' . $settings['title'];
    $TMPL['meta_description'] = realName($_GET['u'], $feed->profile_data['first_name'], $feed->profile_data['last_name'], 1) . ' ' . $feed->profile_data['description'];
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 4
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->user = $verify;
            $feed->id = $verify['idu'];
            $feed->username = $verify['username'];
            $feed->per_page = $settings['perpage'];
            $feed->time = $settings['time'];
            $feed->censor = $settings['censor'];
            $feed->smiles = $settings['smiles'];
            $feed->c_per_page = $settings['cperpage'];
            $feed->c_start = 0;
            $feed->l_per_post = $settings['lperpost'];
            $feed->online_time = $settings['conline'];
            $feed->friends_online = $settings['ronline'];
            $feed->subscriptionsList = $feed->getSubs($verify['idu'], 0);
            $feed->subscribersList = $feed->getSubs($verify['idu'], 1);
            $feed->updateStatus($verify['offline']);
            $TMPL['uid'] = $verify['idu'];
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('shared/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            list($timeline, $message) = $feed->getTimeline(0, $_GET['filter']);
            $TMPL['messages'] = $timeline;
            $rows = $skin->make();
            $skin = new skin('timeline/sidebar');
            $sidebar = '';
            $TMPL['editprofile'] = $feed->fetchProfileWidget($verify['username'], realName($verify['username'], $verify['first_name'], $verify['last_name']), $verify['image']);
            $TMPL['sidebar'] = $feed->sidebarTypes($_GET['filter'], 'timeline');
            $TMPL['dates'] = $feed->sidebarDates($_GET['filter'], 'timeline');
            $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 5);
            $TMPL['users'] = $feed->onlineUsers();
            $TMPL['subscriptions'] = $feed->sidebarSubs(0, 0);
            $TMPL['subscribers'] = $feed->sidebarSubs(1, 0);
            $TMPL['friendsactivity'] = $feed->sidebarFriendsActivity(20, 1);
            if (count($feed->subscriptionsList[0]) < 6) {
                $TMPL['suggestions'] = $feed->sidebarSuggestions();
            }
            $TMPL['ad'] = generateAd($settings['ad2']);
            $sidebar = $skin->make();
            $skin = new skin('shared/top');
            $top = '';
            // $TMPL['top'] = $feed->getForm();
            $TMPL['theme_url'] = $CONF['theme_url'];
            $TMPL['private_message'] = $verify['privacy'];
            $TMPL['avatar'] = $verify['image'];
            $TMPL['url'] = $CONF['url'];
            $top = $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['top'] = $top;
            $TMPL['rows'] = $rows;
            $TMPL['sidebar'] = $sidebar;
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['title_timeline'] . ' - ' . $settings['title'];
    $skin = new skin('shared/timeline');
    return $skin->make();
}
Esempio n. 5
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if ($verify['username']) {
            $feed->user = $verify;
            $feed->username = $verify['username'];
            $feed->id = $verify['idu'];
            if (isset($_GET['tag'])) {
                $skin = new skin('shared/top');
                $top = '';
                $TMPL['theme_url'] = $CONF['theme_url'];
                $TMPL['private_message'] = $verify['privacy'];
                $TMPL['avatar'] = $verify['image'];
                $TMPL['url'] = $CONF['url'];
                $top = $skin->make();
            }
        }
    }
    $feed->per_page = $settings['perpage'];
    $feed->time = $settings['time'];
    $feed->censor = $settings['censor'];
    $feed->smiles = $settings['smiles'];
    $feed->c_per_page = $settings['cperpage'];
    $feed->c_start = 0;
    $feed->l_per_post = $settings['lperpost'];
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('shared/rows');
    $rows = '';
    if (empty($_GET['filter'])) {
        $_GET['filter'] = '';
    }
    // Allowed types
    if (isset($_GET['tag'])) {
        // If the $_GET keyword is empty [hashtag]
        if ($_GET['tag'] == '') {
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        }
        $hashtags = $feed->getHashtags(0, $settings['qperpage'], $_GET['tag'], null);
        $TMPL['messages'] = $hashtags[0];
    } else {
        // If the $_GET keyword is empty [user]
        if ($_GET['q'] == '') {
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        }
        $TMPL['messages'] = $feed->getSearch(0, $settings['qperpage'], $_GET['q'], $_GET['filter']);
    }
    $rows = $skin->make();
    $skin = new skin('search/sidebar');
    $sidebar = '';
    if (isset($_GET['tag'])) {
        $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 10);
    } else {
        $TMPL['genre'] = $feed->sidebarGender($_GET['filter'], $_GET['q']);
    }
    $TMPL['ad'] = generateAd($settings['ad6']);
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['top'] = $top;
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    if (isset($_GET['tag'])) {
        $TMPL['title'] = '#' . $_GET['tag'] . ' - ' . $settings['title'];
    } else {
        $TMPL['title'] = $LNG['title_search'] . ' - ' . $_GET['q'] . ' - ' . $settings['title'];
    }
    $skin = new skin('shared/timeline_x');
    return $skin->make();
}
Esempio n. 6
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
    }
    // Start displaying the Feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = $settings['perpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->c_per_page = $settings['cperpage'];
    $feed->c_start = 0;
    $feed->l_per_post = $settings['lperpost'];
    $feed->paypalapp = $settings['paypalapp'];
    if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) {
        $loggedInAdmin = new loggedInAdmin();
        $loggedInAdmin->db = $db;
        $loggedInAdmin->url = $CONF['url'];
        $loggedInAdmin->username = $_SESSION['usernameAdmin'];
        $loggedInAdmin->password = $_SESSION['passwordAdmin'];
        $loggedIn = $loggedInAdmin->verify();
        if ($loggedIn['username']) {
            // Set admin level
            $feed->is_admin = 1;
        }
    }
    $TMPL_old = $TMPL;
    $TMPL = array();
    // Get the track
    $track = $feed->getTrack($_GET['id']);
    $trackInfo = $feed->getTrackInfo($_GET['id'], 0);
    // Verify the track owner for certain pages
    if (!$trackInfo[1] && ($_GET['type'] == 'stats' || $_GET['type'] == 'edit')) {
        header("Location: " . $CONF['url']);
    }
    // Match the content from the song-title class in order to set it for the title tag
    preg_match_all('/<div.*(class="song-title").*>([\\d\\D]*)<\\/div>/iU', $track[0], $title);
    if (empty($title[2][0])) {
        preg_match_all('/<div.*(class="page-header").*>([\\d\\D]*)<\\/div>/iU', $track[0], $title);
    }
    $TMPL['id'] = $_GET['id'];
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = strip_tags($title[2][0]);
    $TMPL['url_title'] = $trackInfo[0];
    // If the user can view the track, and the report is set
    if (!$track[1] && $_GET['type'] == 'report') {
        if (!$feed->id) {
            header("Location: " . $CONF['url']);
        }
        $skin = new skin('track/report');
        $rows = '';
        if (isset($_POST['copyright'])) {
            $TMPL['message'] = $feed->report($_GET['id'], 1);
        }
    } elseif (!$track[1] && $_GET['type'] == 'stats') {
        $skin = new skin('track/stats');
        $rows = '';
        $stats = $feed->getTrackStats($_GET['id'], $_GET['filter'], 0);
        $most = $feed->getTrackStats($_GET['id'], $_GET['filter'], 1, 10);
        $TMPL['plays'] = $stats['plays'];
        $TMPL['likes'] = $stats['likes'];
        $TMPL['comments'] = $stats['comments'];
        $TMPL['downloads'] = $stats['downloads'];
        $TMPL['played_most'] = $most['played'];
        $TMPL['downloaded_most'] = $most['downloaded'];
        $TMPL['top_countries'] = $most['countries'];
        $TMPL['top_cities'] = $most['cities'];
        $TMPL['go_pro'] = $most['gopro'];
    } elseif (!$track[1] && $_GET['type'] == 'likes') {
        $skin = new skin('track/likes');
        $rows = '';
        $feed->per_page = $settings['qperpage'];
        $TMPL['likes'] = $feed->getLikes(0, 2, $_GET['id']);
    } elseif (!$track[1] && $_GET['type'] == 'edit') {
        $skin = new skin('track/edit');
        $rows = '';
        $TMPL['page_title'] = $LNG['edit'] . ' -';
        $TMPL['form_url'] = $CONF['url'] . '/index.php?a=track&id=' . $_GET['id'] . '&type=edit';
        $feed->art_size = $settings['artsize'];
        $feed->art_format = $settings['artformat'];
        if (!empty($_POST['save'])) {
            $update = $feed->updateTrack($_POST, 0);
            $TMPL['message'] = $update;
        }
        $currentTrack = $feed->getTrackInfo($_GET['id'], 1);
        foreach ($currentTrack as $key => $info) {
            $TMPL[$key] = $info;
        }
        $date = explode('-', $TMPL['release']);
        $TMPL['years'] = generateDateForm(0, $date[0]);
        $TMPL['months'] = generateDateForm(1, $date[1]);
        $TMPL['days'] = generateDateForm(2, $date[2]);
        if ($TMPL['download'] == 0) {
            $TMPL['doff'] = ' selected="selected"';
        } else {
            $TMPL['don'] = ' selected="selected"';
        }
        if ($TMPL['public'] == 0) {
            $TMPL['poff'] = ' selected="selected"';
        } else {
            $TMPL['pon'] = ' selected="selected"';
        }
        if ($TMPL['license'] == 0) {
            $TMPL['ar'] = 'checked';
        } else {
            $TMPL['cc'] = 'checked';
            $license = str_split($TMPL['license']);
            $TMPL['nc'] = $license[1];
            $TMPL['nd_sa'] = $license[2];
        }
        $TMPL['display'] = 'none';
        $TMPL['btntext'] = $LNG['save'];
    } else {
        $skin = new skin('track/rows');
        $rows = '';
        // If the track id is not set, or it doesn't consist from digits
        if (!isset($_GET['id']) || !ctype_digit($_GET['id'])) {
            header("Location: " . $CONF['url']);
        }
        $TMPL['messages'] = $track[0];
        // If the output is empty redirect to home-page
        if (empty($TMPL['messages'])) {
            header("Location: " . $CONF['url']);
        }
    }
    $rows = $skin->make();
    $skin = new skin('track/sidebar');
    $sidebar = '';
    $TMPL['ad'] = generateAd($settings['ad5']);
    // If the track can be viewed
    if (!$track[1]) {
        $TMPL['edit'] = $feed->sidebarButton($_GET['id'], 1);
        if (isset($_GET['type']) && $_GET['type'] !== 'edit') {
            unset($TMPL['edit']);
        }
        if ($_GET['type'] == 'stats') {
            $TMPL['statistics'] = $feed->sidebarStatsFilters($_GET['filter']);
        } else {
            $TMPL['statistics'] = $feed->sidebarStatistics($_GET['id'], 1, $trackInfo[1]);
        }
        $TMPL['description'] = $feed->sidebarDescription($_GET['id'], 0);
        $TMPL['tags'] = $feed->sidebarKeywords($_GET['id'], 0);
        $TMPL['report'] = $feed->sidebarReport($_GET['id']);
    }
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $title = strip_tags(trim($title[2][0]));
    $TMPL['title'] = ($_GET['type'] == 'report' || $_GET['type'] == 'stats' || $_GET['type'] == 'likes' || $_GET['type'] == 'edit' ? $LNG["{$_GET['type']}"] . ' - ' : '') . $title . ' - ' . $settings['title'];
    $TMPL['meta_description'] = $title . ' ' . $feed->sidebarDescription($_GET['id'], 0, 1);
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 7
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->username = $verify['username'];
            $feed->id = $verify['idu'];
            $feed->per_page = $settings['perpage'];
            $feed->time = $settings['time'];
            $feed->c_per_page = $settings['cperpage'];
            $feed->c_start = 0;
            $feed->subscriptionsList = $feed->getSubs($verify['idu'], 0);
            $feed->subscribersList = $feed->getSubs($verify['idu'], 1);
            // $feed->image = $verify['image'];
            $TMPL['uid'] = $verify['idu'];
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('shared/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            if ($_GET['filter'] == 'likes') {
                $x = $feed->checkNewNotifications($settings['nperpage'], 2, 2, 1, null, null, null);
            } elseif ($_GET['filter'] == 'comments') {
                $x = $feed->checkNewNotifications($settings['nperpage'], 2, 2, null, 1, null, null);
            } elseif ($_GET['filter'] == 'friendships') {
                $x = $feed->checkNewNotifications($settings['nperpage'], 2, 2, null, null, 1, null);
            } elseif ($_GET['filter'] == 'chats') {
                $x = $feed->checkNewNotifications($settings['nperpage'], 2, 2, null, null, null, 1);
            } else {
                $x = $feed->checkNewNotifications($settings['nperpage'], 2, 2, 1, 1, 1, 1);
            }
            $TMPL['messages'] = '<div class="message-content" id="notifications-page"><div style="margin-top:-1px;">' . $x . '</div></div>';
            $rows = $skin->make();
            $skin = new skin('shared/sidebar');
            $sidebar = '';
            $TMPL['sidebar'] = $feed->sidebarNotifications($_GET['filter'], 'feed');
            $TMPL['ad3'] = generateAd($settings['ad3']);
            $sidebar = $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['rows'] = $rows;
            $TMPL['sidebar'] = $sidebar;
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['title_notifications'] . ' - ' . $settings['title'];
    $TMPL['header'] = pageHeader($LNG['title_notifications']);
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 8
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
    }
    // Start displaying the Feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = $settings['perpage'];
    $feed->time = $settings['time'];
    $feed->censor = $settings['censor'];
    $feed->smiles = $settings['smiles'];
    $feed->c_per_page = 99999;
    // Show n of comments
    $feed->c_start = 0;
    $feed->l_per_post = $settings['lperpost'];
    if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) {
        $loggedInAdmin = new loggedInAdmin();
        $loggedInAdmin->db = $db;
        $loggedInAdmin->url = $CONF['url'];
        $loggedInAdmin->username = $_SESSION['usernameAdmin'];
        $loggedInAdmin->password = $_SESSION['passwordAdmin'];
        $loggedIn = $loggedInAdmin->verify();
        if ($loggedIn['username']) {
            // Set admin level
            $feed->is_admin = 1;
        }
    }
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('post/rows');
    $rows = '';
    if (empty($_GET['filter'])) {
        $_GET['filter'] = '';
    }
    // If the message id is not set, or it doesn't consist from digits
    if (!isset($_GET['m']) || !ctype_digit($_GET['m'])) {
        header("Location: " . $CONF['url']);
    }
    $message = $feed->getMessage($_GET['m']);
    $TMPL['messages'] = $message[0];
    // If the output is empty redirect to home-page
    if (empty($TMPL['messages'])) {
        header("Location: " . $CONF['url']);
    }
    $rows = $skin->make();
    $skin = new skin('post/sidebar');
    $sidebar = '';
    $TMPL['ad'] = generateAd($settings['ad5']);
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    // Match the content from the message-message class in order to set it for the title tag
    preg_match_all('/<div.*(class="message-message").*>([\\d\\D]*)<\\/div>/iU', $message[0], $title);
    $TMPL['title'] = $LNG['title_post'] . ' - ' . substr(strip_tags($title[2][0]), 0, 40) . '... - ' . $settings['title'];
    $skin = new skin('shared/timeline_x');
    return $skin->make();
}
Esempio n. 9
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
        }
    }
    // Start the music feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = $settings['perpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->l_per_post = $settings['lperpost'];
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('shared/rows');
    $rows = '';
    if (empty($_GET['filter'])) {
        $_GET['filter'] = '';
    }
    // Allowed types
    list($timeline, $message) = $feed->explore(0, $_GET['filter']);
    $TMPL['messages'] = $timeline;
    $rows = $skin->make();
    $skin = new skin('explore/sidebar');
    $sidebar = '';
    $feed->online_time = $settings['conline'];
    $feed->friends_online = $settings['ronline'];
    $feed->updateStatus($verify['offline']);
    if ($verify['username']) {
        $TMPL['upload'] = $feed->sidebarButton();
        $TMPL['suggestions'] = $feed->sidebarSuggestions();
    }
    $TMPL['categories'] = $feed->sidebarCategories($_GET['filter']);
    $TMPL['ad'] = generateAd($settings['ad2']);
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['explore'] . (!empty($_GET['filter']) ? ' - ' . htmlspecialchars($_GET['filter']) . ' - ' : ' - ') . $settings['title'];
    $TMPL['header'] = pageHeader($LNG['explore'] . (!empty($_GET['filter']) ? ' - ' . $_GET['filter'] : ''));
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 10
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
    }
    // Start displaying the Feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = -1;
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->c_start = 0;
    $feed->l_per_post = 0;
    if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) {
        $loggedInAdmin = new loggedInAdmin();
        $loggedInAdmin->db = $db;
        $loggedInAdmin->url = $CONF['url'];
        $loggedInAdmin->username = $_SESSION['usernameAdmin'];
        $loggedInAdmin->password = $_SESSION['passwordAdmin'];
        $loggedIn = $loggedInAdmin->verify();
        if ($loggedIn['username']) {
            // Set admin level
            $feed->is_admin = 1;
        }
    }
    $TMPL_old = $TMPL;
    $TMPL = array();
    // Get the track
    $playlist = $feed->getPlaylists(0, 3, $_GET['id']);
    // Match the content from the song-title class in order to set it for the title tag
    preg_match_all('/<div.*(class="playlist-title").*>([\\d\\D]*)<\\/div>/iU', $playlist[0], $title);
    if (empty($title[2][0])) {
        preg_match_all('/<div.*(class="page-header").*>([\\d\\D]*)<\\/div>/iU', $playlist[0], $title);
    }
    $TMPL['id'] = $_GET['id'];
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = strip_tags($title[2][0]);
    if (isset($_GET['edit']) && $feed->sidebarButton($_GET['id'], 2)) {
        $skin = new skin('playlist/edit');
        $rows = '';
        // Send the form
        if (isset($_POST['edit'])) {
            $TMPL['message'] = $feed->managePlaylist($_GET['id'], 1, $_POST);
        }
        // Get the current values
        list($TMPL['name'], $TMPL['description']) = $feed->managePlaylist($_GET['id'], 0);
        // Reset the page title, and the content title
        $TMPL['title'] = $title[2][0] = $TMPL['name'];
    } else {
        $skin = new skin('track/rows');
        $rows = '';
        // If the playlist id is not set, or it doesn't consist from digits
        if (!isset($_GET['id']) || !ctype_digit($_GET['id'])) {
            header("Location: " . $CONF['url']);
        }
        // If the output is empty redirect to home-page
        if (empty($playlist[0])) {
            header("Location: " . $CONF['url']);
        }
        $TMPL['messages'] = $playlist[0];
    }
    $rows = $skin->make();
    $skin = new skin('playlist/sidebar');
    $sidebar = '';
    $TMPL['ad'] = generateAd($settings['ad5']);
    // If the track can be viewed
    if (!$playlist[1]) {
        $TMPL['edit'] = $feed->sidebarButton($_GET['id'], 2);
        $TMPL['description'] = $feed->sidebarDescription($_GET['id'], 1);
        $TMPL['tags'] = $feed->sidebarKeywords($_GET['id'], 1);
    }
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $title = trim(strip_tags($title[2][0]));
    $TMPL['title'] = $title . ' - ' . $settings['title'];
    $TMPL['meta_description'] = $title . ' ' . $feed->sidebarDescription($_GET['id'], 1, 1);
    $skin = new skin('shared/content');
    return $skin->make();
}
Esempio n. 11
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->user = $verify;
            $feed->id = $verify['idu'];
            $feed->username = $verify['username'];
            $feed->per_page = $settings['perpage'];
            $feed->categories = $feed->getCategories();
            $feed->time = $settings['time'];
            $feed->c_per_page = $settings['cperpage'];
            $feed->c_start = 0;
            $feed->l_per_post = $settings['lperpost'];
            $feed->paypalapp = $settings['paypalapp'];
            $feed->online_time = $settings['conline'];
            $feed->friends_online = $settings['ronline'];
            $feed->subscriptionsList = $feed->getSubs($verify['idu'], 0);
            $feed->trackList = implode(',', $feed->getTrackList(!empty($feed->profile_id) ? $feed->profile_id : $feed->id));
            $feed->updateStatus($verify['offline']);
            // Useed in timeline javascript which checks for new messages
            $TMPL['subs'] = 1;
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('shared/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            list($timeline, $message) = $feed->stream(0, $_GET['filter']);
            $TMPL['messages'] = $timeline;
            $rows = $skin->make();
            $skin = new skin('stream/sidebar');
            $sidebar = '';
            $TMPL['upload'] = $feed->sidebarButton();
            $TMPL['go_pro'] = $feed->goProMessage(null, 1, 1);
            $TMPL['statistics'] = $feed->sidebarStatistics(null, 0);
            $TMPL['users'] = $feed->onlineUsers();
            $TMPL['friendsactivity'] = $feed->sidebarFriendsActivity(5, 1);
            if (count($feed->subscriptionsList[0]) < 3) {
                $TMPL['suggestions'] = $feed->sidebarSuggestions();
            }
            $TMPL['ad'] = generateAd($settings['ad3']);
            $sidebar = $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['rows'] = $rows;
            $TMPL['sidebar'] = $sidebar;
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $date = explode('-', wordwrap($_GET['filter'], 4, '-', true));
    $month = intval($date[1]);
    $TMPL['title'] = $LNG['stream'] . (!empty($_GET['filter']) ? ' - ' . $LNG["month_{$month}"] . ' ' . $date[0] . ' - ' : ' - ') . $settings['title'];
    // $TMPL['header'] = pageHeader($LNG['stream']);
    $skin = new skin('shared/content');
    return $skin->make();
}