Пример #1
0
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();
}
Пример #2
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();
}
Пример #3
0
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();
}
Пример #4
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            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();
}
Пример #5
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();
}
Пример #6
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
    }
    // Start displaying the Feed
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    $feed->user = $verify;
    $feed->id = $verify['idu'];
    $feed->username = $verify['username'];
    $feed->per_page = $settings['perpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->c_per_page = $settings['cperpage'];
    $feed->c_start = 0;
    $feed->l_per_post = $settings['lperpost'];
    $feed->paypalapp = $settings['paypalapp'];
    if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) {
        $loggedInAdmin = new loggedInAdmin();
        $loggedInAdmin->db = $db;
        $loggedInAdmin->url = $CONF['url'];
        $loggedInAdmin->username = $_SESSION['usernameAdmin'];
        $loggedInAdmin->password = $_SESSION['passwordAdmin'];
        $loggedIn = $loggedInAdmin->verify();
        if ($loggedIn['username']) {
            // Set admin level
            $feed->is_admin = 1;
        }
    }
    $TMPL_old = $TMPL;
    $TMPL = array();
    // Get the track
    $track = $feed->getTrack($_GET['id']);
    $trackInfo = $feed->getTrackInfo($_GET['id'], 0);
    // Verify the track owner for certain pages
    if (!$trackInfo[1] && ($_GET['type'] == 'stats' || $_GET['type'] == 'edit')) {
        header("Location: " . $CONF['url']);
    }
    // Match the content from the song-title class in order to set it for the title tag
    preg_match_all('/<div.*(class="song-title").*>([\\d\\D]*)<\\/div>/iU', $track[0], $title);
    if (empty($title[2][0])) {
        preg_match_all('/<div.*(class="page-header").*>([\\d\\D]*)<\\/div>/iU', $track[0], $title);
    }
    $TMPL['id'] = $_GET['id'];
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = strip_tags($title[2][0]);
    $TMPL['url_title'] = $trackInfo[0];
    // If the user can view the track, and the report is set
    if (!$track[1] && $_GET['type'] == 'report') {
        if (!$feed->id) {
            header("Location: " . $CONF['url']);
        }
        $skin = new skin('track/report');
        $rows = '';
        if (isset($_POST['copyright'])) {
            $TMPL['message'] = $feed->report($_GET['id'], 1);
        }
    } elseif (!$track[1] && $_GET['type'] == 'stats') {
        $skin = new skin('track/stats');
        $rows = '';
        $stats = $feed->getTrackStats($_GET['id'], $_GET['filter'], 0);
        $most = $feed->getTrackStats($_GET['id'], $_GET['filter'], 1, 10);
        $TMPL['plays'] = $stats['plays'];
        $TMPL['likes'] = $stats['likes'];
        $TMPL['comments'] = $stats['comments'];
        $TMPL['downloads'] = $stats['downloads'];
        $TMPL['played_most'] = $most['played'];
        $TMPL['downloaded_most'] = $most['downloaded'];
        $TMPL['top_countries'] = $most['countries'];
        $TMPL['top_cities'] = $most['cities'];
        $TMPL['go_pro'] = $most['gopro'];
    } elseif (!$track[1] && $_GET['type'] == 'likes') {
        $skin = new skin('track/likes');
        $rows = '';
        $feed->per_page = $settings['qperpage'];
        $TMPL['likes'] = $feed->getLikes(0, 2, $_GET['id']);
    } elseif (!$track[1] && $_GET['type'] == 'edit') {
        $skin = new skin('track/edit');
        $rows = '';
        $TMPL['page_title'] = $LNG['edit'] . ' -';
        $TMPL['form_url'] = $CONF['url'] . '/index.php?a=track&id=' . $_GET['id'] . '&type=edit';
        $feed->art_size = $settings['artsize'];
        $feed->art_format = $settings['artformat'];
        if (!empty($_POST['save'])) {
            $update = $feed->updateTrack($_POST, 0);
            $TMPL['message'] = $update;
        }
        $currentTrack = $feed->getTrackInfo($_GET['id'], 1);
        foreach ($currentTrack as $key => $info) {
            $TMPL[$key] = $info;
        }
        $date = explode('-', $TMPL['release']);
        $TMPL['years'] = generateDateForm(0, $date[0]);
        $TMPL['months'] = generateDateForm(1, $date[1]);
        $TMPL['days'] = generateDateForm(2, $date[2]);
        if ($TMPL['download'] == 0) {
            $TMPL['doff'] = ' selected="selected"';
        } else {
            $TMPL['don'] = ' selected="selected"';
        }
        if ($TMPL['public'] == 0) {
            $TMPL['poff'] = ' selected="selected"';
        } else {
            $TMPL['pon'] = ' selected="selected"';
        }
        if ($TMPL['license'] == 0) {
            $TMPL['ar'] = 'checked';
        } else {
            $TMPL['cc'] = 'checked';
            $license = str_split($TMPL['license']);
            $TMPL['nc'] = $license[1];
            $TMPL['nd_sa'] = $license[2];
        }
        $TMPL['display'] = 'none';
        $TMPL['btntext'] = $LNG['save'];
    } else {
        $skin = new skin('track/rows');
        $rows = '';
        // If the track id is not set, or it doesn't consist from digits
        if (!isset($_GET['id']) || !ctype_digit($_GET['id'])) {
            header("Location: " . $CONF['url']);
        }
        $TMPL['messages'] = $track[0];
        // If the output is empty redirect to home-page
        if (empty($TMPL['messages'])) {
            header("Location: " . $CONF['url']);
        }
    }
    $rows = $skin->make();
    $skin = new skin('track/sidebar');
    $sidebar = '';
    $TMPL['ad'] = generateAd($settings['ad5']);
    // If the track can be viewed
    if (!$track[1]) {
        $TMPL['edit'] = $feed->sidebarButton($_GET['id'], 1);
        if (isset($_GET['type']) && $_GET['type'] !== 'edit') {
            unset($TMPL['edit']);
        }
        if ($_GET['type'] == 'stats') {
            $TMPL['statistics'] = $feed->sidebarStatsFilters($_GET['filter']);
        } else {
            $TMPL['statistics'] = $feed->sidebarStatistics($_GET['id'], 1, $trackInfo[1]);
        }
        $TMPL['description'] = $feed->sidebarDescription($_GET['id'], 0);
        $TMPL['tags'] = $feed->sidebarKeywords($_GET['id'], 0);
        $TMPL['report'] = $feed->sidebarReport($_GET['id']);
    }
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $title = strip_tags(trim($title[2][0]));
    $TMPL['title'] = ($_GET['type'] == 'report' || $_GET['type'] == 'stats' || $_GET['type'] == 'likes' || $_GET['type'] == 'edit' ? $LNG["{$_GET['type']}"] . ' - ' : '') . $title . ' - ' . $settings['title'];
    $TMPL['meta_description'] = $title . ' ' . $feed->sidebarDescription($_GET['id'], 0, 1);
    $skin = new skin('shared/content');
    return $skin->make();
}
Пример #7
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();
}
Пример #8
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        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();
}