Esempio n. 1
0
    /**
     * Get a user's permissions.
     *
     * @param $UserID
     * @param array|false $CustomPermissions
     *	Pass in the user's custom permissions if you already have them.
     *	Leave false if you don't have their permissions. The function will fetch them.
     * @return array Mapping of PermissionName=>bool/int
     */
    public static function get_permissions_for_user($UserID, $CustomPermissions = false)
    {
        $UserInfo = Users::user_info($UserID);
        // Fetch custom permissions if they weren't passed in.
        if ($CustomPermissions === false) {
            $QueryID = G::$DB->get_query_id();
            G::$DB->query('
				SELECT CustomPermissions
				FROM users_main
				WHERE ID = ' . (int) $UserID);
            list($CustomPermissions) = G::$DB->next_record(MYSQLI_NUM, false);
            G::$DB->set_query_id($QueryID);
        }
        if (!empty($CustomPermissions) && !is_array($CustomPermissions)) {
            $CustomPermissions = unserialize($CustomPermissions);
        }
        $Permissions = self::get_permissions($UserInfo['PermissionID']);
        // Manage 'special' inherited permissions
        $BonusPerms = array();
        $BonusCollages = 0;
        foreach ($UserInfo['ExtraClasses'] as $PermID => $Value) {
            $ClassPerms = self::get_permissions($PermID);
            $BonusCollages += $ClassPerms['Permissions']['MaxCollages'];
            unset($ClassPerms['Permissions']['MaxCollages']);
            $BonusPerms = array_merge($BonusPerms, $ClassPerms['Permissions']);
        }
        if (empty($CustomPermissions)) {
            $CustomPermissions = array();
        }
        // This is legacy donor cruft
        if ($UserInfo['Donor']) {
            $DonorPerms = self::get_permissions(DONOR);
            unset($DonorPerms['Permissions']['MaxCollages']);
        } else {
            $DonorPerms = array('Permissions' => array());
        }
        $MaxCollages = $Permissions['Permissions']['MaxCollages'] + $BonusCollages;
        if (isset($CustomPermissions['MaxCollages'])) {
            $MaxCollages += $CustomPermissions['MaxCollages'];
            unset($CustomPermissions['MaxCollages']);
        }
        $Permissions['Permissions']['MaxCollages'] = $MaxCollages;
        // Combine the permissions
        return array_merge($Permissions['Permissions'], $BonusPerms, $CustomPermissions, $DonorPerms['Permissions']);
    }
Esempio n. 2
0
<?php

if (empty($_GET['id']) || !is_number($_GET['id'])) {
    json_die("failure");
}
list($NumComments, $Page, $Thread) = Comments::load('torrents', (int) $_GET['id'], false);
//---------- Begin printing
$JsonComments = array();
foreach ($Thread as $Key => $Post) {
    list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
    list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
    $JsonComments[] = array('postId' => (int) $PostID, 'addedTime' => $AddedTime, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, 'editedUsername' => $EditedUsername, 'userinfo' => array('authorId' => (int) $AuthorID, 'authorName' => $Username, 'artist' => $Artist == 1, 'donor' => $Donor == 1, 'warned' => $Warned != '0000-00-00 00:00:00', 'avatar' => $Avatar, 'enabled' => $Enabled == 2 ? false : true, 'userTitle' => $UserTitle));
}
json_die("success", array('page' => (int) $Page, 'pages' => ceil($NumComments / TORRENT_COMMENTS_PER_PAGE), 'comments' => $JsonComments));
Esempio n. 3
0
            $Percent = $Votes[$i] / $TotalVotes;
        } else {
            $Ratio = 0;
            $Percent = 0;
        }
        $JsonPollAnswers[] = array('answer' => $Answer, 'ratio' => $Ratio, 'percent' => $Percent);
    }
    if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) {
        $JsonPoll['voted'] = True;
    } else {
        $JsonPoll['voted'] = False;
    }
    $JsonPoll['answers'] = $JsonPollAnswers;
}
//Sqeeze in stickypost
if ($ThreadInfo['StickyPostID']) {
    if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
        array_unshift($Thread, $ThreadInfo['StickyPost']);
    }
    if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread) - 1]['ID']) {
        $Thread[] = $ThreadInfo['StickyPost'];
    }
}
$JsonPosts = array();
foreach ($Thread as $Key => $Post) {
    list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime) = array_values($Post);
    list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
    $UserInfo = Users::user_info($EditedUserID);
    $JsonPosts[] = array('postId' => (int) $PostID, 'addedTime' => $AddedTime, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, 'editedUsername' => $UserInfo['Username'], 'author' => array('authorId' => (int) $AuthorID, 'authorName' => $Username, 'paranoia' => $Paranoia, 'artist' => $Artist === '1', 'donor' => $Donor === '1', 'warned' => $Warned !== '0000-00-00 00:00:00', 'avatar' => $Avatar, 'enabled' => $Enabled === '2' ? false : true, 'userTitle' => $UserTitle));
}
print json_encode(array('status' => 'success', 'response' => array('forumId' => (int) $ForumID, 'forumName' => $Forums[$ForumID]['Name'], 'threadId' => (int) $ThreadID, 'threadTitle' => display_str($ThreadInfo['Title']), 'subscribed' => in_array($ThreadID, $UserSubscriptions), 'locked' => $ThreadInfo['IsLocked'] == 1, 'sticky' => $ThreadInfo['IsSticky'] == 1, 'currentPage' => (int) $Page, 'pages' => ceil($ThreadInfo['Posts'] / $PerPage), 'poll' => empty($JsonPoll) ? null : $JsonPoll, 'posts' => $JsonPosts)));
Esempio n. 4
0
    /**
     * Render one comment
     * @param int $AuthorID
     * @param int $PostID
     * @param string $Body
     * @param string $AddedTime
     * @param int $EditedUserID
     * @param string $EditedTime
     * @param string $Link The link to the post elsewhere on the site
     * @param string $Header The header used in the post
     * @param bool $Tools Whether or not to show [Edit], [Report] etc.
     * @todo Find a better way to pass the page (artist, collages, requests, torrents) to this function than extracting it from $Link
     */
    function render_comment($AuthorID, $PostID, $Body, $AddedTime, $EditedUserID, $EditedTime, $Link, $Unread = false, $Header = '', $Tools = true)
    {
        $UserInfo = Users::user_info($AuthorID);
        $Header = '<strong>' . Users::format_username($AuthorID, true, true, true, true, false) . '</strong> ' . time_diff($AddedTime) . $Header;
        ?>
		<table class="forum_post box vertical_margin<?php 
        echo (!Users::has_avatars_enabled() ? ' noavatar' : '') . ($Unread ? ' forum_unread' : '');
        ?>
" id="post<?php 
        echo $PostID;
        ?>
">
			<colgroup>
<?php 
        if (Users::has_avatars_enabled()) {
            ?>
				<col class="col_avatar" />
<?php 
        }
        ?>
				<col class="col_post_body" />
			</colgroup>
			<tr class="colhead_dark">
				<td colspan="<?php 
        echo Users::has_avatars_enabled() ? 2 : 1;
        ?>
">
					<div style="float: left;"><a class="post_id" href="<?php 
        echo $Link;
        ?>
">#<?php 
        echo $PostID;
        ?>
</a>
						<?php 
        echo $Header;
        if ($Tools) {
            ?>
						- <a href="#quickpost" onclick="Quote('<?php 
            echo $PostID;
            ?>
','<?php 
            echo $UserInfo['Username'];
            ?>
', true);" class="brackets">Quote</a>
<?php 
            if ($AuthorID == G::$LoggedUser['ID'] || check_perms('site_moderate_forums')) {
                ?>
						- <a href="#post<?php 
                echo $PostID;
                ?>
" onclick="Edit_Form('<?php 
                echo $PostID;
                ?>
','<?php 
                echo $Key;
                ?>
');" class="brackets">Edit</a>
<?php 
            }
            if (check_perms('site_moderate_forums')) {
                ?>
						- <a href="#post<?php 
                echo $PostID;
                ?>
" onclick="Delete('<?php 
                echo $PostID;
                ?>
');" class="brackets">Delete</a>
<?php 
            }
            ?>
					</div>
					<div id="bar<?php 
            echo $PostID;
            ?>
" style="float: right;">
						<a href="reports.php?action=report&amp;type=comment&amp;id=<?php 
            echo $PostID;
            ?>
" class="brackets">Report</a>
<?php 
            if (check_perms('users_warn') && $AuthorID != G::$LoggedUser['ID'] && G::$LoggedUser['Class'] >= $UserInfo['Class']) {
                ?>
						<form class="manage_form hidden" name="user" id="warn<?php 
                echo $PostID;
                ?>
" action="comments.php" method="post">
							<input type="hidden" name="action" value="warn" />
							<input type="hidden" name="postid" value="<?php 
                echo $PostID;
                ?>
" />
						</form>
						- <a href="#" onclick="$('#warn<?php 
                echo $PostID;
                ?>
').raw().submit(); return false;" class="brackets">Warn</a>
<?php 
            }
            ?>
						&nbsp;
						<a href="#">&uarr;</a>
<?php 
        }
        ?>
					</div>
				</td>
			</tr>
			<tr>
<?php 
        if (Users::has_avatars_enabled()) {
            ?>
				<td class="avatar" valign="top">
				<?php 
            echo Users::show_avatar($UserInfo['Avatar'], $AuthorID, $UserInfo['Username'], G::$LoggedUser['DisableAvatars']);
            ?>
				</td>
<?php 
        }
        ?>
				<td class="body" valign="top">
					<div id="content<?php 
        echo $PostID;
        ?>
">
						<?php 
        echo Text::full_format($Body);
        if ($EditedUserID) {
            ?>
						<br />
						<br />
<?php 
            if (check_perms('site_admin_forums')) {
                ?>
						<a href="#content<?php 
                echo $PostID;
                ?>
" onclick="LoadEdit('<?php 
                echo substr($Link, 0, strcspn($Link, '.'));
                ?>
', <?php 
                echo $PostID;
                ?>
, 1); return false;">&laquo;</a>
<?php 
            }
            ?>
						Last edited by
						<?php 
            echo Users::format_username($EditedUserID, false, false, false);
            ?>
 <?php 
            echo time_diff($EditedTime, 2, true, true);
        }
        ?>
					</div>
				</td>
			</tr>
		</table>
<?php 
    }
Esempio n. 5
0
<?php 
        }
    }
    ?>
			</div>
			<div id="bar<?php 
    echo $PostID;
    ?>
