Example #1
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 ($verify['username']) {
            header("Location: " . $CONF['url'] . "/index.php?a=stream");
        }
    }
    // Start displaying the popular tracks
    $result = $db->query("SELECT `views`.`track`,`tracks`.`title`,`tracks`.`art`, COUNT(`track`) as `count` FROM `views`,`tracks` WHERE `views`.`track` = `tracks`.`id` AND DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= date(`views`.`time`) AND `art` != 'default.png' GROUP BY `track` ORDER BY `count` DESC LIMIT 10");
    while ($row = $result->fetch_assoc()) {
        $users[] = $row;
    }
    $TMPL['rows'] = welcomeTracks($users, $CONF['url']);
    $TMPL['url'] = $CONF['url'];
    if ($settings['paypalapp']) {
        $skin = new skin('welcome/gopro');
        $go_pro = '';
        $go_pro = $skin->make();
    }
    $TMPL['go_pro'] = $go_pro;
    $TMPL['title'] = $LNG['welcome'] . ' - ' . $settings['title'];
    $TMPL['meta_description'] = $settings['title'] . ' ' . $LNG['welcome_about'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('welcome/content');
    return $skin->make();
}
Example #2
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    $title = array('disclaimer' => $LNG['disclaimer'], 'developers' => $LNG['developers']);
    $skin = new skin('page/sidebar');
    $sidebar = '';
    foreach ($title as $url => $header) {
        if ($_GET['b'] == $url) {
            $TMPL['links'] .= '<div class="sidebar-link"><strong><a href="' . $CONF['url'] . '/index.php?a=page&b=' . $url . '">' . $header . '</a></strong></div>';
        } else {
            $TMPL['links'] .= '<div class="sidebar-link"><a href="' . $CONF['url'] . '/index.php?a=page&b=' . $url . '">' . $header . '</a>';
        }
    }
    $TMPL['links'] .= '<a href="' . $CONF['url'] . '/index.php?a=contactus">Contact Us</a></div>';
    $sidebar = $skin->make();
    if (!empty($_GET['b']) && isset($title[$_GET['b']])) {
        $b = $_GET['b'];
        $TMPL['sidebar'] = $sidebar;
        $TMPL['url'] = $CONF['url'];
        $TMPL['title'] = "{$title[$b]} - " . $settings['title'];
        $TMPL['header'] = '<strong>' . $title[$b] . '</strong>';
        $skin = new skin("page/{$b}");
        return $skin->make();
    } else {
        header("Location: " . $CONF['url']);
    }
}
Example #3
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    $title = array('privacy' => $LNG['privacy_policy'], 'tos' => $LNG['terms_of_use'], 'about' => $LNG['about'], 'disclaimer' => $LNG['disclaimer'], 'contact' => $LNG['contact'], 'api' => $LNG['api_documentation']);
    $skin = new skin('page/sidebar');
    $sidebar = '';
    foreach ($title as $url => $header) {
        if ($_GET['b'] == $url) {
            $TMPL['links'] .= '<div class="sidebar-link"><strong><a href="' . $CONF['url'] . '/index.php?a=page&b=' . $url . '" rel="loadpage">' . $header . '</a></strong></div>';
        } else {
            $TMPL['links'] .= '<div class="sidebar-link"><a href="' . $CONF['url'] . '/index.php?a=page&b=' . $url . '" rel="loadpage">' . $header . '</a></div>';
        }
    }
    $sidebar = $skin->make();
    if (!empty($_GET['b']) && isset($title[$_GET['b']])) {
        $b = $_GET['b'];
        $TMPL['sidebar'] = $sidebar;
        $TMPL['url'] = $CONF['url'];
        $TMPL['title'] = "{$title[$b]} - " . $settings['title'];
        $TMPL['header'] = $title[$b];
        $skin = new skin("page/{$b}");
        return $skin->make();
    } else {
        header("Location: " . $CONF['url']);
    }
}
Example #4
0
function menu($user)
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    if ($user !== false) {
        $skin = new skin('shared/menu');
        $menu = '';
        $TMPL_old = $TMPL;
        $TMPL = array();
        $TMPL['realname'] = realName($user['username'], $user['first_name'], $user['last_name']);
        $TMPL['avatar'] = $user['image'];
        $TMPL['username'] = $user['username'];
        $TMPL['url'] = $CONF['url'];
        $TMPL['theme_url'] = $CONF['theme_url'];
        $TMPL['intervaln'] = $settings['intervaln'];
        /* 
        // Array Map
        // array => { url, name, dynamic load, class type}
        */
        $links = array(array('profile&u=' . $user['username'], realName($user['username'], $user['first_name'], $user['last_name']), 1, 0), array('upload', $LNG['upload'], 1, 1), proStatus($db, $settings, $user['idu']) ? array('pro', $LNG['go_pro'], 1, 0) : '', array('stream', $LNG['stream'], 1, 2), array('explore', $LNG['explore'], 1, 2), array('stats', $LNG['statistics'], 1, 0), array('settings', $LNG['user_ttl_sidebar'], 1, 0), array('stream&logout=1', $LNG['admin_menu_logout'], 0, 0));
        foreach ($links as $element => $value) {
            if ($value) {
                $TMPL['links'] .= $divider . '<a href="' . $CONF['url'] . '/index.php?a=' . $value[0] . '" ' . ($value[2] ? ' rel="loadpage"' : '') . '><div class="menu-dd-row' . ($value[3] == 1 ? ' menu-dd-extra' : '') . ($value[3] == 2 ? ' menu-dd-mobile' : '') . '">' . $value[1] . '</div></a>';
                $divider = '<div class="menu-divider ' . ($value[3] == 2 ? ' menu-dd-mobile' : '') . '"></div>';
            }
        }
        $menu = $skin->make();
        $TMPL = $TMPL_old;
        unset($TMPL_old);
        return $menu;
    } else {
        // Else show the LogIn Register button
        return '<a onclick="connect_modal()" class="menu-btn" title="' . $LNG['connect'] . '">' . $LNG['connect'] . '</a>';
    }
}
Example #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'];
        }
    }
    $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();
}
Example #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();
        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 {
            if (isset($_POST['contact'])) {
                // Verification usage
                $con = new contact();
                $con->db = $db;
                $con->url = $CONF['url'];
                $con->phone = $_POST['phone'];
                $con->email = $_POST['email'];
                $con->address = $_POST['address'];
                $con->city = $_POST['city'];
                $con->state = $_POST['state'];
                $con->country = $_POST['country'];
                $TMPL['contactMsg'] = $con->process();
                if ($TMPL['contactMsg'] == 1) {
                    header("Location: " . $CONF['url'] . "/index.php?a=contact");
                }
            }
            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 == 1) {
                header("Location: " . $CONF['url'] . "/index.php?a=employee");
            } elseif ($status == 2) {
                header("Location: " . $CONF['url'] . "/index.php?a=feed");
            }
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Contact'] . ' - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('register/contact');
    return $skin->make();
}
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    $dir = new alumnidir();
    $dir->db = $db;
    $dir->url = $CONF['url'];
    $dir->per_page = $settings['uperpage'];
    if (isset($_POST['search'])) {
        // Verification usage
        $dir->name = $_POST['name'];
        $dir->course = $_POST['course'];
        $dir->branch = $_POST['branch'];
        $dir->tyear = $_POST['tyear'];
        //$dir->dob = $settings['captcha'];
        $searchdata = "";
        if (!empty($_POST['name'])) {
            $searchdata .= "concat_ws(' ', `first_name`, `last_name`) LIKE '%{$dir->name}%' AND ";
        }
        if (!empty($_POST['course'])) {
            $searchdata .= "`course`='{$dir->course}' AND ";
        }
        if (!empty($_POST['branch'])) {
            $searchdata .= "`branch`='{$dir->branch}' AND ";
        }
        if (!empty($_POST['tyear'])) {
            $searchdata .= "`join` LIKE '_____%{$dir->tyear}%' AND ";
        }
        if ($searchdata != "") {
            $searchdata = " WHERE " . substr($searchdata, 0, -5) . " LIMIT 0 , 10";
        } else {
            $searchdata = $searchdata . " LIMIT 0 , 10";
        }
        $dir->searchdata = $searchdata;
        $TMPL['users'] = $dir->dirgetSearch();
    } else {
        $TMPL['users'] = $dir->dirgetUsers(0);
    }
    $skin = new skin('welcome/directory');
    $page = '';
    $TMPL['jyear'] = generateDateForm(0, $join[0]);
    $TMPL['tyear'] = generateDateForm(0, $join[1]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Directory'] . ' - ' . $settings['title'];
    // Save the array returned into a list
    return $skin->make();
}
Example #8
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings, $loggedIn;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        header("Location: " . $CONF['url'] . "/index.php?a=feed");
    } else {
        if (isset($_POST['verify'])) {
            // Verification usage
            $ver = new verify();
            $ver->db = $db;
            $ver->url = $CONF['url'];
            $ver->enrollno = $_POST['enrollno'];
            $ver->name = $_POST['name'];
            $ver->fname = $_POST['fname'];
            $ver->course = $_POST['course'];
            $ver->branch = $_POST['branch'];
            $ver->join = $_POST['jyear'] . '-' . $_POST['tyear'];
            $ver->born = $_POST['day'] . '/' . $_POST['month'] . '/' . $_POST['year'];
            //$ver->dob = $settings['captcha'];
            $TMPL['verificationMsg'] = $ver->process();
            if ($TMPL['verificationMsg'] == 1) {
                header("Location: " . $CONF['url'] . "/index.php?a=verify");
            }
        }
        if (isset($_SESSION['enrollno']) || isset($_SESSION['born']) || isset($_SESSION['join']) || isset($_SESSION['course']) || isset($_SESSION['branch']) || isset($_SESSION['name'])) {
            header("Location: " . $CONF['url'] . "/index.php?a=register");
        }
    }
    $TMPL['years'] = generateDateForm(0, $date[0]);
    $TMPL['months'] = generateDateForm(1, $date[1]);
    $TMPL['days'] = generateDateForm(2, $date[2]);
    $TMPL['jyear'] = generateDateForm(0, $join[0]);
    $TMPL['tyear'] = generateDateForm(0, $join[1]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Verify'] . ' - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('register/verify');
    return $skin->make();
}
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    if (isset($_POST['contactus'])) {
        // Verification usage
        $contu = new contactus();
        $contu->db = $db;
        $contu->url = $contuF['url'];
        $contu->name = $_POST['name'];
        $contu->email = $_POST['email'];
        $contu->enrollno = $_POST['enrollno'];
        $contu->course = $_POST['course'];
        $contu->branch = $_POST['branch'];
        $contu->message = $_POST['message'];
        $contu->join = $_POST['jyear'] . '-' . $_POST['tyear'];
        $TMPL['contactusMsg'] = $contu->process();
        $mailmsg = '';
        $mailmsg .= "Name: {$this->name} \n";
        $mailmsg .= "Email: {$this->email} \n";
        $mailmsg .= "Course: {$this->course} \n";
        $mailmsg .= "Branch: {$this->branch} \n";
        $mailmsg .= "Batch: {$this->batch} \n";
        $mailmsg .= "Enroll No: {$this->enrollno} \n";
        $mailmsg .= "Message: {$this->message} \n";
        if ($TMPL['contactusMsg'] == 1) {
            sendMail($settings['email'], sprintf($LNG['ttl_admin_email'], $this->name), $mailmsg, $this->email);
            header("Location: " . $CONF['url'] . "/index.php?a=contactus");
        }
    }
    $TMPL['jyear'] = generateDateForm(0, $join[0]);
    $TMPL['tyear'] = generateDateForm(0, $join[1]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = 'Contact Us - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('welcome/contactus');
    return $skin->make();
}
Example #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();
        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();
}
Example #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->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();
}
Example #12
0
 function do_skin($filename)
 {
     $skin = new skin($filename);
     return $skin->make();
 }
