Gazelle/sections/comments/index.php

63 lines
1.4 KiB
PHP
Raw Normal View History

2012-10-27 08:00:09 +00:00
<?php
2011-03-28 14:21:28 +00:00
enforce_login();
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
2012-10-27 08:00:09 +00:00
require(SERVER_ROOT.'/sections/comments/post.php'); // Post formatting function.
2011-03-28 14:21:28 +00:00
2012-10-27 08:00:09 +00:00
$action = '';
if(!empty($_REQUEST['action']))
$action = $_REQUEST['action'];
/**
* Getting a userid if applicable
*/
2011-03-28 14:21:28 +00:00
if(isset($_GET['id'])) {
$UserID = $_GET['id'];
2013-02-22 08:00:24 +00:00
if(!is_number($UserID))
2011-03-28 14:21:28 +00:00
error(404);
2012-10-27 08:00:09 +00:00
2012-10-11 08:00:15 +00:00
$UserInfo = Users::user_info($UserID);
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$Username = $UserInfo['Username'];
if($LoggedUser['ID'] == $UserID) {
$Self = true;
} else {
$Self = false;
}
2012-10-11 08:00:15 +00:00
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
2011-03-28 14:21:28 +00:00
$UserClass = $Perms['Class'];
2013-02-22 08:00:24 +00:00
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
error(403);
2012-10-27 08:00:09 +00:00
} else {
2011-03-28 14:21:28 +00:00
$UserID = $LoggedUser['ID'];
$Username = $LoggedUser['Username'];
$Self = true;
}
2012-10-27 08:00:09 +00:00
/**
* Posts per page limit stuff
*/
2011-03-28 14:21:28 +00:00
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
}
2012-10-11 08:00:15 +00:00
list($Page,$Limit) = Format::page_limit($PerPage);
2011-03-28 14:21:28 +00:00
2012-10-27 08:00:09 +00:00
switch($action) {
2013-03-10 08:00:41 +00:00
case 'requests':
require (SERVER_ROOT.'/sections/comments/requestcomments.php');
break;
case 'artists':
require (SERVER_ROOT.'/sections/comments/artistcomments.php');
break;
case 'torrents':
case 'my_torrents':
default:
require(SERVER_ROOT.'/sections/comments/torrentcomments.php');
break;
2011-03-28 14:21:28 +00:00
}