" style="float: right;">
				<a href="reports.php?action=report&amp;type=post&amp;id=<?php 
    echo $PostID;
    ?>
" class="brackets">Report</a>
<?php 
    if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
        $AuthorInfo = Users::user_info($AuthorID);
        if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
            ?>
				<form class="manage_form hidden" name="user" id="warn<?php 
            echo $PostID;
            ?>
" action="" method="post">
					<input type="hidden" name="action" value="warn" />
					<input type="hidden" name="postid" value="<?php 
            echo $PostID;
            ?>
" />
					<input type="hidden" name="userid" value="<?php 
            echo $AuthorID;
            ?>
" />
Esempio n. 6
0
        error(403);
    }
} elseif ($ConvID = (int) $_POST['convid']) {
    // Staff (via AJAX), get current assign of conversation
    $DB->query("\n\t\tSELECT Level, AssignedToUser\n\t\tFROM staff_pm_conversations\n\t\tWHERE ID = {$ConvID}");
    list($Level, $AssignedToUser) = $DB->next_record();
    $LevelCap = 1000;
    if ($LoggedUser['EffectiveClass'] >= min($Level, $LevelCap) || $AssignedToUser == $LoggedUser['ID']) {
        // Staff member is allowed to assign conversation, assign
        list($LevelType, $NewLevel) = explode('_', db_string($_POST['assign']));
        if ($LevelType == 'class') {
            // Assign to class
            $DB->query("\n\t\t\t\tUPDATE staff_pm_conversations\n\t\t\t\tSET Status = 'Unanswered',\n\t\t\t\t\tLevel = {$NewLevel},\n\t\t\t\t\tAssignedToUser = NULL\n\t\t\t\tWHERE ID = {$ConvID}");
            $Cache->delete_value("num_staff_pms_{$LoggedUser['ID']}");
        } else {
            $UserInfo = Users::user_info($NewLevel);
            $Level = $Classes[$UserInfo['PermissionID']]['Level'];
            if (!$Level) {
                error('Assign to user not found.');
            }
            // Assign to user
            $DB->query("\n\t\t\t\tUPDATE staff_pm_conversations\n\t\t\t\tSET Status = 'Unanswered',\n\t\t\t\t\tAssignedToUser = {$NewLevel},\n\t\t\t\t\tLevel = {$Level}\n\t\t\t\tWHERE ID = {$ConvID}");
            $Cache->delete_value("num_staff_pms_{$LoggedUser['ID']}");
        }
        echo '1';
    } else {
        // Staff member is not allowed to assign conversation
        echo '-1';
    }
} else {
    // No ID
Esempio n. 7
0
    authorize();
    $DB->query("\n\t\tDELETE FROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\t\tAND SessionID != '{$SessionID}'");
    $Cache->delete_value("users_sessions_{$UserID}");
}
if (isset($_POST['session'])) {
    authorize();
    $DB->query("\n\t\tDELETE FROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\t\tAND SessionID = '" . db_string($_POST['session']) . "'");
    $Cache->delete_value("users_sessions_{$UserID}");
}
$UserSessions = $Cache->get_value('users_sessions_' . $UserID);
if (!is_array($UserSessions)) {
    $DB->query("\n\t\tSELECT\n\t\t\tSessionID,\n\t\t\tBrowser,\n\t\t\tOperatingSystem,\n\t\t\tIP,\n\t\t\tLastUpdate\n\t\tFROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\tORDER BY LastUpdate DESC");
    $UserSessions = $DB->to_array('SessionID', MYSQLI_ASSOC);
    $Cache->cache_value("users_sessions_{$UserID}", $UserSessions, 0);
}
list($UserID, $Username) = array_values(Users::user_info($UserID));
View::show_header($Username . ' &gt; Sessions');
?>
<div class="thin">
<h2><?php 
echo Users::format_username($UserID, $Username);
?>
 &gt; Sessions</h2>
	<div class="box pad">
		<p>Note: Clearing cookies can result in ghost sessions which are automatically removed after 30 days.</p>
	</div>
	<div class="box pad">
		<table cellpadding="5" cellspacing="1" border="0" class="session_table border" width="100%">
			<tr class="colhead">
				<td class="nobr"><strong>IP address</strong></td>
				<td><strong>Browser</strong></td>
