Gazelle/sections/comments/index.php

68 lines
1.5 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();
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
2011-03-28 14:21:28 +00:00
$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 = '';
2013-05-01 08:00:16 +00:00
if (!empty($_REQUEST['action'])) {
2012-10-27 08:00:09 +00:00
$action = $_REQUEST['action'];
2013-05-01 08:00:16 +00:00
}
2012-10-27 08:00:09 +00:00
/**
* Getting a userid if applicable
*/
2013-05-01 08:00:16 +00:00
if (isset($_GET['id'])) {
2011-03-28 14:21:28 +00:00
$UserID = $_GET['id'];
2013-05-01 08:00:16 +00:00
if (!is_number($UserID)) {
2011-03-28 14:21:28 +00:00
error(404);
2013-05-01 08:00:16 +00:00
}
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'];
2013-05-01 08:00:16 +00:00
if ($LoggedUser['ID'] == $UserID) {
2011-03-28 14:21:28 +00:00
$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);
2013-05-30 08:00:30 +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;
}
2013-05-28 08:01:02 +00:00
list($Page, $Limit) = Format::page_limit($PerPage);
2011-03-28 14:21:28 +00:00
2013-05-01 08:00:16 +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;
2013-06-07 08:00:54 +00:00
case 'collages':
require (SERVER_ROOT.'/sections/comments/collagecomments.php');
break;
2013-03-10 08:00:41 +00:00
case 'torrents':
case 'my_torrents':
default:
require(SERVER_ROOT.'/sections/comments/torrentcomments.php');
break;
2011-03-28 14:21:28 +00:00
}