Example #13
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();
}
Example #14
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();
}
Example #15
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->time = $settings['time'];
            $feed->paypalapp = $settings['paypalapp'];
            $feed->trackList = implode(',', $feed->getTrackList(!empty($feed->profile_id) ? $feed->profile_id : $feed->id));
            $feed->updateStatus($verify['offline']);
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('stats/rows');
            $rows = '';
            $TMPL['title'] = $LNG['stats_' . (empty($_GET['filter']) ? 'today' : $_GET['filter'])];
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            $stats = $feed->getUserStats($_GET['filter'], 0);
            $most = $feed->getUserStats($_GET['filter'], 1, 10);
            $TMPL['plays'] = $stats['plays'];
            $TMPL['likes'] = $stats['likes'];
            $TMPL['comments'] = $stats['comments'];
            $TMPL['downloads'] = $stats['downloads'];
            $TMPL['most_played'] = $most['plays'];
            $TMPL['most_liked'] = $most['likes'];
            $TMPL['most_commented'] = $most['comments'];
            $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'];
            $rows = $skin->make();
            $skin = new skin('stats/sidebar');
            $sidebar = '';
            $TMPL['filter'] = $feed->sidebarStatsFilters($_GET['filter']);
            $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['statistics'] . ' - ' . $settings['title'];
    $skin = new skin('stats/content');
    return $skin->make();
}
Example #16
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();
}
Example #17
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();
}
Example #18
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 ($verify['username']) {
            $TMPL_old = $TMPL;
            $TMPL = array();
            $TMPL['url'] = $CONF['url'];
            if ($_GET['b'] == 'security') {
                $skin = new skin('settings/security');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    // Unset the verified value if exist, by unsetting it here and not in the class, I'm allowing the Admin to change this value
                    unset($_POST['verified']);
                    $TMPL['message'] = $updateUserSettings->query_array('users', $_POST);
                }
                $userSettings = $updateUserSettings->getSettings();
                $page .= $skin->make();
            } elseif ($_GET['b'] == 'avatar') {
                $skin = new skin('settings/avatar');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                $TMPL['image'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['image'] . '&t=a" width="80" height="80" />';
                $TMPL['cover'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['cover'] . '&t=c&w=900&h=200" />';
                $maxsize = $settings['size'];
                if (isset($_FILES['avatarselect']['name'])) {
                    foreach ($_FILES['avatarselect']['error'] as $key => $error) {
                        $ext = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION);
                        $size = $_FILES['avatarselect']['size'][$key];
                        $extArray = explode(',', $settings['format']);
                        // Get the image size
                        list($width, $height) = getimagesize($_FILES['avatarselect']['tmp_name'][0]);
                        $ratio = $width / $height;
                        if (in_array(strtolower($ext), $extArray) && $size < $maxsize && $size > 0 && !empty($width) && !empty($height)) {
                            $rand = mt_rand();
                            $tmp_name = $_FILES['avatarselect']['tmp_name'][$key];
                            $name = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_FILENAME);
                            $fullname = $_FILES['avatarselect']['name'][$key];
                            $size = $_FILES['avatarselect']['size'][$key];
                            $type = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION);
                            $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext);
                            // Move the file into the uploaded folder
                            move_uploaded_file($tmp_name, 'uploads/avatars/' . $finalName);
                            // Send the image name in array format to the function
                            $image = array('image' => $finalName);
                            $updateUserSettings->query_array('users', $image);
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s");
                        } elseif ($_FILES['avatarselect']['name'][$key] == '') {
                            //Daca nu este selectata nici o fila.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf");
                        } elseif ($size > $maxsize || $size == 0) {
                            //Daca fila are dimensiunea mai mare decat dimensiunea admisa, sau egala cu 0.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs");
                        } else {
                            //Daca formatul filei nu este un format admis.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf");
                        }
                    }
                }
                if (isset($_FILES['coverselect']['name'])) {
                    foreach ($_FILES['coverselect']['error'] as $key => $error) {
                        $ext = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION);
                        $size = $_FILES['coverselect']['size'][$key];
                        $extArray = explode(',', $settings['format']);
                        // Get the image size
                        list($width, $height) = getimagesize($_FILES['coverselect']['tmp_name'][0]);
                        $ratio = $width / $height;
                        if (in_array(strtolower($ext), $extArray) && $size < $maxsize && $size > 0 && !empty($width) && !empty($height)) {
                            $rand = mt_rand();
                            $tmp_name = $_FILES['coverselect']['tmp_name'][$key];
                            $name = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_FILENAME);
                            $fullname = $_FILES['coverselect']['name'][$key];
                            $size = $_FILES['coverselect']['size'][$key];
                            $type = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION);
                            $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext);
                            // Move the file into the uploaded folder
                            move_uploaded_file($tmp_name, 'uploads/covers/' . $finalName);
                            // Send the image name in array format to the function
                            $image = array('cover' => $finalName);
                            $updateUserSettings->query_array('users', $image);
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s");
                        } elseif ($_FILES['coverselect']['name'][$key] == '') {
                            //Daca nu este selectata nici o fila.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf");
                        } elseif ($size > $maxsize || $size == 0) {
                            //Daca fila are dimensiunea mai mare decat dimensiunea admisa, sau egala cu 0.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs");
                        } else {
                            //Daca formatul filei nu este un format admis.
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf");
                        }
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['image_saved'], $LNG['profile_picture_saved']);
                } elseif ($_GET['m'] == 'nf') {
                    $TMPL['message'] = notificationBox('error', $LNG['error'], $LNG['no_file']);
                } elseif ($_GET['m'] == 'fs') {
                    $TMPL['message'] = notificationBox('error', $LNG['error'], sprintf($LNG['file_exceeded'], round($maxsize / 1048576, 2)));
                } elseif ($_GET['m'] == 'wf') {
                    $TMPL['message'] = notificationBox('error', $LNG['error'], sprintf($LNG['file_format'], $settings['format']));
                } elseif ($_GET['m'] == 'de') {
                    $TMPL['message'] = notificationBox('success', $LNG['image_removed'], $LNG['profile_picture_removed']);
                }
                $page .= $skin->make();
            } elseif ($_GET['b'] == 'notifications') {
                $skin = new skin('settings/notifications');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    // Unset the verified value if exist, by unsetting it here and not in the class, I'm allowing the Admin to change this value
                    unset($_POST['verified']);
                    $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                }
                $userSettings = $updateUserSettings->getSettings();
                if ($userSettings['notificationl'] == '0') {
                    $TMPL['loff'] = 'selected="selected"';
                } else {
                    $TMPL['lon'] = 'selected="selected"';
                }
                if ($userSettings['notificationc'] == '0') {
                    $TMPL['coff'] = 'selected="selected"';
                } else {
                    $TMPL['con'] = 'selected="selected"';
                }
                if ($userSettings['notifications'] == '0') {
                    $TMPL['soff'] = 'selected="selected"';
                } else {
                    $TMPL['son'] = 'selected="selected"';
                }
                if ($userSettings['notificationd'] == '0') {
                    $TMPL['doff'] = 'selected="selected"';
                } else {
                    $TMPL['don'] = 'selected="selected"';
                }
                if ($userSettings['notificationf'] == '0') {
                    $TMPL['foff'] = 'selected="selected"';
                } else {
                    $TMPL['fon'] = 'selected="selected"';
                }
                if ($userSettings['sound_new_notification'] == '0') {
                    $TMPL['snnoff'] = 'selected="selected"';
                } else {
                    $TMPL['snnon'] = 'selected="selected"';
                }
                if ($userSettings['sound_new_chat'] == '0') {
                    $TMPL['sncoff'] = 'selected="selected"';
                } else {
                    $TMPL['sncon'] = 'selected="selected"';
                }
                if ($userSettings['email_comment'] == '0') {
                    $TMPL['ecoff'] = 'selected="selected"';
                } else {
                    $TMPL['econ'] = 'selected="selected"';
                }
                if ($userSettings['email_like'] == '0') {
                    $TMPL['eloff'] = 'selected="selected"';
                } else {
                    $TMPL['elon'] = 'selected="selected"';
                }
                if ($userSettings['email_new_friend'] == '0') {
                    $TMPL['enfoff'] = 'selected="selected"';
                } else {
                    $TMPL['enfon'] = 'selected="selected"';
                }
                $page .= $skin->make();
            } else {
                $skin = new skin('settings/general');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    // Unset the verified value if exist, by unsetting it here and not in the class, I'm allowing the Admin to change this value
                    unset($_POST['verified']);
                    $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                }
                $userSettings = $updateUserSettings->getSettings();
                $date = explode('/', $userSettings['born']);
                $TMPL['years'] = generateDateForm(0, $date[2]);
                $TMPL['months'] = generateDateForm(1, $date[1]);
                $TMPL['days'] = generateDateForm(2, $date[0]);
                $TMPL['currentFirstName'] = $userSettings['first_name'];
                $TMPL['currentLastName'] = $userSettings['last_name'];
                $TMPL['currentEmail'] = $userSettings['email'];
                $TMPL['currentLocation'] = $userSettings['location'];
                $TMPL['currentWebsite'] = $userSettings['website'];
                $TMPL['currentBio'] = $userSettings['bio'];
                $TMPL['currentFacebook'] = $userSettings['facebook'];
                $TMPL['currentTwitter'] = $userSettings['twitter'];
                $TMPL['currentGplus'] = $userSettings['gplus'];
                $TMPL['currentEnrollno'] = $userSettings['enrollno'];
                $join = explode('-', $userSettings['join']);
                $TMPL['jyear'] = generateDateForm(0, $join[0]);
                $TMPL['tyear'] = generateDateForm(0, $join[1]);
                if ($userSettings['private'] == '1') {
                    $TMPL['on'] = 'selected="selected"';
                } elseif ($userSettings['private'] == '2') {
                    $TMPL['semi'] = 'selected="selected"';
                } else {
                    $TMPL['off'] = 'selected="selected"';
                }
                if ($userSettings['privacy'] == '0') {
                    $TMPL['pon'] = 'selected="selected"';
                } else {
                    $TMPL['poff'] = 'selected="selected"';
                }
                if ($userSettings['offline'] == '1') {
                    $TMPL['con'] = 'selected="selected"';
                } else {
                    $TMPL['coff'] = 'selected="selected"';
                }
                if ($userSettings['gender'] == '0') {
                    $TMPL['ngender'] = 'selected="selected"';
                } elseif ($userSettings['gender'] == '1') {
                    $TMPL['mgender'] = 'selected="selected"';
                } else {
                    $TMPL['fgender'] = 'selected="selected"';
                }
                if ($userSettings['course'] == 'btech') {
                    $TMPL['btech'] = 'selected="selected"';
                } elseif ($userSettings['course'] == 'mca') {
                    $TMPL['mca'] = 'selected="selected"';
                } elseif ($userSettings['course'] == 'mba') {
                    $TMPL['mba'] = 'selected="selected"';
                }
                if ($userSettings['branch'] == 'ece') {
                    $TMPL['ece'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'cse') {
                    $TMPL['cse'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'mae') {
                    $TMPL['mae'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'eee') {
                    $TMPL['eee'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'it') {
                    $TMPL['it'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'ce') {
                    $TMPL['ce'] = 'selected="selected"';
                } elseif ($userSettings['branch'] == 'ene') {
                    $TMPL['ene'] = 'selected="selected"';
                }
                $page .= $skin->make();
            }
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['settings'] = $page;
        } else {
            // 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 {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    // Bold the current link
    if (isset($_GET['b'])) {
        $LNG["user_menu_{$_GET['b']}"] = '<strong>' . $LNG["user_menu_{$_GET['b']}"] . '</strong>';
        $TMPL['welcome'] = '<strong>' . $LNG["user_ttl_{$_GET['b']}"] . '</strong>';
    } else {
        $LNG["user_menu_general"] = '<strong>' . $LNG["user_menu_general"] . '</strong>';
        $TMPL['welcome'] = '<strong>' . $LNG["user_ttl_general"] . '</strong>';
    }
    $TMPL['user_menu'] = '
	<a href="' . $CONF['url'] . '/index.php?a=settings">' . $LNG['user_menu_general'] . '</a> 
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=avatar">' . $LNG['user_menu_avatar'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=notifications">' . $LNG['user_menu_notifications'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=security">' . $LNG['user_menu_security'] . '</a>';
    $TMPL['image'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['image'] . '&t=a" width="80" height="80" />';
    $TMPL['title'] = $LNG['title_settings'] . ' - ' . $settings['title'];
    $skin = new skin('settings/content');
    return $skin->make();
}
Example #19
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();
}
Example #20
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 {
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->user = $verify;
            $feed->id = $verify['idu'];
            $feed->username = $verify['username'];
            $feed->time = $settings['time'];
            $feed->updateStatus($verify['offline']);
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('track/edit');
            $rows = '';
            $TMPL['url'] = $CONF['url'];
            $TMPL['page_title'] = $LNG['upload'];
            $TMPL['form_url'] = $CONF['url'] . '/requests/post_track.php';
            $feed->art_size = $settings['artsize'];
            $feed->art_format = $settings['artformat'];
            $feed->paypalapp = $settings['paypalapp'];
            $feed->track_size_total = $feed->getProStatus($feed->id, 1) ? $settings['protracktotal'] : $settings['tracksizetotal'];
            $feed->track_size = $feed->getProStatus($feed->id, 1) ? $settings['protracksize'] : $settings['tracksize'];
            $feed->track_format = $settings['trackformat'];
            $TMPL['art'] = 'default.png';
            $date = explode('-', $TMPL['release']);
            $TMPL['years'] = generateDateForm(0, $date[0]);
            $TMPL['months'] = generateDateForm(1, $date[1]);
            $TMPL['days'] = generateDateForm(2, $date[2]);
            // Se the download to off by default
            $TMPL['doff'] = ' selected="selected"';
            // Set the visiblity to public by default
            $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'] = 'inhert';
            $TMPL['onclick'] = 'startUpload()';
            $TMPL['btntext'] = $LNG['upload'];
            $rows = $skin->make();
            $skin = new skin('upload/sidebar');
            $sidebar = '';
            $TMPL['statistics'] = $feed->sidebarStatistics(null, 2);
            $TMPL['go_pro'] = $feed->goProMessage(1, 1);
            $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['upload'] . ' - ' . $settings['title'];
    $skin = new skin('upload/content');
    return $skin->make();
}
Example #21
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    // Seconds to microseconds
    $TMPL['chatr'] = $settings['chatr'] * 1000;
    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->m_per_page = $settings['mperpage'];
            $feed->l_per_post = $settings['lperpost'];
            $feed->online_time = $settings['conline'];
            $feed->sound_new_chat = $verify['sound_new_chat'];
            $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('messages/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            $TMPL['messages'] = $feed->getChat($_GET['id'], $feed->profileData($_GET['u']));
            $rows = $skin->make();
            $skin = new skin('messages/sidebar');
            $sidebar = '';
            $TMPL['users'] = $feed->onlineUsers(1, $_GET['u']);
            $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_messages'] . ' - ' . $settings['title'];
    $skin = new skin('messages/content');
    return $skin->make();
}
Example #22
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    if (isset($_POST['login'])) {
        $logInAdmin = new logInAdmin();
        $logInAdmin->db = $db;
        $logInAdmin->url = $CONF['url'];
        $logInAdmin->username = $_POST['username'];
        $logInAdmin->password = $_POST['password'];
        $TMPL['message'] = $logInAdmin->in();
    }
    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 the content to true, change the $skin to content
            $content = true;
            $TMPL_old = $TMPL;
            $TMPL = array();
            $TMPL['url'] = $CONF['url'];
            if ($_GET['b'] == 'security') {
                // Security Admin Tab
                $skin = new skin('admin/security');
                $page = '';
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('admin', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['password_changed']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['password_not_changed']);
                }
            } elseif ($_GET['b'] == 'social') {
                // Security Admin Tab
                $skin = new skin('admin/social');
                $page = '';
                if (!extension_loaded('openssl')) {
                    $TMPL['message'] .= notificationBox('error', $LNG['openssl_error']);
                }
                if (!function_exists('curl_exec')) {
                    $TMPL['message'] .= notificationBox('info', $LNG['curl_error']);
                }
                $TMPL['fbappid'] = $settings['fbappid'];
                $TMPL['fbappsecret'] = $settings['fbappsecret'];
                if (empty($settings['fbapp'])) {
                    $TMPL['fbappoff'] = ' selected="selected"';
                } else {
                    $TMPL['fbappon'] = ' selected="selected"';
                }
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=social&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=social&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] .= notificationBox('success', $LNG['settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] .= notificationBox('info', $LNG['nothing_changed']);
                }
            } elseif ($_GET['b'] == 'payments') {
                $managePayments = new managePayments();
                $managePayments->db = $db;
                $managePayments->url = $CONF['url'];
                $managePayments->per_page = $settings['rperpage'];
                if (isset($_GET['id'])) {
                    $skin = new skin('admin/payment');
                    $page = '';
                    if (isset($_GET['type'])) {
                        $managePayments->updatePayment($_GET['id'], $_GET['type']);
                    }
                    $TMPL['content'] = $managePayments->getPayment($_GET['id']);
                    // If the payment doens't exist
                    if (empty($TMPL['content'])) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=payments&m=i");
                    }
                } else {
                    $skin = new skin('admin/manage_payments');
                    $page = '';
                    $TMPL['payments'] = $managePayments->getPayments(0);
                }
                if ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('error', $LNG['payment_not_exist']);
                }
            } elseif ($_GET['b'] == 'pro') {
                // Security Admin Tab
                $skin = new skin('admin/pro');
                $page = '';
                if (!extension_loaded('openssl')) {
                    $TMPL['message'] .= notificationBox('error', $LNG['openssl_error']);
                }
                if (!function_exists('curl_exec')) {
                    $TMPL['message'] .= notificationBox('info', $LNG['curl_error']);
                }
                $TMPL['ppuser'] = $settings['paypaluser'];
                $TMPL['pppass'] = $settings['paypalpass'];
                $TMPL['ppsign'] = $settings['paypalsign'];
                $TMPL['currentProMonth'] = $settings['promonth'];
                $TMPL['currentProYear'] = $settings['proyear'];
                if (empty($settings['paypalapp'])) {
                    $TMPL['ppappoff'] = ' selected="selected"';
                } else {
                    $TMPL['ppappon'] = ' selected="selected"';
                }
                if (empty($settings['paypalsand'])) {
                    $TMPL['ppsandoff'] = ' selected="selected"';
                } else {
                    $TMPL['ppsandon'] = ' selected="selected"';
                }
                if ($settings['protracksize'] == '5242880') {
                    $TMPL['aprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '10485760') {
                    $TMPL['bprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '26214400') {
                    $TMPL['cprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '52428800') {
                    $TMPL['dprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '104857600') {
                    $TMPL['eprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '262144000') {
                    $TMPL['fprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '524288000') {
                    $TMPL['gprotrack'] = 'selected="selected"';
                } elseif ($settings['protracksize'] == '1073741824') {
                    $TMPL['hprotrack'] = 'selected="selected"';
                } else {
                    $TMPL['iprotrack'] = 'selected="selected"';
                }
                if ($settings['protracktotal'] == '104857600') {
                    $TMPL['aprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '209715200') {
                    $TMPL['bprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '314572800') {
                    $TMPL['cprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '524288000') {
                    $TMPL['dprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '1073741824') {
                    $TMPL['eprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '5368709120') {
                    $TMPL['fprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '10737418240') {
                    $TMPL['gprototal'] = 'selected="selected"';
                } elseif ($settings['protracktotal'] == '26843545600') {
                    $TMPL['hprototal'] = 'selected="selected"';
                } else {
                    $TMPL['iprototal'] = 'selected="selected"';
                }
                if ($settings['tracksize'] == '5242880') {
                    $TMPL['atrack'] = 'selected="selected"';
                } elseif ($settings['tracksize'] == '10485760') {
                    $TMPL['btrack'] = 'selected="selected"';
                } elseif ($settings['tracksize'] == '26214400') {
                    $TMPL['ctrack'] = 'selected="selected"';
                } elseif ($settings['tracksize'] == '52428800') {
                    $TMPL['dtrack'] = 'selected="selected"';
                } else {
                    $TMPL['etrack'] = 'selected="selected"';
                }
                if ($settings['currency'] == 'USD') {
                    $TMPL['usd_currency'] = 'selected="selected"';
                } elseif ($settings['currency'] == 'EUR') {
                    $TMPL['eur_currency'] = 'selected="selected"';
                } else {
                    $TMPL['gbp_currency'] = 'selected="selected"';
                }
                if ($settings['tracksizetotal'] == '104857600') {
                    $TMPL['atotal'] = 'selected="selected"';
                } elseif ($settings['tracksizetotal'] == '209715200') {
                    $TMPL['btotal'] = 'selected="selected"';
                } elseif ($settings['tracksizetotal'] == '314572800') {
                    $TMPL['ctotal'] = 'selected="selected"';
                } elseif ($settings['tracksizetotal'] == '524288000') {
                    $TMPL['dtotal'] = 'selected="selected"';
                } else {
                    $TMPL['etotal'] = 'selected="selected"';
                }
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=pro&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=pro&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] .= notificationBox('success', $LNG['settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] .= notificationBox('info', $LNG['nothing_changed']);
                }
            } elseif ($_GET['b'] == 'stats') {
                // Security Admin Tab
                $skin = new skin('admin/stats');
                $page = '';
                list($TMPL['tracks_total'], $TMPL['tracks_public'], $TMPL['tracks_private'], $TMPL['comments_total'], $TMPL['users_today'], $TMPL['users_this_month'], $TMPL['users_last_30'], $TMPL['users_total'], $TMPL['total_reports'], $TMPL['pending_reports'], $TMPL['safe_reports'], $TMPL['deleted_reports'], $TMPL['total_tracks_reports'], $TMPL['pending_track_reports'], $TMPL['safe_track_reports'], $TMPL['deleted_track_reports'], $TMPL['total_comment_reports'], $TMPL['pending_comment_reports'], $TMPL['safe_comment_reports'], $TMPL['deleted_comment_reports'], $TMPL['total_likes'], $TMPL['likes_today'], $TMPL['likes_this_month'], $TMPL['likes_last_30'], $TMPL['total_plays'], $TMPL['plays_today'], $TMPL['plays_this_month'], $TMPL['plays_last_30'], $TMPL['total_downloads'], $TMPL['downloads_today'], $TMPL['downloads_this_month'], $TMPL['downloads_last_30'], $TMPL['total_playlists'], $TMPL['playlists_today'], $TMPL['playlists_this_month'], $TMPL['playlists_last_30'], $TMPL['total_payments'], $TMPL['payments_today'], $TMPL['payments_this_month'], $TMPL['payments_last_30'], $TMPL['total_earnings'], $TMPL['earnings_today'], $TMPL['earnings_this_month'], $TMPL['earnings_last_30']) = statistics($db, $settings['currency']);
                $TMPL['currency'] = $settings['currency'];
            } elseif ($_GET['b'] == 'themes') {
                $skin = new skin('admin/themes');
                $page = '';
                $updateSettings = new updateSettings();
                $updateSettings->db = $db;
                $themes = $updateSettings->getThemes();
                $TMPL['themes_list'] = $themes[0];
                if (isset($_GET['theme'])) {
                    // If theme is in array
                    if (in_array($_GET['theme'], $themes[1])) {
                        $updated = $updateSettings->query_array('settings', array('theme' => $_GET['theme']));
                        if ($updated == 1) {
                            header("Location: " . $CONF['url'] . "/index.php?a=admin&b=themes&m=s");
                        } else {
                            header("Location: " . $CONF['url'] . "/index.php?a=admin&b=themes&m=i");
                        }
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['theme_changed']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('error', $LNG['nothing_changed']);
                }
            } elseif ($_GET['b'] == 'reports') {
                $manageReports = new manageReports();
                $manageReports->db = $db;
                $manageReports->url = $CONF['url'];
                $manageReports->title = $settings['title'];
                $manageReports->per_page = $settings['rperpage'];
                if (ctype_digit($_GET['id'])) {
                    if (isset($_GET['type'])) {
                        // Do the manage report action
                        $manageReport = $manageReports->manageReport($_GET['id'], $_GET['type']);
                    }
                    $skin = new skin('admin/report');
                    $page = '';
                    $TMPL['content'] = $manageReports->getReport($_GET['id']);
                    // If the report doesn't exist
                    if (empty($TMPL['content'])) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=reports&m=i");
                    }
                } else {
                    $skin = new skin('admin/manage_reports');
                    $page = '';
                    $TMPL['reports'] = $manageReports->getReports(0);
                }
                if ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('error', $LNG['report_not_exist']);
                }
            } elseif ($_GET['b'] == 'users_settings') {
                $skin = new skin('admin/users_settings');
                $page = '';
                if ($settings['notificationl'] == '0') {
                    $TMPL['loff'] = 'selected="selected"';
                } else {
                    $TMPL['lon'] = 'selected="selected"';
                }
                if ($settings['notificationc'] == '0') {
                    $TMPL['coff'] = 'selected="selected"';
                } else {
                    $TMPL['con'] = 'selected="selected"';
                }
                if ($settings['email_comment'] == '0') {
                    $TMPL['ecoff'] = 'selected="selected"';
                } else {
                    $TMPL['econ'] = 'selected="selected"';
                }
                if ($settings['email_like'] == '0') {
                    $TMPL['eloff'] = 'selected="selected"';
                } else {
                    $TMPL['elon'] = 'selected="selected"';
                }
                if ($settings['email_new_friend'] == '0') {
                    $TMPL['enfoff'] = 'selected="selected"';
                } else {
                    $TMPL['enfon'] = 'selected="selected"';
                }
                if ($settings['notificationd'] == '0') {
                    $TMPL['doff'] = 'selected="selected"';
                } else {
                    $TMPL['don'] = 'selected="selected"';
                }
                if ($settings['notificationf'] == '0') {
                    $TMPL['foff'] = 'selected="selected"';
                } else {
                    $TMPL['fon'] = 'selected="selected"';
                }
                if ($settings['ronline'] == '3') {
                    $TMPL['uone'] = 'selected="selected"';
                } elseif ($settings['ronline'] == '7') {
                    $TMPL['utwo'] = 'selected="selected"';
                } else {
                    $TMPL['uthree'] = 'selected="selected"';
                }
                if ($settings['nperwidget'] == '5') {
                    $TMPL['none'] = 'selected="selected"';
                } elseif ($settings['nperwidget'] == '10') {
                    $TMPL['ntwo'] = 'selected="selected"';
                } elseif ($settings['nperwidget'] == '20') {
                    $TMPL['nthree'] = 'selected="selected"';
                } else {
                    $TMPL['nfour'] = 'selected="selected"';
                }
                if ($settings['lperpost'] == '5') {
                    $TMPL['likeson'] = 'selected="selected"';
                } else {
                    $TMPL['likesoff'] = 'selected="selected"';
                }
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']);
                }
            } elseif ($_GET['b'] == 'users') {
                $manageUsers = new manageUsers();
                $manageUsers->db = $db;
                $manageUsers->url = $CONF['url'];
                $manageUsers->title = $settings['title'];
                $manageUsers->per_page = $settings['rperpage'];
                if (!isset($_GET['id']) && !isset($_GET['idu'])) {
                    $skin = new skin('admin/manage_users');
                    $page = '';
                    // Save the array returned into a list
                    $TMPL['users'] = $manageUsers->getUsers(0);
                } else {
                    $skin = new skin('admin/user');
                    $page = '';
                    $getUser = $manageUsers->getUser($_GET['id'], $_GET['idu']);
                    if (!$getUser) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=un");
                    }
                    // Create the class instance
                    $updateUserSettings = new updateUserSettings();
                    $updateUserSettings->db = $db;
                    $updateUserSettings->id = $getUser['idu'];
                    if (!empty($_POST)) {
                        $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                    }
                    $userSettings = $updateUserSettings->getSettings();
                    $TMPL['countries'] = countries(1, $userSettings['country']);
                    $TMPL['username'] = $userSettings['username'];
                    $TMPL['idu'] = $userSettings['idu'];
                    $TMPL['currentFirstName'] = $userSettings['first_name'];
                    $TMPL['currentLastName'] = $userSettings['last_name'];
                    $TMPL['currentEmail'] = $userSettings['email'];
                    $TMPL['currentCity'] = $userSettings['city'];
                    $TMPL['currentWebsite'] = $userSettings['website'];
                    $TMPL['currentDescription'] = $userSettings['description'];
                    $TMPL['currentFacebook'] = $userSettings['facebook'];
                    $TMPL['currentTwitter'] = $userSettings['twitter'];
                    $TMPL['currentGplus'] = $userSettings['gplus'];
                    $TMPL['currentYouTube'] = $userSettings['youtube'];
                    $TMPL['currentSoundCloud'] = $userSettings['soundcloud'];
                    $TMPL['currentLastfm'] = $userSettings['lastfm'];
                    $TMPL['currentMySpace'] = $userSettings['myspace'];
                    $TMPL['currentVimeo'] = $userSettings['vimeo'];
                    $TMPL['currentTumblr'] = $userSettings['tumblr'];
                    $feed = new feed();
                    $feed->db = $db;
                    $feed->id = $updateUserSettings->id;
                    $manageReports = new manageReports();
                    $manageReports->db = $db;
                    $manageReports->url = $CONF['url'];
                    $manageReports->per_page = $settings['rperpage'];
                    if (isset($_GET['suspend'])) {
                        $manageUsers->suspendUser($feed->id, $_GET['suspend']);
                    }
                    $user = $manageUsers->getUser($getUser['idu']);
                    $TMPL['username'] = '******' . $CONF['url'] . '/index.php?a=profile&u=' . $user['username'] . '" target="_blank"><img src="' . $CONF['url'] . '/thumb.php?src=' . $user['image'] . '&t=a&w=112&h=112"></a></div>
											<div class="manage-users-content"><a href="' . $CONF['url'] . '/index.php?a=profile&u=' . $user['username'] . '" target="_blank">' . $user['username'] . '</a><br>' . $user['email'] . '</div>';
                    $TMPL['reports'] = $manageReports->getReports(0, $feed->getTrackList($feed->id) ? $feed->getTrackList($feed->id) : 1);
                    if (empty($TMPL['reports'])) {
                        $TMPL['hide_r'] = ' style="display: none;"';
                    }
                    // If the user has payments history
                    $managePayments = new managePayments();
                    $managePayments->db = $db;
                    $managePayments->url = $CONF['url'];
                    $managePayments->per_page = $settings['rperpage'];
                    $TMPL['history'] = $managePayments->getPayments(0, $updateUserSettings->id);
                    if (empty($TMPL['history'])) {
                        $TMPL['hide_p'] = ' style="display: none;"';
                    }
                    // Suspend variable for the suspend url
                    $TMPL['suspend'] = $user['suspended'] ? '0' : '1';
                    $TMPL['status_desc'] = $user['suspended'] ? $LNG['restore_account'] : $LNG['suspend_account'];
                    $TMPL['status'] = $user['suspended'] ? notificationBox('error', $LNG['account_suspended']) : '';
                    if ($user['suspended']) {
                        $TMPL['suspended'] = $LNG['restore'];
                    } else {
                        $TMPL['suspended'] = $LNG['suspend'];
                    }
                }
                // If GET delete is set, delete the user
                if ($_GET['delete']) {
                    $manageUsers->deleteUser($_GET['delete']);
                    header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=" . $_GET['delete']);
                }
                if ($_GET['m'] == 'un') {
                    $TMPL['message'] = notificationBox('error', $LNG['user_not_exist']);
                } elseif (!empty($_GET['m'])) {
                    $TMPL['message'] = notificationBox('success', sprintf($LNG['user_has_been_deleted'], $_GET['m']));
                }
            } elseif ($_GET['b'] == 'categories') {
                $manageCategories = new manageCategories();
                $manageCategories->db = $db;
                $manageCategories->url = $CONF['url'];
                $skin = new skin('admin/manage_categories');
                $page = '';
                $TMPL['categories'] = $manageCategories->getCategories();
            } elseif ($_GET['b'] == 'ads') {
                $skin = new skin('admin/manage_ads');
                $page = '';
                $TMPL['ad1'] = $settings['ad1'];
                $TMPL['ad2'] = $settings['ad2'];
                $TMPL['ad3'] = $settings['ad3'];
                $TMPL['ad4'] = $settings['ad4'];
                $TMPL['ad5'] = $settings['ad5'];
                $TMPL['ad6'] = $settings['ad6'];
                $TMPL['ad7'] = $settings['ad7'];
                if (!empty($_POST)) {
                    // Unset the submit array element
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=ads&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=ads&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']);
                }
            } else {
                $skin = new skin('admin/general');
                $page = '';
                $TMPL['currentTitle'] = $settings['title'];
                $TMPL['currentFormat'] = $settings['format'];
                $TMPL['currentArtFormat'] = $settings['artformat'];
                $TMPL['currentTrackFormat'] = $settings['trackformat'];
                if ($settings['captcha'] == '1') {
                    $TMPL['on'] = 'selected="selected"';
                } else {
                    $TMPL['off'] = 'selected="selected"';
                }
                if ($settings['time'] == '0') {
                    $TMPL['one'] = 'selected="selected"';
                } elseif ($settings['time'] == '1') {
                    $TMPL['two'] = 'selected="selected"';
                } elseif ($settings['time'] == '2') {
                    $TMPL['three'] = 'selected="selected"';
                } else {
                    $TMPL['four'] = 'selected="selected"';
                }
                if ($settings['volume'] == '0.20') {
                    $TMPL['vtwenty'] = 'selected="selected"';
                } elseif ($settings['volume'] == '0.40') {
                    $TMPL['vfourty'] = 'selected="selected"';
                } elseif ($settings['volume'] == '0.60') {
                    $TMPL['vsixty'] = 'selected="selected"';
                } elseif ($settings['volume'] == '0.80') {
                    $TMPL['veighty'] = 'selected="selected"';
                } elseif ($settings['volume'] == '1') {
                    $TMPL['vhundred'] = 'selected="selected"';
                }
                if ($settings['conline'] == '60') {
                    $TMPL['conone'] = 'selected="selected"';
                } elseif ($settings['conline'] == '300') {
                    $TMPL['contwo'] = 'selected="selected"';
                } else {
                    $TMPL['conthree'] = 'selected="selected"';
                }
                if ($settings['perpage'] == '10') {
                    $TMPL['ten'] = 'selected="selected"';
                } elseif ($settings['perpage'] == '20') {
                    $TMPL['twenty'] = 'selected="selected"';
                } elseif ($settings['perpage'] == '35') {
                    $TMPL['thirtyfive'] = 'selected="selected"';
                } else {
                    $TMPL['fifty'] = 'selected="selected"';
                }
                if ($settings['nperpage'] == '10') {
                    $TMPL['nten'] = 'selected="selected"';
                } elseif ($settings['nperpage'] == '25') {
                    $TMPL['ntwentyfive'] = 'selected="selected"';
                } elseif ($settings['nperpage'] == '50') {
                    $TMPL['nfifty'] = 'selected="selected"';
                } else {
                    $TMPL['nonehundred'] = 'selected="selected"';
                }
                if ($settings['mperpage'] == '5') {
                    $TMPL['mone'] = 'selected="selected"';
                } elseif ($settings['mperpage'] == '10') {
                    $TMPL['mtwo'] = 'selected="selected"';
                } elseif ($settings['mperpage'] == '25') {
                    $TMPL['mthree'] = 'selected="selected"';
                } else {
                    $TMPL['mfour'] = 'selected="selected"';
                }
                if ($settings['mlimit'] == '500') {
                    $TMPL['cone'] = 'selected="selected"';
                } elseif ($settings['mlimit'] == '1000') {
                    $TMPL['ctwo'] = 'selected="selected"';
                } elseif ($settings['mlimit'] == '2500') {
                    $TMPL['cthree'] = 'selected="selected"';
                } else {
                    $TMPL['cfour'] = 'selected="selected"';
                }
                if ($settings['chatr'] == '1') {
                    $TMPL['crone'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '2') {
                    $TMPL['crtwo'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '3') {
                    $TMPL['crthree'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '5') {
                    $TMPL['crfive'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '10') {
                    $TMPL['crten'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '30') {
                    $TMPL['crthirty'] = 'selected="selected"';
                } else {
                    $TMPL['croff'] = 'selected="selected"';
                }
                if ($settings['qperpage'] == '10') {
                    $TMPL['qten'] = 'selected="selected"';
                } elseif ($settings['qperpage'] == '20') {
                    $TMPL['qtwenty'] = 'selected="selected"';
                } elseif ($settings['qperpage'] == '35') {
                    $TMPL['qthirtyfive'] = 'selected="selected"';
                } else {
                    $TMPL['qfifty'] = 'selected="selected"';
                }
                if ($settings['cperpage'] == '5') {
                    $TMPL['cfive'] = 'selected="selected"';
                } elseif ($settings['cperpage'] == '10') {
                    $TMPL['cten'] = 'selected="selected"';
                } elseif ($settings['cperpage'] == '25') {
                    $TMPL['ctwentyfive'] = 'selected="selected"';
                } else {
                    $TMPL['cfifty'] = 'selected="selected"';
                }
                if ($settings['size'] == '1048576') {
                    $TMPL['onemb'] = 'selected="selected"';
                } elseif ($settings['size'] == '2097152') {
                    $TMPL['twomb'] = 'selected="selected"';
                } elseif ($settings['size'] == '3145728') {
                    $TMPL['threemb'] = 'selected="selected"';
                } else {
                    $TMPL['tenmb'] = 'selected="selected"';
                }
                if ($settings['mail'] == '1') {
                    $TMPL['mailon'] = 'selected="selected"';
                } else {
                    $TMPL['mailoff'] = 'selected="selected"';
                }
                if ($settings['intervaln'] == '10000') {
                    $TMPL['intonen'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '30000') {
                    $TMPL['inttwon'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '60000') {
                    $TMPL['intthreen'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '120000') {
                    $TMPL['intfourn'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '300000') {
                    $TMPL['intfiven'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '600000') {
                    $TMPL['intsixn'] = 'selected="selected"';
                } else {
                    $TMPL['intsevenn'] = 'selected="selected"';
                }
                if ($settings['artsize'] == '1048576') {
                    $TMPL['aart'] = 'selected="selected"';
                } elseif ($settings['artsize'] == '2097152') {
                    $TMPL['bart'] = 'selected="selected"';
                } elseif ($settings['artsize'] == '3145728') {
                    $TMPL['cart'] = 'selected="selected"';
                } else {
                    $TMPL['dart'] = 'selected="selected"';
                }
                if ($settings['rperpage'] == '10') {
                    $TMPL['rpone'] = 'selected="selected"';
                } elseif ($settings['rperpage'] == '20') {
                    $TMPL['rptwo'] = 'selected="selected"';
                } elseif ($settings['rperpage'] == '50') {
                    $TMPL['rpthree'] = 'selected="selected"';
                } else {
                    $TMPL['rpfour'] = 'selected="selected"';
                }
                if ($settings['sperpage'] == '10') {
                    $TMPL['sone'] = 'selected="selected"';
                } elseif ($settings['sperpage'] == '20') {
                    $TMPL['stwo'] = 'selected="selected"';
                } elseif ($settings['sperpage'] == '35') {
                    $TMPL['sthree'] = 'selected="selected"';
                } else {
                    $TMPL['sfour'] = 'selected="selected"';
                }
                if ($settings['aperip'] == '1') {
                    $TMPL['ipone'] = 'selected="selected"';
                } elseif ($settings['aperip'] == '3') {
                    $TMPL['iptwo'] = 'selected="selected"';
                } elseif ($settings['aperip'] == '5') {
                    $TMPL['ipthree'] = 'selected="selected"';
                } elseif ($settings['aperip'] == '10') {
                    $TMPL['ipfour'] = 'selected="selected"';
                } else {
                    $TMPL['ipoff'] = 'selected="selected"';
                }
                if (isset($_POST['submit'])) {
                    // Unset the submit array element
                    unset($_POST['submit']);
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']);
                }
            }
            $page .= $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['settings'] = $page;
            if (isset($_GET['logout']) == 1) {
                $loggedInAdmin->logOut();
                header("Location: " . $CONF['url'] . "/index.php?a=admin");
            }
        } else {
            // Set the content to false, change the $skin to log-in.
            $content = false;
        }
    }
    // Bold the current link
    if (isset($_GET['b'])) {
        $LNG["admin_menu_{$_GET['b']}"] = $LNG["admin_menu_{$_GET['b']}"];
        $TMPL['welcome'] = $LNG["admin_ttl_{$_GET['b']}"];
    } else {
        $LNG["admin_menu_general"] = $LNG["admin_menu_general"];
        $TMPL['welcome'] = $LNG["admin_ttl_general"];
    }
    function adminMenuCounts($db, $type)
    {
        // Type 0: Return the reports number
        if ($type == 0) {
            $query = $db->query('SELECT COUNT(`id`) as `count` FROM `reports` WHERE `state` = 0');
        }
        $result = $query->fetch_assoc();
        return $result['count'];
    }
    $adminMenu = array('' => array('admin_menu_general', ''), '&b=users_settings' => array('admin_menu_users_settings', ''), '&b=pro' => array('admin_menu_pro', ''), '&b=social' => array('admin_menu_social', ''), '&b=themes' => array('admin_menu_themes', ''), '&b=stats' => array('admin_menu_stats', ''), '&b=security' => array('admin_menu_security', ''), '&b=users' => array('admin_menu_manage_users', ''), '&b=payments' => array('admin_menu_manage_payments', ''), '&b=reports' => array('admin_menu_manage_reports', adminMenuCounts($db, 0)), '&b=categories' => array('admin_menu_manage_categories', ''), '&b=ads' => array('admin_menu_manage_ads', ''), '&logout=1' => array('admin_menu_logout', ''));
    foreach ($adminMenu as $link => $title) {
        if ($link == '&b=' . $_GET['b'] || $link == $_GET['b']) {
            $TMPL['admin_menu'] .= '<strong>';
            $ttl = $LNG[$title[0]];
        }
        $TMPL['admin_menu'] .= '<a href="' . $CONF['url'] . '/index.php?a=admin' . $link . '" ' . ($title[0] == 'admin_menu_logout' ? '' : 'rel="loadpage"') . '>' . $LNG[$title[0]] . ' ' . ($title[1] ? '<span class="admin-notifications-number">' . $title[1] . '</span>' : '') . '</a>';
        if ($link == '&b=' . $_GET['b'] || $link == $_GET['b']) {
            $TMPL['admin_menu'] .= '</strong>';
        }
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['title_admin'] . ' - ' . ($loggedIn['username'] ? $ttl : $LNG['login']) . ' - ' . $settings['title'];
    if ($content) {
        $skin = new skin('admin/content');
    } else {
        $skin = new skin('admin/login');
    }
    return $skin->make();
}
Example #23
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings;
    if (isset($_POST['login'])) {
        $logInAdmin = new logInAdmin();
        $logInAdmin->db = $db;
        $logInAdmin->url = $CONF['url'];
        $logInAdmin->username = $_POST['username'];
        $logInAdmin->password = $_POST['password'];
        $TMPL['message'] = $logInAdmin->in();
    }
    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 the content to true, change the $skin to content
            $content = true;
            $TMPL_old = $TMPL;
            $TMPL = array();
            $TMPL['url'] = $CONF['url'];
            if ($_GET['b'] == 'security') {
                // Security Admin Tab
                $skin = new skin('admin/security');
                $page = '';
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('admin', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['password_changed'], $LNG['password_success_changed']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_changed'], $LNG['password_not_changed']);
                }
            } elseif ($_GET['b'] == 'stats') {
                // Security Admin Tab
                $skin = new skin('admin/stats');
                $page = '';
                list($TMPL['messages_total'], $TMPL['messages_public'], $TMPL['messages_private'], $TMPL['comments_total'], $TMPL['users_today'], $TMPL['users_this_month'], $TMPL['users_last_30'], $TMPL['users_total'], $TMPL['total_reports'], $TMPL['pending_reports'], $TMPL['safe_reports'], $TMPL['deleted_reports'], $TMPL['total_message_reports'], $TMPL['pending_message_reports'], $TMPL['safe_message_reports'], $TMPL['deleted_message_reports'], $TMPL['total_comment_reports'], $TMPL['pending_comment_reports'], $TMPL['safe_comment_reports'], $TMPL['deleted_comment_reports'], $TMPL['total_likes'], $TMPL['likes_today'], $TMPL['likes_this_month'], $TMPL['likes_last_30']) = users_stats($db);
            } elseif ($_GET['b'] == 'manage_reports') {
                $skin = new skin('admin/manage_reports');
                $page = '';
                $manageReports = new manageReports();
                $manageReports->db = $db;
                $manageReports->url = $CONF['url'];
                $manageReports->per_page = $settings['rperpage'];
                // Save the array returned into a list
                $TMPL['reports'] = $manageReports->getReports(0);
            } elseif ($_GET['b'] == 'users_settings') {
                $skin = new skin('admin/users_settings');
                $page = '';
                if ($settings['mprivacy'] == '1') {
                    $TMPL['pon'] = 'selected="selected"';
                } else {
                    $TMPL['poff'] = 'selected="selected"';
                }
                if ($settings['notificationl'] == '0') {
                    $TMPL['loff'] = 'selected="selected"';
                } else {
                    $TMPL['lon'] = 'selected="selected"';
                }
                if ($settings['notificationc'] == '0') {
                    $TMPL['coff'] = 'selected="selected"';
                } else {
                    $TMPL['con'] = 'selected="selected"';
                }
                if ($settings['sound_new_notification'] == '0') {
                    $TMPL['snnoff'] = 'selected="selected"';
                } else {
                    $TMPL['snnon'] = 'selected="selected"';
                }
                if ($settings['sound_new_chat'] == '0') {
                    $TMPL['sncoff'] = 'selected="selected"';
                } else {
                    $TMPL['sncon'] = 'selected="selected"';
                }
                if ($settings['email_comment'] == '0') {
                    $TMPL['ecoff'] = 'selected="selected"';
                } else {
                    $TMPL['econ'] = 'selected="selected"';
                }
                if ($settings['email_like'] == '0') {
                    $TMPL['eloff'] = 'selected="selected"';
                } else {
                    $TMPL['elon'] = 'selected="selected"';
                }
                if ($settings['email_new_friend'] == '0') {
                    $TMPL['enfoff'] = 'selected="selected"';
                } else {
                    $TMPL['enfon'] = 'selected="selected"';
                }
                if ($settings['notifications'] == '0') {
                    $TMPL['soff'] = 'selected="selected"';
                } else {
                    $TMPL['son'] = 'selected="selected"';
                }
                if ($settings['notificationd'] == '0') {
                    $TMPL['doff'] = 'selected="selected"';
                } else {
                    $TMPL['don'] = 'selected="selected"';
                }
                if ($settings['notificationf'] == '0') {
                    $TMPL['foff'] = 'selected="selected"';
                } else {
                    $TMPL['fon'] = 'selected="selected"';
                }
                if ($settings['ilimit'] == '1') {
                    $TMPL['ione'] = 'selected="selected"';
                } elseif ($settings['ilimit'] == '3') {
                    $TMPL['ithree'] = 'selected="selected"';
                } elseif ($settings['ilimit'] == '6') {
                    $TMPL['isix'] = 'selected="selected"';
                } else {
                    $TMPL['inine'] = 'selected="selected"';
                }
                if ($settings['ronline'] == '5') {
                    $TMPL['uone'] = 'selected="selected"';
                } elseif ($settings['ronline'] == '10') {
                    $TMPL['utwo'] = 'selected="selected"';
                } else {
                    $TMPL['uthree'] = 'selected="selected"';
                }
                if ($settings['nperwidget'] == '5') {
                    $TMPL['none'] = 'selected="selected"';
                } elseif ($settings['nperwidget'] == '10') {
                    $TMPL['ntwo'] = 'selected="selected"';
                } elseif ($settings['nperwidget'] == '20') {
                    $TMPL['nthree'] = 'selected="selected"';
                } else {
                    $TMPL['nfour'] = 'selected="selected"';
                }
                if ($settings['lperpost'] == '3') {
                    $TMPL['likesone'] = 'selected="selected"';
                } elseif ($settings['lperpost'] == '5') {
                    $TMPL['likestwo'] = 'selected="selected"';
                } else {
                    $TMPL['likesnone'] = 'selected="selected"';
                }
                if ($settings['verified'] == 0) {
                    $TMPL['off_v'] = 'selected="selected"';
                } else {
                    $TMPL['on_v'] = 'selected="selected"';
                }
                if (!empty($_POST)) {
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['settings_saved'], $LNG['general_settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_saved'], $LNG['general_settings_unaffected']);
                }
            } elseif ($_GET['b'] == 'users') {
                $manageUsers = new manageUsers();
                $manageUsers->db = $db;
                $manageUsers->url = $CONF['url'];
                $manageUsers->per_page = $settings['uperpage'];
                if (!isset($_GET['e'])) {
                    $skin = new skin('admin/manage_users');
                    $page = '';
                    // Save the array returned into a list
                    $TMPL['users'] = $manageUsers->getUsers(0);
                } else {
                    $skin = new skin('admin/edit_users');
                    $page = '';
                    $getUser = $manageUsers->getUser($_GET['e'], $_GET['ef']);
                    if (!$getUser) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=un");
                    }
                    // Create the class instance
                    $updateUserSettings = new updateUserSettings();
                    $updateUserSettings->db = $db;
                    $updateUserSettings->id = $getUser['idu'];
                    if (!empty($_POST)) {
                        $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                    }
                    $userSettings = $updateUserSettings->getSettings();
                    $date = explode('-', $userSettings['born']);
                    $TMPL['years'] = generateDateForm(0, $date[0]);
                    $TMPL['months'] = generateDateForm(1, $date[1]);
                    $TMPL['days'] = generateDateForm(2, $date[2]);
                    $TMPL['username'] = $userSettings['username'];
                    $TMPL['idu'] = $userSettings['idu'];
                    $TMPL['currentFirstName'] = $userSettings['first_name'];
                    $TMPL['currentLastName'] = $userSettings['last_name'];
                    $TMPL['currentEmail'] = $userSettings['email'];
                    $TMPL['currentLocation'] = $userSettings['location'];
                    $TMPL['currentWebsite'] = $userSettings['website'];
                    $TMPL['currentBio'] = $userSettings['bio'];
                    $TMPL['currentFacebook'] = $userSettings['facebook'];
                    $TMPL['currentTwitter'] = $userSettings['twitter'];
                    $TMPL['currentGplus'] = $userSettings['gplus'];
                    if ($userSettings['verified'] == 0) {
                        $TMPL['off_v'] = 'selected="selected"';
                    } else {
                        $TMPL['on_v'] = 'selected="selected"';
                    }
                }
                // If GET delete is set, delete the user
                if ($_GET['delete']) {
                    $manageUsers->deleteUser($_GET['delete']);
                    header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=" . $_GET['delete']);
                }
                if ($_GET['m'] == 'un') {
                    $TMPL['message'] = notificationBox('error', $LNG['error'], $LNG['user_not_exist']);
                } elseif (!empty($_GET['m'])) {
                    $TMPL['message'] = notificationBox('success', $LNG['user_deleted'], sprintf($LNG['user_has_been_deleted'], $_GET['m']));
                }
            } elseif ($_GET['b'] == 'manage_notices') {
                $skin = new skin('admin/manage_notices');
                $page = '';
                $TMPL['ad1'] = stripslashes($settings['ad1']);
                $TMPL['ad2'] = stripslashes($settings['ad2']);
                $TMPL['ad3'] = stripslashes($settings['ad3']);
                $TMPL['ad4'] = stripslashes($settings['ad4']);
                $TMPL['ad5'] = stripslashes($settings['ad5']);
                $TMPL['ad6'] = stripslashes($settings['ad6']);
                $TMPL['ad7'] = stripslashes($settings['ad7']);
                if (!empty($_POST)) {
                    // Unset the submit array element
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=manage_notices&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&b=manage_notices&m=i");
                    }
                }
            } else {
                $skin = new skin('admin/general');
                $page = '';
                $TMPL['currentTitle'] = $settings['title'];
                $TMPL['currentFormat'] = $settings['format'];
                $TMPL['currentCensor'] = $settings['censor'];
                $TMPL['currentFormatMsg'] = $settings['formatmsg'];
                if ($settings['captcha'] == '1') {
                    $TMPL['on'] = 'selected="selected"';
                } else {
                    $TMPL['off'] = 'selected="selected"';
                }
                if ($settings['smiles'] == '1') {
                    $TMPL['son'] = 'selected="selected"';
                } else {
                    $TMPL['soff'] = 'selected="selected"';
                }
                if ($settings['time'] == '0') {
                    $TMPL['one'] = 'selected="selected"';
                } elseif ($settings['time'] == '1') {
                    $TMPL['two'] = 'selected="selected"';
                } elseif ($settings['time'] == '2') {
                    $TMPL['three'] = 'selected="selected"';
                } else {
                    $TMPL['four'] = 'selected="selected"';
                }
                if ($settings['conline'] == '60') {
                    $TMPL['conone'] = 'selected="selected"';
                } elseif ($settings['conline'] == '300') {
                    $TMPL['contwo'] = 'selected="selected"';
                } else {
                    $TMPL['conthree'] = 'selected="selected"';
                }
                if ($settings['perpage'] == '10') {
                    $TMPL['ten'] = 'selected="selected"';
                } elseif ($settings['perpage'] == '20') {
                    $TMPL['twenty'] = 'selected="selected"';
                } elseif ($settings['perpage'] == '25') {
                    $TMPL['twentyfive'] = 'selected="selected"';
                } else {
                    $TMPL['fifty'] = 'selected="selected"';
                }
                if ($settings['nperpage'] == '10') {
                    $TMPL['nten'] = 'selected="selected"';
                } elseif ($settings['nperpage'] == '25') {
                    $TMPL['ntwentyfive'] = 'selected="selected"';
                } elseif ($settings['nperpage'] == '50') {
                    $TMPL['nfifty'] = 'selected="selected"';
                } else {
                    $TMPL['nonehundred'] = 'selected="selected"';
                }
                if ($settings['mperpage'] == '5') {
                    $TMPL['mone'] = 'selected="selected"';
                } elseif ($settings['mperpage'] == '10') {
                    $TMPL['mtwo'] = 'selected="selected"';
                } elseif ($settings['mperpage'] == '25') {
                    $TMPL['mthree'] = 'selected="selected"';
                } else {
                    $TMPL['mfour'] = 'selected="selected"';
                }
                if ($settings['climit'] == '500') {
                    $TMPL['cone'] = 'selected="selected"';
                } elseif ($settings['climit'] == '1000') {
                    $TMPL['ctwo'] = 'selected="selected"';
                } elseif ($settings['climit'] == '2500') {
                    $TMPL['cthree'] = 'selected="selected"';
                } else {
                    $TMPL['cfour'] = 'selected="selected"';
                }
                if ($settings['chatr'] == '1') {
                    $TMPL['crone'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '2') {
                    $TMPL['crtwo'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '3') {
                    $TMPL['crthree'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '5') {
                    $TMPL['crfive'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '10') {
                    $TMPL['crten'] = 'selected="selected"';
                } elseif ($settings['chatr'] == '30') {
                    $TMPL['crthirty'] = 'selected="selected"';
                } else {
                    $TMPL['croff'] = 'selected="selected"';
                }
                if ($settings['qperpage'] == '10') {
                    $TMPL['qten'] = 'selected="selected"';
                } elseif ($settings['qperpage'] == '25') {
                    $TMPL['qtwentyfive'] = 'selected="selected"';
                } elseif ($settings['qperpage'] == '50') {
                    $TMPL['qfifty'] = 'selected="selected"';
                } else {
                    $TMPL['qonehundred'] = 'selected="selected"';
                }
                if ($settings['cperpage'] == '3') {
                    $TMPL['ctrei'] = 'selected="selected"';
                } elseif ($settings['cperpage'] == '5') {
                    $TMPL['ccinci'] = 'selected="selected"';
                } elseif ($settings['cperpage'] == '10') {
                    $TMPL['czece'] = 'selected="selected"';
                } else {
                    $TMPL['ccinspe'] = 'selected="selected"';
                }
                if ($settings['message'] == '500') {
                    $TMPL['unu'] = 'selected="selected"';
                } elseif ($settings['message'] == '1000') {
                    $TMPL['doi'] = 'selected="selected"';
                } elseif ($settings['message'] == '2500') {
                    $TMPL['trei'] = 'selected="selected"';
                } else {
                    $TMPL['patru'] = 'selected="selected"';
                }
                if ($settings['size'] == '1048576') {
                    $TMPL['onemb'] = 'selected="selected"';
                } elseif ($settings['size'] == '2097152') {
                    $TMPL['twomb'] = 'selected="selected"';
                } elseif ($settings['size'] == '3145728') {
                    $TMPL['threemb'] = 'selected="selected"';
                } else {
                    $TMPL['tenmb'] = 'selected="selected"';
                }
                if ($settings['mail'] == '1') {
                    $TMPL['mailon'] = 'selected="selected"';
                } else {
                    $TMPL['mailoff'] = 'selected="selected"';
                }
                if ($settings['intervalm'] == '10000') {
                    $TMPL['intone'] = 'selected="selected"';
                } elseif ($settings['intervalm'] == '30000') {
                    $TMPL['inttwo'] = 'selected="selected"';
                } elseif ($settings['intervalm'] == '60000') {
                    $TMPL['intthree'] = 'selected="selected"';
                } elseif ($settings['intervalm'] == '120000') {
                    $TMPL['intfour'] = 'selected="selected"';
                } elseif ($settings['intervalm'] == '300000') {
                    $TMPL['intfive'] = 'selected="selected"';
                } elseif ($settings['intervalm'] == '600000') {
                    $TMPL['intsix'] = 'selected="selected"';
                } else {
                    $TMPL['intseven'] = 'selected="selected"';
                }
                if ($settings['intervaln'] == '10000') {
                    $TMPL['intonen'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '30000') {
                    $TMPL['inttwon'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '60000') {
                    $TMPL['intthreen'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '120000') {
                    $TMPL['intfourn'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '300000') {
                    $TMPL['intfiven'] = 'selected="selected"';
                } elseif ($settings['intervaln'] == '600000') {
                    $TMPL['intsixn'] = 'selected="selected"';
                } else {
                    $TMPL['intsevenn'] = 'selected="selected"';
                }
                if ($settings['sizemsg'] == '1048576') {
                    $TMPL['onembMsg'] = 'selected="selected"';
                } elseif ($settings['sizemsg'] == '2097152') {
                    $TMPL['twombMsg'] = 'selected="selected"';
                } elseif ($settings['sizemsg'] == '3145728') {
                    $TMPL['threembMsg'] = 'selected="selected"';
                } else {
                    $TMPL['tenmbMsg'] = 'selected="selected"';
                }
                if ($settings['uperpage'] == '10') {
                    $TMPL['upone'] = 'selected="selected"';
                } elseif ($settings['uperpage'] == '20') {
                    $TMPL['uptwo'] = 'selected="selected"';
                } elseif ($settings['uperpage'] == '50') {
                    $TMPL['upthree'] = 'selected="selected"';
                } else {
                    $TMPL['upfour'] = 'selected="selected"';
                }
                if ($settings['rperpage'] == '10') {
                    $TMPL['rpone'] = 'selected="selected"';
                } elseif ($settings['rperpage'] == '20') {
                    $TMPL['rptwo'] = 'selected="selected"';
                } elseif ($settings['rperpage'] == '50') {
                    $TMPL['rpthree'] = 'selected="selected"';
                } else {
                    $TMPL['rpfour'] = 'selected="selected"';
                }
                if ($settings['sperpage'] == '10') {
                    $TMPL['sone'] = 'selected="selected"';
                } elseif ($settings['sperpage'] == '20') {
                    $TMPL['stwo'] = 'selected="selected"';
                } elseif ($settings['sperpage'] == '25') {
                    $TMPL['sthree'] = 'selected="selected"';
                } else {
                    $TMPL['sfour'] = 'selected="selected"';
                }
                if (isset($_POST['submit'])) {
                    // Unset the submit array element
                    unset($_POST['submit']);
                    $updateSettings = new updateSettings();
                    $updateSettings->db = $db;
                    $updated = $updateSettings->query_array('settings', $_POST);
                    if ($updated == 1) {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&m=s");
                    } else {
                        header("Location: " . $CONF['url'] . "/index.php?a=admin&m=i");
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['settings_saved'], $LNG['general_settings_saved']);
                } elseif ($_GET['m'] == 'i') {
                    $TMPL['message'] = notificationBox('info', $LNG['nothing_saved'], $LNG['general_settings_unaffected']);
                }
            }
            $page .= $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['settings'] = $page;
            if (isset($_GET['logout']) == 1) {
                $loggedInAdmin->logOut();
                header("Location: " . $CONF['url'] . "/index.php?a=admin");
            }
        } else {
            // Set the content to false, change the $skin to log-in.
            $content = false;
        }
    }
    // Bold the current link
    if (isset($_GET['b'])) {
        $LNG["admin_menu_{$_GET['b']}"] = '<strong>' . $LNG["admin_menu_{$_GET['b']}"] . '</strong>';
        $TMPL['welcome'] = '<strong>' . $LNG["admin_ttl_{$_GET['b']}"] . '</strong>';
    } else {
        $LNG["admin_menu_general"] = '<strong>' . $LNG["admin_menu_general"] . '</strong>';
        $TMPL['welcome'] = '<strong>' . $LNG["admin_ttl_general"] . '</strong>';
    }
    $TMPL['admin_menu'] = '
	<a href="' . $CONF['url'] . '/index.php?a=admin">' . $LNG['admin_menu_general'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=users_settings">' . $LNG['admin_menu_users_settings'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=stats">' . $LNG['admin_menu_stats'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=security">' . $LNG['admin_menu_security'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=users">' . $LNG['admin_menu_users'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=manage_reports">' . $LNG['admin_menu_manage_reports'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&b=manage_notices">' . $LNG['admin_menu_manage_notices'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=admin&logout=1">' . $LNG['admin_menu_logout'] . '</a>';
    $TMPL['url'] = $CONF['url'];
    $TMPL['localurl'] = $CONF['url'];
    $TMPL['titleh'] = $settings['title'];
    $TMPL['title'] = $LNG['title_admin'] . ' - ' . $settings['title'];
    if ($content) {
        $skin = new skin('admin/content');
    } else {
        $skin = new skin('admin/login');
    }
    return $skin->make();
}
Example #24
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    unset($_POST['suspended']);
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if ($verify['username']) {
            $TMPL_old = $TMPL;
            $TMPL = array();
            $TMPL['url'] = $CONF['url'];
            if ($_GET['b'] == 'security') {
                $skin = new skin('settings/security');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    $TMPL['message'] = $updateUserSettings->query_array('users', $_POST);
                }
                $userSettings = $updateUserSettings->getSettings();
            } elseif ($_GET['b'] == 'avatar') {
                $skin = new skin('settings/avatar');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                $TMPL['image'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['image'] . '&t=a" width="80" height="80" />';
                $TMPL['cover'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['cover'] . '&t=c&w=900&h=200" />';
                $maxsize = $settings['size'];
                if (isset($_FILES['avatarselect']['name'])) {
                    foreach ($_FILES['avatarselect']['error'] as $key => $error) {
                        $ext = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION);
                        $size = $_FILES['avatarselect']['size'][$key];
                        $allowedExt = explode(',', strtolower($settings['format']));
                        // Get file type validation
                        $image = validateFile($_FILES['avatarselect']['tmp_name'][$key], $_FILES['avatarselect']['name'][$key], $allowedExt, 0);
                        if ($image['valid'] && $size < $maxsize && $size > 0 && !empty($image['width']) && !empty($image['height'])) {
                            $rand = mt_rand();
                            $tmp_name = $_FILES['avatarselect']['tmp_name'][$key];
                            $name = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_FILENAME);
                            $fullname = $_FILES['avatarselect']['name'][$key];
                            $size = $_FILES['avatarselect']['size'][$key];
                            $type = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION);
                            $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext);
                            // Fix image orientation if possible
                            imageOrientation($tmp_name);
                            // Move the file into the uploaded folder
                            move_uploaded_file($tmp_name, 'uploads/avatars/' . $finalName);
                            // Send the image name in array format to the function
                            $image = array('image' => $finalName);
                            $updateUserSettings->query_array('users', $image);
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s");
                        } elseif ($_FILES['avatarselect']['name'][$key] == '') {
                            // If no file is selected
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf");
                        } elseif ($size > $maxsize || $size == 0) {
                            // If the file size is higher than allowed or 0
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs");
                        } else {
                            // If the file format is not allowed
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf");
                        }
                    }
                }
                if (isset($_FILES['coverselect']['name'])) {
                    foreach ($_FILES['coverselect']['error'] as $key => $error) {
                        $ext = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION);
                        $size = $_FILES['coverselect']['size'][$key];
                        $allowedExt = explode(',', strtolower($settings['format']));
                        // Get file type validation
                        $image = validateFile($_FILES['coverselect']['tmp_name'][$key], $_FILES['coverselect']['name'][$key], $allowedExt, 0);
                        if ($image['valid'] && $size < $maxsize && $size > 0 && !empty($image['width']) && !empty($image['height'])) {
                            $rand = mt_rand();
                            $tmp_name = $_FILES['coverselect']['tmp_name'][$key];
                            $name = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_FILENAME);
                            $fullname = $_FILES['coverselect']['name'][$key];
                            $size = $_FILES['coverselect']['size'][$key];
                            $type = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION);
                            $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext);
                            // Fix image orientation if possible
                            imageOrientation($tmp_name);
                            // Move the file into the uploaded folder
                            move_uploaded_file($tmp_name, 'uploads/covers/' . $finalName);
                            // Send the image name in array format to the function
                            $image = array('cover' => $finalName);
                            $updateUserSettings->query_array('users', $image);
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s");
                        } elseif ($_FILES['coverselect']['name'][$key] == '') {
                            // If no file is selected
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf");
                        } elseif ($size > $maxsize || $size == 0) {
                            // If the file size is higher than allowed or 0
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs");
                        } else {
                            // If the file format is not allowed
                            header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf");
                        }
                    }
                }
                if ($_GET['m'] == 's') {
                    $TMPL['message'] = notificationBox('success', $LNG['profile_picture_saved']);
                } elseif ($_GET['m'] == 'nf') {
                    $TMPL['message'] = notificationBox('error', $LNG['no_file']);
                } elseif ($_GET['m'] == 'fs') {
                    $TMPL['message'] = notificationBox('error', sprintf($LNG['file_exceeded'], round($maxsize / 1048576, 2)));
                } elseif ($_GET['m'] == 'wf') {
                    $TMPL['message'] = notificationBox('error', sprintf($LNG['file_format'], $settings['format']));
                }
            } elseif ($_GET['b'] == 'social') {
                $skin = new skin('settings/social');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                }
                $userSettings = $updateUserSettings->getSettings();
                $TMPL['currentFacebook'] = $userSettings['facebook'];
                $TMPL['currentTwitter'] = $userSettings['twitter'];
                $TMPL['currentGplus'] = $userSettings['gplus'];
                $TMPL['currentYouTube'] = $userSettings['youtube'];
                $TMPL['currentSoundCloud'] = $userSettings['soundcloud'];
                $TMPL['currentLastfm'] = $userSettings['lastfm'];
                $TMPL['currentMySpace'] = $userSettings['myspace'];
                $TMPL['currentVimeo'] = $userSettings['vimeo'];
                $TMPL['currentTumblr'] = $userSettings['tumblr'];
            } elseif ($_GET['b'] == 'notifications') {
                $skin = new skin('settings/notifications');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                }
                $userSettings = $updateUserSettings->getSettings();
                if ($userSettings['notificationl'] == '0') {
                    $TMPL['loff'] = 'selected="selected"';
                } else {
                    $TMPL['lon'] = 'selected="selected"';
                }
                if ($userSettings['notificationc'] == '0') {
                    $TMPL['coff'] = 'selected="selected"';
                } else {
                    $TMPL['con'] = 'selected="selected"';
                }
                if ($userSettings['notificationd'] == '0') {
                    $TMPL['doff'] = 'selected="selected"';
                } else {
                    $TMPL['don'] = 'selected="selected"';
                }
                if ($userSettings['notificationf'] == '0') {
                    $TMPL['foff'] = 'selected="selected"';
                } else {
                    $TMPL['fon'] = 'selected="selected"';
                }
                if ($userSettings['email_comment'] == '0') {
                    $TMPL['ecoff'] = 'selected="selected"';
                } else {
                    $TMPL['econ'] = 'selected="selected"';
                }
                if ($userSettings['email_like'] == '0') {
                    $TMPL['eloff'] = 'selected="selected"';
                } else {
                    $TMPL['elon'] = 'selected="selected"';
                }
                if ($userSettings['email_new_friend'] == '0') {
                    $TMPL['enfoff'] = 'selected="selected"';
                } else {
                    $TMPL['enfon'] = 'selected="selected"';
                }
            } else {
                $skin = new skin('settings/general');
                $page = '';
                // Create the class instance
                $updateUserSettings = new updateUserSettings();
                $updateUserSettings->db = $db;
                $updateUserSettings->id = $verify['idu'];
                if (!empty($_POST)) {
                    $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST));
                }
                $userSettings = $updateUserSettings->getSettings();
                $TMPL['countries'] = countries(1, $userSettings['country']);
                $TMPL['currentFirstName'] = $userSettings['first_name'];
                $TMPL['currentLastName'] = $userSettings['last_name'];
                $TMPL['currentEmail'] = $userSettings['email'];
                $TMPL['currentCity'] = $userSettings['city'];
                $TMPL['currentWebsite'] = $userSettings['website'];
                $TMPL['currentDescription'] = $userSettings['description'];
                if ($userSettings['private'] == '1') {
                    $TMPL['on'] = 'selected="selected"';
                } elseif ($userSettings['private'] == '2') {
                    $TMPL['semi'] = 'selected="selected"';
                } else {
                    $TMPL['off'] = 'selected="selected"';
                }
                if ($userSettings['offline'] == '1') {
                    $TMPL['con'] = 'selected="selected"';
                } else {
                    $TMPL['coff'] = 'selected="selected"';
                }
            }
            $page .= $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['settings'] = $page;
        } else {
            // 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 {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    // Bold the current link
    if (isset($_GET['b'])) {
        $LNG["user_menu_{$_GET['b']}"] = '<strong>' . $LNG["user_menu_{$_GET['b']}"] . '</strong>';
        $TMPL['welcome'] = $LNG["user_ttl_{$_GET['b']}"];
    } else {
        $LNG["user_menu_general"] = '<strong>' . $LNG["user_menu_general"] . '</strong>';
        $TMPL['welcome'] = $LNG["user_ttl_general"];
    }
    $TMPL['user_menu'] = '
	<a href="' . $CONF['url'] . '/index.php?a=settings" rel="loadpage">' . $LNG['user_menu_general'] . '</a> 
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=avatar" rel="loadpage">' . $LNG['user_menu_avatar'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=notifications" rel="loadpage">' . $LNG['user_menu_notifications'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=social" rel="loadpage">' . $LNG['user_menu_social'] . '</a>
	<a href="' . $CONF['url'] . '/index.php?a=settings&b=security" rel="loadpage">' . $LNG['user_menu_security'] . '</a>
	' . ($settings['paypalapp'] ? '<a href="' . $CONF['url'] . '/index.php?a=pro" rel="loadpage">' . $LNG['user_menu_plan'] . '</a>' : '');
    $TMPL['title'] = $LNG['title_settings'] . ' - ' . $settings['title'];
    $skin = new skin('settings/content');
    return $skin->make();
}
Example #25
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if ($settings['captcha']) {
        $TMPL['captcha'] = '<input type="text" name="captcha" placeholder="' . $LNG['captcha'] . '" />
		<span class="welcome-captcha"><img src="' . $CONF['url'] . '/includes/captcha.php" /></span>';
    }
    if (isset($_POST['register'])) {
        // Register usage
        $reg = new register();
        $reg->db = $db;
        $reg->url = $CONF['url'];
        $reg->username = $_POST['username'];
        $reg->password = $_POST['password'];
        $reg->email = $_POST['email'];
        $reg->enrollno = $_POST['enrollno'];
        $reg->captcha = $_POST['captcha'];
        $reg->captcha_on = $settings['captcha'];
        $reg->message_privacy = $settings['mprivacy'];
        $reg->like_notification = $settings['notificationl'];
        $reg->comment_notification = $settings['notificationc'];
        $reg->shared_notification = $settings['notifications'];
        $reg->chat_notification = $settings['notificationd'];
        $reg->friend_notification = $settings['notificationf'];
        $reg->verified = $settings['verified'];
        $reg->email_like = $settings['email_like'];
        $reg->email_comment = $settings['email_comment'];
        $reg->email_new_friend = $settings['email_new_friend'];
        $reg->sound_new_notification = $settings['sound_new_notification'];
        $reg->sound_new_chat = $settings['sound_new_chat'];
        $TMPL['registerMsg'] = $reg->process();
        if ($TMPL['registerMsg'] == 1) {
            if ($settings['mail']) {
                sendMail($_POST['email'], sprintf($LNG['welcome_mail'], $settings['title']), sprintf($LNG['user_created'], $settings['title'], $_POST['username'], $_POST['password'], $CONF['url'], $settings['title']), $CONF['email']);
            }
            header("Location: " . $CONF['url'] . "/index.php?a=feed");
        }
    }
    if (isset($_POST['login'])) {
        // Log-in usage
        $log = new logIn();
        $log->db = $db;
        $log->url = $CONF['url'];
        $log->username = $_POST['username'];
        $log->password = $_POST['password'];
        $log->remember = $_POST['remember'];
        $TMPL['loginMsg'] = notificationBox('transparent', $LNG['error'], $log->in(), 1);
    }
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if ($verify['username']) {
            header("Location: " . $CONF['url'] . "/index.php?a=feed");
        }
    }
    // Start displaying the home-page users
    $result = $db->query("SELECT * FROM `users` WHERE `image` != 'default.png' ORDER BY `idu` DESC LIMIT 10 ");
    while ($row = $result->fetch_assoc()) {
        $users[] = $row;
    }
    $TMPL['rows'] = showUsers($users, $CONF['url']);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['welcome'] . ' - ' . $settings['title'];
    $TMPL['ad'] = stripslashes($settings['ad1']);
    $skin = new skin('welcome/content');
    return $skin->make();
}
Example #26
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();
}
Example #27
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 {
            if (isset($_POST['employee'])) {
                // Verification usage
                $emp = new employee();
                $emp->db = $db;
                $emp->url = $CONF['url'];
                $emp->company = $_POST['company'];
                /*						$emp->hrphone = $_POST['hrphone'];
                						$emp->hrname = $_POST['hrname'];
                						$emp->hremail = $_POST['hremail'];*/
                $emp->offaddress = $_POST['offaddress'];
                $emp->offemail = $_POST['offemail'];
                $emp->offphone = $_POST['offphone'];
                $emp->industry = $_POST['industry'];
                $emp->designation = $_POST['designation'];
                $emp->department = $_POST['department'];
                $emp->city = $_POST['city'];
                $emp->country = $_POST['country'];
                $emp->state = $_POST['state'];
                $emp->country = $_POST['country'];
                $emp->joining = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
                //$con->dob = $settings['captcha'];
                $TMPL['employeeMsg'] = $emp->process();
                if ($TMPL['employeeMsg'] == 1) {
                    header("Location: " . $CONF['url'] . "/index.php?a=employee");
                }
            }
            if (isset($_POST['noo'])) {
                $emp = new employee();
                $emp->db = $db;
                $emp->url = $CONF['url'];
                $TMPL['employeeMsg'] = $emp->noprocess();
                if ($TMPL['employeeMsg'] == 1) {
                    header("Location: " . $CONF['url'] . "/index.php?a=employee");
                }
            }
            // 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 == 2) {
                header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar");
            }
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['years'] = generateDateForm(0, $date[0]);
    $TMPL['months'] = generateDateForm(1, $date[1]);
    $TMPL['days'] = generateDateForm(2, $date[2]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Employee'] . ' - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('register/employee');
    return $skin->make();
}
Example #28
0
    $loggedIn->password = isset($_SESSION['password']) ? $_SESSION['password'] : $_COOKIE['password'];
    $verify = $loggedIn->verify();
}
if (!empty($verify['username'])) {
    $TMPL['menu'] = menu($verify);
    $TMPL['menu_buttons'] = menuButtons($verify);
    $TMPL['url_menu'] = $CONF['url'] . '/index.php?a=stream';
} else {
    $TMPL['menu'] = menu(false);
    $TMPL['menu_buttons'] = menuButtons(false);
    $TMPL['url_menu'] = $CONF['url'] . '/index.php?a=welcome';
}
$TMPL['content'] = PageMain();
if ($settings['captcha']) {
    // Captcha
    $TMPL['captcha'] = '<div class="modal-captcha"><input type="text" name="captcha" placeholder="' . $LNG['captcha'] . '"></div>
	<span class="register-captcha" id="captcha-register"><img src="' . $CONF['url'] . '/includes/captcha.php" /></span>';
}
if ($settings['fbapp']) {
    // Generate a session to prevent CSFR
    $_SESSION['state'] = md5(uniqid(rand(), TRUE));
    // Facebook Login Url
    $TMPL['fblogin'] = '******' . $settings['fbappid'] . '&redirect_uri=' . $CONF['url'] . '/requests/connect.php?facebook=true&state=' . $_SESSION['state'] . '&scope=public_profile,email" class="facebook-button">Facebook</a></div>';
}
$TMPL['url'] = $CONF['url'];
$TMPL['year'] = date('Y');
$TMPL['powered_by'] = 'Powered by <a href="" target="_blank">Practica</a>.';
$TMPL['language'] = getLanguage($CONF['url'], null, 1);
$skin = new skin('wrapper');
echo $skin->make();
mysqli_close($db);
Example #29
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();
}
Example #30
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();
}