Esempio n. 8
0
function user_dupes_table($UserID)
{
    global $DB, $LoggedUser;
    if (!check_perms('users_mod')) {
        error(403);
    }
    if (!is_number($UserID)) {
        error(403);
    }
    $DB->query("\n\t\tSELECT d.ID, d.Comments, SHA1(d.Comments) AS CommentHash\n\t\tFROM dupe_groups AS d\n\t\t\tJOIN users_dupes AS u ON u.GroupID = d.ID\n\t\tWHERE u.UserID = {$UserID}");
    if (list($GroupID, $Comments, $CommentHash) = $DB->next_record()) {
        $DB->query("\n\t\t\tSELECT m.ID\n\t\t\tFROM users_main AS m\n\t\t\t\tJOIN users_dupes AS d ON m.ID = d.UserID\n\t\t\tWHERE d.GroupID = {$GroupID}\n\t\t\tORDER BY m.ID ASC");
        $DupeCount = $DB->record_count();
        $Dupes = $DB->to_array();
    } else {
        $DupeCount = 0;
        $Dupes = array();
    }
    ?>
		<form class="manage_form" name="user" method="post" id="linkedform" action="">
			<input type="hidden" name="action" value="dupes" />
			<input type="hidden" name="dupeaction" value="update" />
			<input type="hidden" name="userid" value="<?php 
    echo $UserID;
    ?>
" />
			<input type="hidden" id="auth" name="auth" value="<?php 
    echo $LoggedUser['AuthKey'];
    ?>
" />
			<input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?php 
    echo $CommentHash;
    ?>
" />
			<div class="box box2" id="l_a_box">
				<div class="head">
					Linked Accounts (<?php 
    echo max($DupeCount - 1, 0);
    ?>
) <a href="#" onclick="$('.linkedaccounts').gtoggle(); return false;" class="brackets">View</a>
				</div>
				<table width="100%" class="layout hidden linkedaccounts">
					<?php 
    echo $DupeCount ? "<tr>\n" : '';
    $i = 0;
    foreach ($Dupes as $Dupe) {
        $i++;
        list($DupeID) = $Dupe;
        $DupeInfo = Users::user_info($DupeID);
        ?>
						<td align="left"><?php 
        echo Users::format_username($DupeID, true, true, true, true);
        ?>
							<a href="user.php?action=dupes&amp;dupeaction=remove&amp;auth=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;userid=<?php 
        echo $UserID;
        ?>
&amp;removeid=<?php 
        echo $DupeID;
        ?>
" onclick="return confirm('Are you sure you wish to remove <?php 
        echo $DupeInfo['Username'];
        ?>
 from this group?');" class="brackets tooltip" title="Remove linked account">X</a>
						</td>
<?php 
        if ($i == 4) {
            $i = 0;
            echo "\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n";
        }
    }
    if ($DupeCount) {
        if ($i !== 0) {
            for ($j = $i; $j < 4; $j++) {
                echo "\t\t\t\t\t\t<td>&nbsp;</td>\n";
            }
        }
        ?>
					</tr>
<?php 
    }
    ?>
					<tr>
						<td colspan="5" align="left" style="border-top: thin solid;"><strong>Comments:</strong></td>
					</tr>
					<tr>
						<td colspan="5" align="left">
							<div id="dupecomments" class="<?php 
    echo $DupeCount ? '' : 'hidden';
    ?>
"><?php 
    echo Text::full_format($Comments);
    ?>
</div>
							<div id="editdupecomments" class="<?php 
    echo $DupeCount ? 'hidden' : '';
    ?>
">
								<textarea name="dupecomments" onkeyup="resize('dupecommentsbox');" id="dupecommentsbox" cols="65" rows="5" style="width: 98%;"><?php 
    echo display_str($Comments);
    ?>
</textarea>
							</div>
							<span style="float: right;"><a href="#" onclick="$('#dupecomments').gtoggle(); $('#editdupecomments').gtoggle(); resize('dupecommentsbox'); return false;" class="brackets">Edit linked account comments</a></span>
						</td>
					</tr>
				</table>
				<div class="pad hidden linkedaccounts">
					<label for="target">Link this user with: </label>
					<input type="text" name="target" id="target" />
					<input type="submit" value="Update" id="submitlink" />
				</div>
			</div>
		</form>
<?php 
}
Esempio n. 9
0
$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = "Unknown";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo, 'tags' => $TagList);
$Torrent = $TorrentList[$TorrentID];
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
    $Torrent['Reported'] = true;
} else {
    $Torrent['Reported'] = false;
}
// Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) {
    $File = Torrents::filelist_old_format($File);
}
unset($File);
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array('id' => (int) $Torrent['ID'], 'infoHash' => $Torrent['InfoHash'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => $Torrent['Reported'], 'time' => $Torrent['Time'], 'description' => $Torrent['Description'], 'fileList' => $FileList, 'filePath' => $Torrent['FilePath'], 'userId' => (int) $Torrent['UserID'], 'username' => $Userinfo['Username']);
json_print("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));
Esempio n. 10
0
$JsonCategory = array();
$JsonForums = array();
foreach ($Forums as $Forum) {
    list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
    if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead > $LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
        continue;
    }
    $ForumDescription = display_str($ForumDescription);
    if ($CategoryID != $LastCategoryID) {
        if (!empty($JsonForums) && !empty($JsonCategory)) {
            $JsonCategory['forums'] = $JsonForums;
            $JsonCategories[] = $JsonCategory;
        }
        $LastCategoryID = $CategoryID;
        $JsonCategory = array('categoryID' => (int) $CategoryID, 'categoryName' => $ForumCats[$CategoryID]);
        $JsonForums = array();
    }
    if ((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
        $Read = 'unread';
    } else {
        $Read = 'read';
    }
    $UserInfo = Users::user_info($LastAuthorID);
    $JsonForums[] = array('forumId' => (int) $ForumID, 'forumName' => $ForumName, 'forumDescription' => $ForumDescription, 'numTopics' => (double) $NumTopics, 'numPosts' => (double) $NumPosts, 'lastPostId' => (double) $LastPostID, 'lastAuthorId' => (double) $LastAuthorID, 'lastPostAuthorName' => $UserInfo['Username'], 'lastTopicId' => (double) $LastTopicID, 'lastTime' => $LastTime, 'specificRules' => $SpecificRules, 'lastTopic' => display_str($LastTopic), 'read' => $Read == 1, 'locked' => $Locked == 1, 'sticky' => $Sticky == 1);
}
// ...And an extra one to catch the last category.
if (!empty($JsonForums) && !empty($JsonCategory)) {
    $JsonCategory['forums'] = $JsonForums;
    $JsonCategories[] = $JsonCategory;
}
print json_encode(array('status' => 'success', 'response' => array('categories' => $JsonCategories)));
Esempio n. 11
0
    $Users = $DB->to_array();
    foreach ($Users as $User) {
        $UserID = $User['uid'];
        $DB->query("\n\t\t\tSELECT UserID\n\t\t\tFROM top_snatchers\n\t\t\tWHERE UserID = '{$UserID}'");
        if ($DB->has_results()) {
            continue;
        }
        $UserInfo = Users::user_info($UserID);
        $Username = $UserInfo['Username'];
        $TimeStamp = $User['tstamp'];
        $Request = "Hi {$Username},\n\nThe user [url=" . site_url() . "user.php?id={$LoggedUser['ID']}]{$LoggedUser['Username']}[/url] has requested a re-seed for the torrent [url=" . site_url() . "torrents.php?id={$GroupID}&torrentid={$TorrentID}]{$Name}[/url], which you snatched on " . date('M d Y', $TimeStamp) . ". The torrent is now un-seeded, and we need your help to resurrect it!\n\nThe exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.\n\nThanks!";
        Misc::send_pm($UserID, 0, "Re-seed request for torrent {$Name}", $Request);
    }
    $NumUsers = count($Users);
} else {
    $UserInfo = Users::user_info($UploaderID);
    $Username = $UserInfo['Username'];
    $Request = "Hi {$Username},\n\nThe user [url=" . site_url() . "user.php?id={$LoggedUser['ID']}]{$LoggedUser['Username']}[/url] has requested a re-seed for the torrent [url=" . site_url() . "torrents.php?id={$GroupID}&torrentid={$TorrentID}]{$Name}[/url], which you uploaded on " . date('M d Y', strtotime($UploadedTime)) . ". The torrent is now un-seeded, and we need your help to resurrect it!\n\nThe exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.\n\nThanks!";
    Misc::send_pm($UploaderID, 0, "Re-seed request for torrent {$Name}", $Request);
    $NumUsers = 1;
}
View::show_header();
?>
<div class="thin">
	<div class="header">
		<h2>Successfully sent re-seed request</h2>
	</div>
	<div class="box pad thin">
		<p style="color: black;">Successfully sent re-seed request for torrent <a href="torrents.php?id=<?php 
echo $GroupID;
?>
Esempio n. 12
0
<?php

//TODO: Redo HTML
if (!check_perms('admin_manage_permissions')) {
    error(403);
}
if (!isset($_REQUEST['userid']) || !is_number($_REQUEST['userid'])) {
    error(404);
}
include SERVER_ROOT . "/classes/permissions_form.php";
list($UserID, $Username, $PermissionID) = array_values(Users::user_info($_REQUEST['userid']));
$DB->query("\n\tSELECT CustomPermissions\n\tFROM users_main\n\tWHERE ID = '{$UserID}'");
list($Customs) = $DB->next_record(MYSQLI_NUM, false);
$Defaults = Permissions::get_permissions_for_user($UserID, array());
$Delta = array();
if (isset($_POST['action'])) {
    authorize();
    foreach ($PermissionsArray as $Perm => $Explaination) {
        $Setting = isset($_POST["perm_{$Perm}"]) ? 1 : 0;
        $Default = isset($Defaults[$Perm]) ? 1 : 0;
        if ($Setting != $Default) {
            $Delta[$Perm] = $Setting;
        }
    }
    if (!is_number($_POST['maxcollages']) && !empty($_POST['maxcollages'])) {
        error("Please enter a valid number of extra personal collages");
    }
    $Delta['MaxCollages'] = $_POST['maxcollages'];
    $Cache->begin_transaction("user_info_heavy_{$UserID}");
    $Cache->update_row(false, array('CustomPermissions' => $Delta));
    $Cache->commit_transaction(0);
Esempio n. 13
0
<?php

if (!check_perms('users_mod')) {
    error(403);
}
if (isset($_GET['userid']) && is_number($_GET['userid'])) {
    $UserHeavyInfo = Users::user_heavy_info($_GET['userid']);
    if (isset($UserHeavyInfo['torrent_pass'])) {
        $TorrentPass = $UserHeavyInfo['torrent_pass'];
        $UserPeerStats = Tracker::user_peer_count($TorrentPass);
        $UserInfo = Users::user_info($_GET['userid']);
        $UserLevel = $Classes[$UserInfo['PermissionID']]['Level'];
        if (!check_paranoia('leeching+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
            $UserPeerStats[0] = false;
        }
        if (!check_paranoia('seeding+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
            $UserPeerStats[1] = false;
        }
    } else {
        $UserPeerStats = false;
    }
} else {
    $MainStats = Tracker::info();
}
View::show_header('Tracker info');
?>
<div class="thin">
	<div class="header">
		<h2>Tracker info</h2>
	</div>
	<div class="linkbox">
Esempio n. 14
0
	<table style="table-layout: fixed; width: 100%;">
		<tr class="colhead">
			<td>Username</td>
			<td>Rank</td>
			<td>Hidden</td>
			<td>Last Donated</td>
			<td>Icon Text</td>
			<td>Icon</td>
			<td>Icon Link</td>
			<td>Avatar Text</td>
			<td>Second Avatar</td>
		</tr>
<?php 
$Row = 'b';
foreach ($Users as $User) {
    $UserInfo = Users::user_info($User['UserID']);
    $Username = $UserInfo['Username'];
    ?>
		<tr class="row<?php 
    echo $Row;
    ?>
">
			<td><?php 
    echo Users::format_username($User['UserID'], false, true, true, false, false, true);
    ?>
</td>
			<td><?php 
    echo $User['Rank'];
    ?>
</td>
			<td><?php 
Esempio n. 15
0
     $DB->query("\n\t\t\tSELECT Enabled\n\t\t\tFROM users_main\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'");
     list($Enabled) = $DB->next_record();
     $Cache->cache_value('enabled_' . $LoggedUser['ID'], $Enabled, 0);
 }
 if ($Enabled == 2) {
     logout();
 }
 // Up/Down stats
 $UserStats = $Cache->get_value('user_stats_' . $LoggedUser['ID']);
 if (!is_array($UserStats)) {
     $DB->query("\n\t\t\tSELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio\n\t\t\tFROM users_main\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'");
     $UserStats = $DB->next_record(MYSQLI_ASSOC);
     $Cache->cache_value('user_stats_' . $LoggedUser['ID'], $UserStats, 3600);
 }
 // Get info such as username
 $LightInfo = Users::user_info($LoggedUser['ID']);
 $HeavyInfo = Users::user_heavy_info($LoggedUser['ID']);
 // Create LoggedUser array
 $LoggedUser = array_merge($HeavyInfo, $LightInfo, $UserStats);
 $LoggedUser['RSS_Auth'] = md5($LoggedUser['ID'] . RSS_HASH . $LoggedUser['torrent_pass']);
 // $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
 $LoggedUser['RatioWatch'] = $LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' && time() < strtotime($LoggedUser['RatioWatchEnds']) && $LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio'] > $LoggedUser['BytesUploaded'];
 // Load in the permissions
 $LoggedUser['Permissions'] = Permissions::get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']);
 $LoggedUser['Permissions']['MaxCollages'] += Donations::get_personal_collages($LoggedUser['ID']);
 // Change necessary triggers in external components
 $Cache->CanClear = check_perms('admin_clear_cache');
 // Because we <3 our staff
 if (check_perms('site_disable_ip_history')) {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
 }
Esempio n. 16
0
<?php

if (!empty($_GET['userid']) && is_number($_GET['userid'])) {
    $UserID = $_GET['userid'];
} else {
    error(0);
}
if (!check_perms('zip_downloader')) {
    error(403);
}
$User = Users::user_info($UserID);
$Perms = Permissions::get_permissions($User['PermissionID']);
$UserClass = $Perms['Class'];
list($UserID, $Username) = array_values($User);
if (empty($_GET['type'])) {
    error(0);
} else {
    switch ($_GET['type']) {
        case 'uploads':
            if (!check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
                error(403);
            }
            $SQL = "WHERE t.UserID = '{$UserID}'";
            $Month = "t.Time";
            break;
        case 'snatches':
            if (!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) {
                error(403);
            }
            $SQL = "\n\t\t\t\t\tJOIN xbt_snatched AS x ON t.ID = x.fid\n\t\t\t\tWHERE x.uid = '{$UserID}'";
            $Month = "FROM_UNIXTIME(x.tstamp)";
Esempio n. 17
0
extract(Torrents::array_group($Group[$GroupID]));
$Name = Artists::display_artists(array('1' => $Artists), false, true);
$Name .= $GroupName;
$usersToNotify = array();
$DB->query("\n\tSELECT s.uid AS id, MAX(s.tstamp) AS tstamp\n\tFROM xbt_snatched as s\n\tINNER JOIN users_main as u\n\tON s.uid = u.ID\n\tWHERE s.fid = '{$TorrentID}'\n\tAND u.Enabled = '1'\n\tGROUP BY s.uid\n       ORDER BY tstamp DESC\n\tLIMIT 100");
if ($DB->has_results()) {
    $Users = $DB->to_array();
    foreach ($Users as $User) {
        $UserID = $User['id'];
        $TimeStamp = $User['tstamp'];
        $usersToNotify[$UserID] = array("snatched", $TimeStamp);
    }
}
$usersToNotify[$UploaderID] = array("uploaded", strtotime($UploadedTime));
foreach ($usersToNotify as $UserID => $info) {
    $Username = Users::user_info($UserID)['Username'];
    list($action, $TimeStamp) = $info;
    $Request = "Hi {$Username},\n\nThe user [url=" . site_url() . "user.php?id={$LoggedUser['ID']}]{$LoggedUser['Username']}[/url] has requested a re-seed for the torrent [url=" . site_url() . "torrents.php?id={$GroupID}&torrentid={$TorrentID}]{$Name}[/url], which you " . $action . " on " . date('M d Y', $TimeStamp) . ". The torrent is now un-seeded, and we need your help to resurrect it!\n\nThe exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.\n\nThanks!";
    Misc::send_pm($UserID, 0, "Re-seed request for torrent {$Name}", $Request);
}
$NumUsers = count($usersToNotify);
View::show_header();
?>
<div class="thin">
	<div class="header">
		<h2>Successfully sent re-seed request</h2>
	</div>
	<div class="box pad thin">
		<p style="color: black;">Successfully sent re-seed request for torrent <a href="torrents.php?id=<?php 
echo $GroupID;
?>
Esempio n. 18
0
        $TimeCompare = 1267643718;
        // Requests v2 was implemented 2010-03-03 20:15:18
        $Requests = Requests::get_requests(array_keys($SphRequests));
        foreach ($Requests as $RequestID => $Request) {
            $SphRequest = $SphRequests[$RequestID];
            $Bounty = $SphRequest['bounty'] * 1024;
            // Sphinx stores bounty in kB
            $VoteCount = $SphRequest['votes'];
            if ($Request['CategoryID'] == 0) {
                $CategoryName = 'Unknown';
            } else {
                $CategoryName = $Categories[$Request['CategoryID'] - 1];
            }
            if ($Request['TorrentID'] != 0) {
                $IsFilled = true;
                $FillerInfo = Users::user_info($Request['FillerID']);
            } else {
                $IsFilled = false;
            }
            if ($CategoryName === 'Music') {
                $ArtistForm = Requests::get_artists($RequestID);
                $ArtistLink = Artists::display_artists($ArtistForm, true, true);
                $FullName = "{$ArtistLink}<a href=\"requests.php?action=view&amp;id={$RequestID}\"><span dir=\"ltr\">{$Request['Title']}</span> [{$Request['Year']}]</a>";
            } elseif ($CategoryName === 'Audiobooks' || $CategoryName === 'Comedy') {
                $FullName = "<a href=\"requests.php?action=view&amp;id={$RequestID}\"><span dir=\"ltr\">{$Request['Title']}</span> [{$Request['Year']}]</a>";
            } else {
                $FullName = "<a href=\"requests.php?action=view&amp;id={$RequestID}\" dir=\"ltr\">{$Request['Title']}</a>";
            }
            $Tags = $Request['Tags'];
            ?>
		<tr class="row<?php 
Esempio n. 19
0
    }
    $Reported = false;
    unset($ReportedTimes);
    $Reports = Torrents::get_reports($TorrentID);
    $NumReports = count($Reports);
    if ($NumReports > 0) {
        $Reported = true;
        include SERVER_ROOT . '/sections/reportsv2/array.php';
        $ReportInfo = '
		<table class="reportinfo_table">
			<tr class="colhead_dark" style="font-weight: bold;">
				<td>This torrent has ' . $NumReports . ' active ' . ($NumReports === 1 ? 'report' : 'reports') . ":</td>\n\t\t\t</tr>";
        foreach ($Reports as $Report) {
            if (check_perms('admin_reports')) {
                $ReporterID = $Report['ReporterID'];
                $Reporter = Users::user_info($ReporterID);
                $ReporterName = $Reporter['Username'];
                $ReportLinks = "<a href=\"user.php?id={$ReporterID}\">{$ReporterName}</a> <a href=\"reportsv2.php?view=report&amp;id={$Report['ID']}\">reported it</a>";
            } else {
                $ReportLinks = 'Someone reported it';
            }
            if (isset($Types[$GroupCategoryID][$Report['Type']])) {
                $ReportType = $Types[$GroupCategoryID][$Report['Type']];
            } elseif (isset($Types['master'][$Report['Type']])) {
                $ReportType = $Types['master'][$Report['Type']];
            } else {
                //There was a type but it wasn't an option!
                $ReportType = $Types['master']['other'];
            }
            $ReportInfo .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$ReportLinks} " . time_diff($Report['ReportedTime'], 2, true, true) . ' for the reason "' . $ReportType['title'] . '":
					<blockquote>' . Text::full_format($Report['UserComment']) . '</blockquote>
Esempio n. 20
0
    }
    ?>
			</ul>
		</div>
<?php 
}
?>
		<div class="box box_info box_userinfo_personal">
			<div class="head colhead_dark">Personal</div>
			<ul class="stats nobullet">
				<li>Class: <?php 
echo $ClassLevels[$Class]['Name'];
?>
</li>
<?php 
$UserInfo = Users::user_info($UserID);
if (!empty($UserInfo['ExtraClasses'])) {
    ?>
				<li>
					<ul class="stats">
<?php 
    foreach ($UserInfo['ExtraClasses'] as $PermID => $Val) {
        ?>
						<li><?php 
        echo $Classes[$PermID]['Name'];
        ?>
</li>
<?php 
    }
    ?>
					</ul>
Esempio n. 21
0
if (isset($_GET['userid']) && check_perms('users_view_invites')) {
    if (!is_number($_GET['userid'])) {
        error(403);
    }
    $UserID = $_GET['userid'];
    $Sneaky = true;
} else {
    if (!($UserCount = $Cache->get_value('stats_user_count'))) {
        $DB->query("\n\t\t\tSELECT COUNT(ID)\n\t\t\tFROM users_main\n\t\t\tWHERE Enabled = '1'");
        list($UserCount) = $DB->next_record();
        $Cache->cache_value('stats_user_count', $UserCount, 0);
    }
    $UserID = $LoggedUser['ID'];
    $Sneaky = false;
}
list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));
$DB->query("\n\tSELECT InviteKey, Email, Expires\n\tFROM invites\n\tWHERE InviterID = '{$UserID}'\n\tORDER BY Expires");
$Pending = $DB->to_array();
$OrderWays = array('username', 'email', 'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
if (empty($_GET['order'])) {
    $CurrentOrder = 'id';
    $CurrentSort = 'asc';
    $NewSort = 'desc';
} else {
    if (in_array($_GET['order'], $OrderWays)) {
        $CurrentOrder = $_GET['order'];
        if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
            $CurrentSort = $_GET['sort'];
            $NewSort = $_GET['sort'] == 'asc' ? 'desc' : 'asc';
        } else {
            error(404);
Esempio n. 22
0
        echo $LoggedUser['AuthKey'];
        ?>
" />
							<input type="submit" onclick="return resolve(<?php 
        echo $ReportID;
        ?>
, <?php 
        echo $ClaimerID == $LoggedUser['ID'] || !$ClaimerID ? 'true' : 'false';
        ?>
)" name="submit" value="Resolve" />
						</form>
					</td>
				</tr>
<?php 
    } else {
        $ResolverInfo = Users::user_info($ResolverID);
        ?>
				<tr>
					<td colspan="2">
						Resolved by <a href="users.php?id=<?php 
        echo $ResolverID;
        ?>
"><?php 
        echo $ResolverInfo['Username'];
        ?>
</a>
					</td>
				</tr>
<?php 
    }
    ?>
Esempio n. 23
0
    }
}
if ($NumResults == 0) {
    json_die("success", array('currentPage' => 1, 'pages' => 1, 'results' => array()));
} else {
    $JsonResults = array();
    $TimeCompare = 1267643718;
    // Requests v2 was implemented 2010-03-03 20:15:18
    $Requests = Requests::get_requests(array_keys($SphRequests));
    foreach ($SphRequests as $RequestID => $SphRequest) {
        $Request = $Requests[$RequestID];
        $VoteCount = $SphRequest['votes'];
        $Bounty = $SphRequest['bounty'] * 1024;
        // Sphinx stores bounty in kB
        $Requestor = Users::user_info($Request['UserID']);
        $Filler = $Request['FillerID'] ? Users::user_info($Request['FillerID']) : null;
        if ($Request['CategoryID'] == 0) {
            $CategoryName = 'Unknown';
        } else {
            $CategoryName = $Categories[$Request['CategoryID'] - 1];
        }
        $JsonArtists = array();
        if ($CategoryName == 'Music') {
            $ArtistForm = Requests::get_artists($RequestID);
            $JsonArtists = array_values($ArtistForm);
        }
        $Tags = $Request['Tags'];
        $JsonResults[] = array('requestId' => (int) $RequestID, 'requestorId' => (int) $Requestor['ID'], 'requestorName' => $Requestor['Username'], 'timeAdded' => $Request['TimeAdded'], 'lastVote' => $Request['LastVote'], 'voteCount' => (int) $VoteCount, 'bounty' => (int) $Bounty, 'categoryId' => (int) $Request['CategoryID'], 'categoryName' => $CategoryName, 'artists' => $JsonArtists, 'title' => $Request['Title'], 'year' => (int) $Request['Year'], 'image' => $Request['Image'], 'description' => $Request['Description'], 'recordLabel' => $Request['RecordLabel'], 'catalogueNumber' => $Request['CatalogueNumber'], 'releaseType' => $ReleaseTypes[$Request['ReleaseType']], 'bitrateList' => $Request['BitrateList'], 'formatList' => $Request['FormatList'], 'mediaList' => $Request['MediaList'], 'logCue' => $Request['LogCue'], 'isFilled' => $Request['TorrentID'] > 0, 'fillerId' => (int) $Request['FillerID'], 'fillerName' => $Filler ? $Filler['Username'] : '', 'torrentId' => (int) $Request['TorrentID'], 'timeFilled' => $Request['TimeFilled'] == 0 ? '' : $Request['TimeFilled']);
    }
    json_die("success", array('currentPage' => intval($Page), 'pages' => ceil($NumResults / REQUESTS_PER_PAGE), 'results' => $JsonResults));
}
Esempio n. 24
0
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Username, $ReportedTimes)
{
    function filelist($Str)
    {
        return "</td>\n<td>" . Format::get_size($Str[1]) . "</td>\n</tr>";
    }
    $LastRemasterYear = '-';
    $LastRemasterTitle = '';
    $LastRemasterRecordLabel = '';
    $LastRemasterCatalogueNumber = '';
    $EditionID = 0;
    foreach ($TorrentList as $Torrent) {
        //t.ID,	t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear,
        //t.RemasterTitle, t.RemasterRecordLabel, t.RemasterCatalogueNumber, t.Scene,
        //t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers,
        //t.Snatched, t.FreeTorrent, t.Time, t.Description, t.FileList,
        //t.FilePath, t.UserID, t.last_action, HEX(t.info_hash), (bad tags), (bad folders), (bad filenames),
        //(cassette approved), (lossy master approved), (lossy web approved), t.LastReseedRequest,
        //LogInDB, (has file), Torrents::torrent_properties()
        list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, $Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description, $FileList, $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LossywebApproved, $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched) = array_values($Torrent);
        if ($Remastered && !$RemasterYear) {
            $FirstUnknown = !isset($FirstUnknown);
        }
        $Reported = false;
        unset($ReportedTimes);
        $Reports = Torrents::get_reports($TorrentID);
        $NumReports = count($Reports);
        if ($NumReports > 0) {
            $Reported = true;
            include SERVER_ROOT . '/sections/reportsv2/array.php';
            $ReportInfo = '
		<table class="reportinfo_table">
			<tr class="colhead_dark" style="font-weight: bold;">
				<td>This torrent has ' . $NumReports . ' active ' . ($NumReports === 1 ? 'report' : 'reports') . ":</td>\n\t\t\t</tr>";
            foreach ($Reports as $Report) {
                if (check_perms('admin_reports')) {
                    $ReporterID = $Report['ReporterID'];
                    $Reporter = Users::user_info($ReporterID);
                    $ReporterName = $Reporter['Username'];
                    $ReportLinks = "<a href=\"user.php?id={$ReporterID}\">{$ReporterName}</a> <a href=\"reportsv2.php?view=report&amp;id={$Report['ID']}\">reported it</a>";
                } else {
                    $ReportLinks = 'Someone reported it';
                }
                if (isset($Types[$GroupCategoryID][$Report['Type']])) {
                    $ReportType = $Types[$GroupCategoryID][$Report['Type']];
                } elseif (isset($Types['master'][$Report['Type']])) {
                    $ReportType = $Types['master'][$Report['Type']];
                } else {
                    //There was a type but it wasn't an option!
                    $ReportType = $Types['master']['other'];
                }
                $ReportInfo .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$ReportLinks} " . time_diff($Report['ReportedTime'], 2, true, true) . ' for the reason "' . $ReportType['title'] . '":
					<blockquote>' . Text::full_format($Report['UserComment']) . '</blockquote>
				</td>
			</tr>';
            }
            $ReportInfo .= "\n\t\t</table>";
        }
        $CanEdit = check_perms('torrents_edit') || $UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki'] && !($Remastered && !$RemasterYear);
        $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid=' . $TorrentID . '" class="brackets">Regenerate</a>' : '';
        $FileTable = '
	<table class="filelist_table">
		<tr class="colhead_dark">
			<td>
				<div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div>
				<div class="filelist_path" style="float: right;">' . ($FilePath ? "/{$FilePath}/" : '') . '</div>
			</td>
			<td>
				<strong>Size</strong>
			</td>
		</tr>';
        if (substr($FileList, -3) == '}}}') {
            // Old style
            $FileListSplit = explode('|||', $FileList);
            foreach ($FileListSplit as $File) {
                $NameEnd = strrpos($File, '{{{');
                $Name = substr($File, 0, $NameEnd);
                if ($Spaces = strspn($Name, ' ')) {
                    $Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
                }
                $FileSize = substr($File, $NameEnd + 3, -3);
                $FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $Name, Format::get_size($FileSize));
            }
        } else {
            $FileListSplit = explode("\n", $FileList);
            foreach ($FileListSplit as $File) {
                $FileInfo = Torrents::filelist_get_file($File);
                $FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
            }
        }
        $FileTable .= '
	</table>';
        $ExtraInfo = '';
        // String that contains information on the torrent (e.g. format and encoding)
        $AddExtra = '';
        // Separator between torrent properties
        $TorrentUploader = $Username;
        // Save this for "Uploaded by:" below
        // similar to Torrents::torrent_info()
        if ($Format) {
            $ExtraInfo .= display_str($Format);
            $AddExtra = ' / ';
        }
        if ($Encoding) {
            $ExtraInfo .= $AddExtra . display_str($Encoding);
            $AddExtra = ' / ';
        }
        if ($HasLog) {
            $ExtraInfo .= "{$AddExtra}Log";
            $AddExtra = ' / ';
        }
        if ($HasLog && $LogInDB) {
            $ExtraInfo .= ' (' . (int) $LogScore . '%)';
        }
        if ($HasCue) {
            $ExtraInfo .= "{$AddExtra}Cue";
            $AddExtra = ' / ';
        }
        if ($Scene) {
            $ExtraInfo .= "{$AddExtra}Scene";
            $AddExtra = ' / ';
        }
        if (!$ExtraInfo) {
            $ExtraInfo = $GroupName;
            $AddExtra = ' / ';
        }
        if ($IsSnatched) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Snatched!');
            $AddExtra = ' / ';
        }
        if ($FreeTorrent == '1') {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Freeleech!');
            $AddExtra = ' / ';
        }
        if ($FreeTorrent == '2') {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Neutral Leech!');
            $AddExtra = ' / ';
        }
        if ($PersonalFL) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Personal Freeleech!');
            $AddExtra = ' / ';
        }
        if ($Reported) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Reported');
            $AddExtra = ' / ';
        }
        if (!empty($BadTags)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Tags');
            $AddExtra = ' / ';
        }
        if (!empty($BadFolders)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Folders');
            $AddExtra = ' / ';
        }
        if (!empty($CassetteApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Cassette Approved');
            $AddExtra = ' / ';
        }
        if (!empty($LossymasterApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Lossy Master Approved');
            $AddExtra = ' / ';
        }
        if (!empty($LossywebApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Lossy WEB Approved');
            $AddExtra = ' / ';
        }
        if (!empty($BadFiles)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Bad File Names');
            $AddExtra = ' / ';
        }
        if ($GroupCategoryID == 1 && ($RemasterTitle != $LastRemasterTitle || $RemasterYear != $LastRemasterYear || $RemasterRecordLabel != $LastRemasterRecordLabel || $RemasterCatalogueNumber != $LastRemasterCatalogueNumber || $FirstUnknown || $Media != $LastMedia)) {
            $EditionID++;
            ?>
				<tr class="releases_<?php 
            echo $ReleaseType;
            ?>
 groupid_<?php 
            echo $GroupID;
            ?>
 edition group_torrent">
					<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?php 
            echo $GroupID;
            ?>
, <?php 
            echo $EditionID;
            ?>
, this, event);" class="tooltip" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?php 
            echo Torrents::edition_string($Torrent, $TorrentDetails);
            ?>
</strong></td>
				</tr>
<?php 
        }
        $LastRemasterTitle = $RemasterTitle;
        $LastRemasterYear = $RemasterYear;
        $LastRemasterRecordLabel = $RemasterRecordLabel;
        $LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
        $LastMedia = $Media;
        ?>
				<tr class="torrent_row releases_<?php 
        echo $ReleaseType;
        ?>
 groupid_<?php 
        echo $GroupID;
        ?>
 edition_<?php 
        echo $EditionID;
        ?>
 group_torrent<?php 
        echo $IsSnatched ? ' snatched_torrent' : '';
        ?>
" style="font-weight: normal;" id="torrent<?php 
        echo $TorrentID;
        ?>
">
					<td>
						<span>[ <a href="torrents.php?action=download&amp;id=<?php 
        echo $TorrentID;
        ?>
&amp;authkey=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;torrent_pass=<?php 
        echo $LoggedUser['torrent_pass'];
        ?>
" class="tooltip" title="Download"><?php 
        echo $HasFile ? 'DL' : 'Missing';
        ?>
</a>
<?php 
        if (Torrents::can_use_token($Torrent)) {
            ?>
							| <a href="torrents.php?action=download&amp;id=<?php 
            echo $TorrentID;
            ?>
&amp;authkey=<?php 
            echo $LoggedUser['AuthKey'];
            ?>
&amp;torrent_pass=<?php 
            echo $LoggedUser['torrent_pass'];
            ?>
&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<?php 
        }
        ?>
							| <a href="reportsv2.php?action=report&amp;id=<?php 
        echo $TorrentID;
        ?>
" class="tooltip" title="Report">RP</a>
<?php 
        if ($CanEdit) {
            ?>
							| <a href="torrents.php?action=edit&amp;id=<?php 
            echo $TorrentID;
            ?>
" class="tooltip" title="Edit">ED</a>
<?php 
        }
        if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) {
            ?>
							| <a href="torrents.php?action=delete&amp;torrentid=<?php 
            echo $TorrentID;
            ?>
" class="tooltip" title="Remove">RM</a>
<?php 
        }
        ?>
							| <a href="torrents.php?torrentid=<?php 
        echo $TorrentID;
        ?>
" class="tooltip" title="Permalink">PL</a>
						]</span>
						&raquo; <a href="#" onclick="$('#torrent_<?php 
        echo $TorrentID;
        ?>
').gtoggle(); return false;"><?php 
        echo $ExtraInfo;
        ?>
</a>
					</td>
					<td class="number_column nobr"><?php 
        echo Format::get_size($Size);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Snatched);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Seeders);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Leechers);
        ?>
</td>
				</tr>
				<tr class="releases_<?php 
        echo $ReleaseType;
        ?>
 groupid_<?php 
        echo $GroupID;
        ?>
 edition_<?php 
        echo $EditionID;
        ?>
 torrentdetails pad<?php 
        if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) {
            ?>
 hidden<?php 
        }
        ?>
" id="torrent_<?php 
        echo $TorrentID;
        ?>
">
					<td colspan="5">
						<blockquote>
							Uploaded by <?php 
        echo Users::format_username($UserID, false, false, false);
        ?>
 <?php 
        echo time_diff($TorrentTime);
        if ($Seeders == 0) {
            if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) {
                ?>
								<br /><strong>Last active: <?php 
                echo time_diff($LastActive);
                ?>
</strong>
<?php 
            } else {
                ?>
								<br />Last active: <?php 
                echo time_diff($LastActive);
            }
            if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) {
                ?>
								<br /><a href="torrents.php?action=reseed&amp;torrentid=<?php 
                echo $TorrentID;
                ?>
&amp;groupid=<?php 
                echo $GroupID;
                ?>
" class="brackets">Request re-seed</a>
<?php 
            }
        }
        ?>
						</blockquote>
<?php 
        if (check_perms('site_moderate_requests')) {
            ?>
						<div class="linkbox">
							<a href="torrents.php?action=masspm&amp;id=<?php 
            echo $GroupID;
            ?>
&amp;torrentid=<?php 
            echo $TorrentID;
            ?>
" class="brackets">Mass PM snatchers</a>
						</div>
<?php 
        }
        ?>
						<div class="linkbox">
							<a href="#" class="brackets" onclick="show_peers('<?php 
        echo $TorrentID;
        ?>
', 0); return false;">View peer list</a>
<?php 
        if (check_perms('site_view_torrent_snatchlist')) {
            ?>
							<a href="#" class="brackets tooltip" onclick="show_downloads('<?php 
            echo $TorrentID;
            ?>
', 0); return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
							<a href="#" class="brackets tooltip" onclick="show_snatches('<?php 
            echo $TorrentID;
            ?>
', 0); return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<?php 
        }
        ?>
							<a href="#" class="brackets" onclick="show_files('<?php 
        echo $TorrentID;
        ?>
'); return false;">View file list</a>
<?php 
        if ($Reported) {
            ?>
							<a href="#" class="brackets" onclick="show_reported('<?php 
            echo $TorrentID;
            ?>
'); return false;">View report information</a>
<?php 
        }
        ?>
						</div>
						<div id="peers_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="downloads_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="snatches_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="files_<?php 
        echo $TorrentID;
        ?>
" class="hidden"><?php 
        echo $FileTable;
        ?>
</div>
<?php 
        if ($Reported) {
            ?>
						<div id="reported_<?php 
            echo $TorrentID;
            ?>
" class="hidden"><?php 
            echo $ReportInfo;
            ?>
</div>
<?php 
        }
        if (!empty($Description)) {
            echo "\n\t\t\t\t\t\t<blockquote>" . Text::full_format($Description) . '</blockquote>';
        }
        ?>
					</td>
				</tr>
<?php 
    }
}
Esempio n. 25
0
		<a href="http://anonym.to/?<?php 
    echo $FeaturedMerchURL . $FeaturedMerch['ProductID'];
    ?>
"><img src="<?php 
    echo ImageTools::process($FeaturedMerch['Image']);
    ?>
" width="100%" alt="Featured Product Image" /></a>
	</div>
	<div class="center pad">
		<a href="http://anonym.to/?<?php 
    echo $FeaturedMerchURL . $FeaturedMerch['ProductID'];
    ?>
"><em>Product Page</em></a>
<?php 
    if ($FeaturedMerch['ArtistID'] > 0) {
        $UserInfo = Users::user_info($FeaturedMerch['ArtistID']);
        ?>
		- Artist: <a href="user.php?id=<?php 
        echo $FeaturedMerch['ArtistID'];
        ?>
"><?php 
        echo $UserInfo['Username'];
        ?>
</a>
<?php 
    }
    ?>
	</div>
</div>
<?php 
} else {