mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
Empty commit
This commit is contained in:
parent
7d8e070bf8
commit
ac74044ec2
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
config.php
|
||||
release/*
|
||||
static/similar
|
||||
*.swp
|
||||
*.project
|
||||
*.php~
|
||||
|
@ -38,7 +38,9 @@ class CACHE extends Memcache {
|
||||
'stats_*',
|
||||
'percentiles_*',
|
||||
'top10tor_*',
|
||||
'query_lock_*'
|
||||
'query_lock_*',
|
||||
'top10votes_*',
|
||||
'similar_albums_*'
|
||||
);
|
||||
|
||||
public $CanClear = false;
|
||||
|
@ -60,24 +60,39 @@ public static function get_ratio_color($Ratio) {
|
||||
* @param int $Dividend AKA numerator
|
||||
* @param int $Divisor
|
||||
* @param boolean $Color if true, ratio will be coloured.
|
||||
* @return formatted ratio HTML
|
||||
* @return string formatted ratio HTML
|
||||
*/
|
||||
public static function get_ratio_html($Dividend, $Divisor, $Color = true) {
|
||||
if ($Divisor == 0 && $Dividend == 0) {
|
||||
return '--';
|
||||
} elseif ($Divisor == 0) {
|
||||
return '<span class="r99">∞</span>';
|
||||
}
|
||||
$Ratio = number_format(max($Dividend/$Divisor-0.005,0), 2); //Subtract .005 to floor to 2 decimals
|
||||
if ($Color) {
|
||||
$Class = Format::get_ratio_color($Ratio);
|
||||
if ($Class) {
|
||||
$Ratio = '<span class="'.$Class.'">'.$Ratio.'</span>';
|
||||
}
|
||||
}
|
||||
public static function get_ratio_html($Dividend, $Divisor, $Color = true)
|
||||
{
|
||||
$Ratio = self::get_ratio($Dividend, $Divisor);
|
||||
|
||||
if ($Ratio === false) return '--';
|
||||
if ($Ratio === '∞') return '<span class="r99" title="Infinite">∞</span>';
|
||||
|
||||
if ($Color)
|
||||
$Ratio = sprintf('<span class="%s" title="%s">%s</span>',
|
||||
self::get_ratio_color($Ratio),
|
||||
self::get_ratio($Dividend, $Divisor, 5),
|
||||
$Ratio
|
||||
);
|
||||
|
||||
return $Ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ratio
|
||||
* @param int $Dividend
|
||||
* @param int $Divisor
|
||||
* @return boolean|string|float
|
||||
*/
|
||||
public function get_ratio ($Dividend, $Divisor, $Decimal = 2)
|
||||
{
|
||||
if ($Divisor == 0 && $Dividend == 0) return false;
|
||||
if ($Divisor == 0) return '∞';
|
||||
|
||||
// Subtract .005 to floor to 2 decimals
|
||||
return number_format(max($Dividend/$Divisor - 0.005, 0), $Decimal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query string of the current page, minus the parameters in $Exclude
|
||||
@ -192,7 +207,7 @@ public static function get_pages($StartPage,$TotalRecords,$ItemsPerPage,$ShowPag
|
||||
|
||||
$StartPosition = max($StartPosition, 1);
|
||||
|
||||
$QueryString = Format::get_url(array('page','post'));
|
||||
$QueryString = self::get_url(array('page','post'));
|
||||
if ($QueryString != '') {
|
||||
$QueryString = '&'.$QueryString;
|
||||
}
|
||||
@ -254,7 +269,7 @@ public static function get_size($Size, $Levels = 2) {
|
||||
if (func_num_args() == 1 && $Steps >= 4) {
|
||||
$Levels++;
|
||||
}
|
||||
return number_format($Size,$Levels) . $Units[$Steps];
|
||||
return number_format($Size, $Levels) . $Units[$Steps];
|
||||
}
|
||||
|
||||
|
||||
@ -364,7 +379,7 @@ public static function selected($Name, $Value, $Attribute='selected', $Array = a
|
||||
*/
|
||||
public static function make_utf8($Str) {
|
||||
if ($Str!="") {
|
||||
if (Format::is_utf8($Str)) { $Encoding="UTF-8"; }
|
||||
if (self::is_utf8($Str)) { $Encoding="UTF-8"; }
|
||||
if (empty($Encoding)) { $Encoding=mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); }
|
||||
if (empty($Encoding)) { $Encoding="ISO-8859-1"; }
|
||||
if ($Encoding=="UTF-8") { return $Str; }
|
||||
@ -393,4 +408,3 @@ public static function is_utf8($Str) {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
74
classes/class_mass_user_bookmarks_editor.php
Normal file
74
classes/class_mass_user_bookmarks_editor.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
//require_once 'class_mass_user_torrents_editor.php';
|
||||
|
||||
/**
|
||||
* This class helps with mass-editing bookmarked torrents.
|
||||
*
|
||||
* It can later be used for other bookmark tables.
|
||||
*
|
||||
*/
|
||||
class MASS_USER_BOOKMARKS_EDITOR extends MASS_USER_TORRENTS_EDITOR
|
||||
{
|
||||
public function __construct ($Table = 'bookmarks_torrents')
|
||||
{
|
||||
parent::__construct();
|
||||
$this->set_table($Table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a SQL query and clears the bookmarks_torrent_{$UserID}_full Cache key
|
||||
*
|
||||
* $Cache->delete_value didn't always work, but setting the key to null, did. (?)
|
||||
*
|
||||
* @param string $sql
|
||||
*/
|
||||
protected function query_and_clear_cache ($sql)
|
||||
{
|
||||
if (is_string($sql) && $this->DB->query($sql)) {
|
||||
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID, null, 0);
|
||||
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID . '_full', null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses (checkboxes) $_POST['remove'] to delete entries.
|
||||
*
|
||||
* Uses an IN() to match multiple items in one query.
|
||||
*/
|
||||
public function mass_remove () {
|
||||
$SQL = array();
|
||||
foreach ($_POST['remove'] as $GroupID => $K) {
|
||||
if (is_number($GroupID))
|
||||
$SQL[] = sprintf('%d', $GroupID);
|
||||
}
|
||||
|
||||
if (!empty($SQL)) {
|
||||
$SQL = sprintf('DELETE FROM %s WHERE UserID = %d AND GroupID IN (%s)',
|
||||
$this->Table,
|
||||
$this->UserID,
|
||||
implode(', ', $SQL)
|
||||
);
|
||||
$this->query_and_clear_cache($SQL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses $_POST['sort'] values to update the DB.
|
||||
*/
|
||||
public function mass_update () {
|
||||
$SQL = array();
|
||||
foreach ($_POST['sort'] as $GroupID => $Sort) {
|
||||
if (is_number($Sort) && is_number($GroupID))
|
||||
$SQL[] = sprintf('(%d, %d, %d)', $GroupID, $Sort, $this->UserID);
|
||||
}
|
||||
|
||||
if (!empty($SQL)) {
|
||||
$SQL = sprintf('INSERT INTO %s (GroupID, Sort, UserID) VALUES %s
|
||||
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)',
|
||||
$this->Table,
|
||||
implode(', ', $SQL));
|
||||
$this->query_and_clear_cache($SQL);
|
||||
}
|
||||
}
|
||||
}
|
99
classes/class_mass_user_torrents_editor.php
Normal file
99
classes/class_mass_user_torrents_editor.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Abstract class
|
||||
* Mass User-Torrents Editor
|
||||
*
|
||||
* A class that deals with mass editing a user's torrents.
|
||||
*
|
||||
* This abstract class is used by sub-classes as a way to access the Cache/DB.
|
||||
*
|
||||
* It is intended to streamline the process of processing data sent by the
|
||||
* MASS_USER_TORRENT_TABLE_VIEW class.
|
||||
*
|
||||
* It could also be used for other types like collages.
|
||||
*/
|
||||
abstract class MASS_USER_TORRENTS_EDITOR
|
||||
{
|
||||
/**
|
||||
* Internal access to the Cache
|
||||
* @var Cache $Cache
|
||||
*/
|
||||
protected $Cache;
|
||||
|
||||
/**
|
||||
* Internal access to the Database
|
||||
* @var DB_MYSQL $DB
|
||||
*/
|
||||
protected $DB;
|
||||
|
||||
/**
|
||||
* Current User's ID
|
||||
* @var str|int $UserID
|
||||
*/
|
||||
protected $UserID;
|
||||
|
||||
/**
|
||||
* The affected DB table
|
||||
* @var string $Table
|
||||
*/
|
||||
protected $Table;
|
||||
|
||||
/**
|
||||
* Extended classes should call this method.
|
||||
* @example parent::__construct()
|
||||
* @global CACHE $Cache
|
||||
* @global DB_MYSQL $DB
|
||||
* @global string|int $UserID
|
||||
*/
|
||||
public function __construct (/*CACHE &$Cache, DB_MYSQL &$DB, $UserID*/)
|
||||
{
|
||||
global $Cache, $DB, $UserID;
|
||||
$this->Cache = $Cache;
|
||||
$this->DB = $DB;
|
||||
$this->UserID = (int) $UserID;
|
||||
if ($this->UserID < 1) error(403);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Table
|
||||
* @param string $Table
|
||||
*/
|
||||
final public function set_table ($Table)
|
||||
{
|
||||
$this->Table = db_string($Table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Table
|
||||
* @param sting $Table
|
||||
* @return string $Table
|
||||
*/
|
||||
final public function get_table ()
|
||||
{
|
||||
return $this->Table;
|
||||
}
|
||||
|
||||
/**
|
||||
* The extending class must provide a method to send a query and clear the cache
|
||||
*/
|
||||
abstract protected function query_and_clear_cache ($sql);
|
||||
|
||||
/**
|
||||
* A method to insert many rows into a single table
|
||||
* Not required in subsequent classes
|
||||
*/
|
||||
public function mass_add () {}
|
||||
|
||||
/**
|
||||
* A method to remove many rows from a table
|
||||
* The extending class must have a mass_remove method
|
||||
*/
|
||||
abstract public function mass_remove ();
|
||||
|
||||
/**
|
||||
* A method to update many rows in a table
|
||||
* The extending class must have a mass_update method
|
||||
*/
|
||||
abstract public function mass_update ();
|
||||
}
|
296
classes/class_mass_user_torrents_table_view.php
Normal file
296
classes/class_mass_user_torrents_table_view.php
Normal file
@ -0,0 +1,296 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This class outputs a table that can be used to sort torrents through a drag/drop
|
||||
* interface, an automatic column sorter, or manual imput.
|
||||
*
|
||||
* It places checkboxes to delete items.
|
||||
*
|
||||
* (It creates a div#thin.)
|
||||
*
|
||||
* It can be used for Bookmarks, Collages, or anywhere where torrents are managed.
|
||||
*/
|
||||
class MASS_USER_TORRENTS_TABLE_VIEW
|
||||
{
|
||||
/**
|
||||
* Used to set text the page heading (h2 tag)
|
||||
* @var string $Heading
|
||||
*/
|
||||
private $Heading = 'Manage Torrents';
|
||||
|
||||
/**
|
||||
* Sets the value of the input name="type"
|
||||
* Later to be used as $_POST['type'] in a form processor
|
||||
* @var string $EditType
|
||||
*/
|
||||
private $EditType;
|
||||
|
||||
/**
|
||||
* Flag for empty $TorrentList
|
||||
* @var bool $HasTorrentList
|
||||
*/
|
||||
private $HasTorrents;
|
||||
|
||||
/**
|
||||
* Internal reference to the TorrentList
|
||||
* @var array $TorrentList
|
||||
*/
|
||||
private $TorrentList;
|
||||
|
||||
/**
|
||||
* Ref. to $LoggedUser
|
||||
* @var array $LoggedUser
|
||||
*/
|
||||
private $LoggedUser;
|
||||
|
||||
/**
|
||||
* Ref. to $CollageDataList
|
||||
* @var array $CollageDataList
|
||||
*/
|
||||
private $CollageDataList;
|
||||
|
||||
/**
|
||||
* The UserID
|
||||
* @var int $UserID
|
||||
*/
|
||||
private $UserID;
|
||||
|
||||
/**
|
||||
* Counter for number of groups
|
||||
* @var in $NumGroups
|
||||
*/
|
||||
private $NumGroups = 0;
|
||||
|
||||
/**
|
||||
* When creating a new instance of this class, TorrentList and
|
||||
* CollageDataList must be passed. Additionally, a heading can be added.
|
||||
*
|
||||
* @global int|string $UserID
|
||||
* @global array $LoggedUser
|
||||
* @param array $TorrentList
|
||||
* @param array $CollageDataList
|
||||
* @param string $EditType
|
||||
* @param string $Heading
|
||||
*/
|
||||
public function __construct (array &$TorrentList, array &$CollageDataList, $EditType, $Heading = null)
|
||||
{
|
||||
global $UserID, $LoggedUser;
|
||||
|
||||
$this->set_heading($Heading);
|
||||
$this->set_edit_type($EditType);
|
||||
|
||||
$this->UserID = (int) $UserID;
|
||||
$this->LoggedUser = &$LoggedUser;
|
||||
|
||||
$this->TorrentList = $TorrentList;
|
||||
$this->CollageDataList = $CollageDataList;
|
||||
|
||||
$this->HasTorrents = !empty($TorrentList);
|
||||
if(!$this->HasTorrents) $this->no_torrents();
|
||||
}
|
||||
|
||||
private function no_torrents ()
|
||||
{
|
||||
?>
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>No torrents found.</h2>
|
||||
</div>
|
||||
<div class="box pad" align="center">
|
||||
<p>Add some torrents and come back later.</p>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a complete page and table
|
||||
*/
|
||||
public function render_all ()
|
||||
{
|
||||
$this->header();
|
||||
$this->body();
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a comptele page/table header: div#thin, h2, scripts, notes,
|
||||
* form, table, etc.
|
||||
*/
|
||||
public function header ()
|
||||
{
|
||||
if ($this->HasTorrents) :
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2><?=display_str($this->Heading)?></h2>
|
||||
</div>
|
||||
<script src="static/functions/jquery-ui.js" type="text/javascript"></script>
|
||||
<script src="static/functions/jquery.tablesorter.min.js" type="text/javascript"></script>
|
||||
<script src="static/functions/sort.js" type="text/javascript"></script>
|
||||
|
||||
<table width="100%" class="layout">
|
||||
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
|
||||
<tr>
|
||||
<td id="drag_drop_textnote">
|
||||
<ul>
|
||||
<li>Click on the headings to organize columns automatically.</li>
|
||||
<li>Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.</li>
|
||||
<li>Click and drag any row to change its order.</li>
|
||||
<li>Double-click on a row to check it.</li>
|
||||
</ul>
|
||||
<noscript><ul><li><strong class="important_text">Enable JavaScript!</strong></li></ul></noscript>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="bookmarks.php" method="post" id="drag_drop_collage_form">
|
||||
|
||||
<? $this->buttons(); ?>
|
||||
|
||||
<table id="manage_collage_table">
|
||||
<thead>
|
||||
<tr class="colhead">
|
||||
<th style="width:7%">Order</th>
|
||||
<th style="width:1%"><span><abbr title="Current order">#</abbr></span></th>
|
||||
<th style="width:1%"><span>Year</span></th>
|
||||
<th style="width:15%"><span>Artist</span></th>
|
||||
<th><span>Torrent</span></th>
|
||||
<th style="width:1%"><span>User</span></th>
|
||||
<th style="width:3%" id="check_all"><span>Remove</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes header code
|
||||
*/
|
||||
public function footer ()
|
||||
{
|
||||
if ($this->HasTorrents) :
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<? $this->buttons(); ?>
|
||||
|
||||
<div>
|
||||
<input type="hidden" name="action" value="mass_edit" />
|
||||
<input type="hidden" name="type" value="<?=display_str($this->EditType)?>" />
|
||||
<input type="hidden" name="auth" value="<?=$this->LoggedUser['AuthKey']?>" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats data for use in row
|
||||
*
|
||||
*/
|
||||
public function body ()
|
||||
{
|
||||
if ($this->HasTorrents)
|
||||
foreach ($this->TorrentList as $GroupID => $Group) {
|
||||
$Artists = array();
|
||||
extract($Group);
|
||||
extract($this->CollageDataList[$GroupID]);
|
||||
|
||||
$this->NumGroups++;
|
||||
|
||||
$DisplayName = self::display_name($ExtendedArtists, $Artists, $VanityHouse);
|
||||
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$Name.'</a>';
|
||||
$Year = $Year > 0 ? $Year : '';
|
||||
|
||||
$this->row($Sort, $GroupID, $Year, $DisplayName, $TorrentLink);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a single row
|
||||
*
|
||||
* @param string|int $Sort
|
||||
* @param string|int $GroupID
|
||||
* @param string|int $GroupYear
|
||||
* @param string $DisplayName
|
||||
* @param string $TorrentLink
|
||||
*/
|
||||
public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink)
|
||||
{
|
||||
$CSS = $this->NumGroups % 2 === 0 ? 'rowa' : 'rowb';
|
||||
?>
|
||||
|
||||
<tr class="drag <?=$CSS?>" id="li_<?=$GroupID?>">
|
||||
<td>
|
||||
<input class="sort_numbers" type="text" name="sort[<?=$GroupID?>]" value="<?=$Sort?>" id="sort_<?=$GroupID?>" size="4" />
|
||||
</td>
|
||||
<td><?=$this->NumGroups?></td>
|
||||
<td><?=trim($GroupYear)?></td>
|
||||
<td><?=trim($DisplayName)?></td>
|
||||
<td><?=trim($TorrentLink)?></td>
|
||||
<td class="nobr"><?=Users::format_username($this->UserID, false, false, false)?></td>
|
||||
<td class="center"><input type="checkbox" name="remove[<?=$GroupID?>]" value="" /></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a simple display name
|
||||
*
|
||||
* @param array $ExtendedArtists
|
||||
* @param array $Artists
|
||||
* @param string $VanityHouse
|
||||
* @return string $DisplayName
|
||||
*/
|
||||
static public function display_name (array &$ExtendedArtists, array &$Artists, $VanityHouse)
|
||||
{
|
||||
$DisplayName = '';
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4])
|
||||
|| !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2], $ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists, true, false);
|
||||
} elseif (count($Artists) > 0) {
|
||||
$DisplayName = Artists::display_artists(array('1'=>$Artists), true, false);
|
||||
}
|
||||
if ($VanityHouse) $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]';
|
||||
return $DisplayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders buttons used at the top and bottom of the table
|
||||
*/
|
||||
public function buttons ()
|
||||
{
|
||||
?>
|
||||
<div class="drag_drop_save">
|
||||
<input type="submit" name="update" value="Update Ranking" title="Save your rank." class="save_sortable_collage" />
|
||||
<input type="submit" name="delete" value="Delete Checked" title="Remove items." class="save_sortable_collage" />
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $EditType
|
||||
*/
|
||||
public function set_edit_type ($EditType)
|
||||
{
|
||||
$this->EditType = $EditType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the current page's heading
|
||||
* @param string $Heading
|
||||
*/
|
||||
public function set_heading ($Heading)
|
||||
{
|
||||
$this->Heading = $Heading;
|
||||
}
|
||||
}
|
@ -89,6 +89,15 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
|
||||
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
|
||||
list($SenderName) = $DB->next_record();
|
||||
foreach($ToID as $ID) {
|
||||
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'");
|
||||
list($UnRead) = $DB->next_record();
|
||||
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
|
||||
|
||||
}
|
||||
|
||||
return $ConvID;
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ class TEXT {
|
||||
':-|' => 'blank.gif',
|
||||
':blush:' => 'blush.gif',
|
||||
':cool:' => 'cool.gif',
|
||||
':'(' => 'crying.gif',
|
||||
':crying:' => 'crying.gif',
|
||||
':'(' => 'crying.gif',
|
||||
':crying:' => 'crying.gif',
|
||||
'>.>' => 'eyesright.gif',
|
||||
':frown:' => 'frown.gif',
|
||||
'<3' => 'heart.gif',
|
||||
@ -21,7 +21,7 @@ class TEXT {
|
||||
//':\\' => 'hmm.gif',
|
||||
':whatlove:' => 'ilu.gif',
|
||||
':lol:' => 'laughing.gif',
|
||||
':loveflac:' => 'loveflac.gif',
|
||||
':loveflac:' => 'loveflac.gif',
|
||||
':flaclove:' => 'loveflac.gif',
|
||||
':ninja:' => 'ninja.gif',
|
||||
':no:' => 'no.gif',
|
||||
@ -54,17 +54,60 @@ class TEXT {
|
||||
);
|
||||
|
||||
private $NoImg = 0; // If images should be turned into URLs
|
||||
private $Levels = 0; // If images should be turned into URLs
|
||||
|
||||
function __construct() {
|
||||
private $Levels = 0;
|
||||
|
||||
/**
|
||||
* Used to detect and disable parsing (eg TOC) within quotes
|
||||
* @var int $InQuotes
|
||||
*/
|
||||
private $InQuotes = 0;
|
||||
|
||||
/**
|
||||
* Array of headlines for Table Of Contents (TOC)
|
||||
* @var array $HeadLines
|
||||
*/
|
||||
private $Headlines;
|
||||
|
||||
/**
|
||||
* Counter for making headline URLs unique
|
||||
* @var int $HeadLines
|
||||
*/
|
||||
private $HeadlineID = 0;
|
||||
|
||||
/**
|
||||
* Depth
|
||||
* @var array $HeadlineLevels
|
||||
*/
|
||||
private $HeadlineLevels = array('1', '2', '3', '4');
|
||||
|
||||
/**
|
||||
* TOC enabler
|
||||
* @var bool $TOC
|
||||
*/
|
||||
private $TOC;
|
||||
|
||||
/**
|
||||
* @param bool $TOC When used, will enabled TOC
|
||||
*/
|
||||
public function __construct ($TOC = false) {
|
||||
$this->TOC = (bool) $TOC;
|
||||
foreach($this->Smileys as $Key=>$Val) {
|
||||
$this->Smileys[$Key] = '<img border="0" src="'.STATIC_SERVER.'common/smileys/'.$Val.'" alt="" />';
|
||||
}
|
||||
reset($this->Smileys);
|
||||
}
|
||||
|
||||
function full_format($Str) {
|
||||
/**
|
||||
* Output BB Code as xHTML
|
||||
* @param string $Str BBCode text
|
||||
* @param bool $OutputTOC Ouput TOC near (above) text
|
||||
* @param int $Min See {@link parse_toc}
|
||||
* @return string
|
||||
*/
|
||||
public function full_format ($Str, $OutputTOC = true, $Min = 3) {
|
||||
$Str = display_str($Str);
|
||||
$this->Headlines = array();
|
||||
|
||||
//Inline links
|
||||
$URLPrefix = '(\[url\]|\[url\=|\[img\=|\[img\])';
|
||||
@ -74,19 +117,30 @@ function full_format($Str) {
|
||||
$callback = create_function('$matches', 'return str_replace("[inlineurl]","",$matches[0]);');
|
||||
$Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', $callback, $Str);
|
||||
|
||||
$Str = preg_replace('/\=\=\=\=([^=].*)\=\=\=\=/i', '[inlinesize=3]$1[/inlinesize]', $Str);
|
||||
$Str = preg_replace('/\=\=\=([^=].*)\=\=\=/i', '[inlinesize=5]$1[/inlinesize]', $Str);
|
||||
$Str = preg_replace('/\=\=([^=].*)\=\=/i', '[inlinesize=7]$1[/inlinesize]', $Str);
|
||||
if ($this->TOC) {
|
||||
$Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);
|
||||
$Str = preg_replace('/(\={4})([^=].*)\1/i', '[headline=3]$2[/headline]', $Str);
|
||||
$Str = preg_replace('/(\={3})([^=].*)\1/i', '[headline=2]$2[/headline]', $Str);
|
||||
$Str = preg_replace('/(\={2})([^=].*)\1/i', '[headline=1]$2[/headline]', $Str);
|
||||
} else {
|
||||
$Str = preg_replace('/(\={4})([^=].*)\1/i', '[inlinesize=3]$2[/inlinesize]', $Str);
|
||||
$Str = preg_replace('/(\={3})([^=].*)\1/i', '[inlinesize=5]$2[/inlinesize]', $Str);
|
||||
$Str = preg_replace('/(\={2})([^=].*)\1/i', '[inlinesize=7]$2[/inlinesize]', $Str);
|
||||
}
|
||||
|
||||
$Str = $this->parse($Str);
|
||||
|
||||
$HTML = $this->to_html($Str);
|
||||
|
||||
$HTML = nl2br($HTML);
|
||||
|
||||
if ($this->TOC && $OutputTOC)
|
||||
$HTML = $this->parse_toc($Min) . $HTML;
|
||||
|
||||
return $HTML;
|
||||
}
|
||||
|
||||
function strip_bbcode($Str) {
|
||||
public function strip_bbcode ($Str) {
|
||||
$Str = display_str($Str);
|
||||
|
||||
//Inline links
|
||||
@ -101,7 +155,7 @@ function strip_bbcode($Str) {
|
||||
}
|
||||
|
||||
|
||||
function valid_url($Str, $Extension = '', $Inline = false) {
|
||||
private function valid_url ($Str, $Extension = '', $Inline = false) {
|
||||
$Regex = '/^';
|
||||
$Regex .= '(https?|ftps?|irc):\/\/'; // protocol
|
||||
$Regex .= '(\w+(:\w+)?@)?'; // user:pass@
|
||||
@ -129,7 +183,7 @@ function valid_url($Str, $Extension = '', $Inline = false) {
|
||||
return preg_match($Regex, $Str, $Matches);
|
||||
}
|
||||
|
||||
function local_url($Str) {
|
||||
public function local_url ($Str) {
|
||||
$URLInfo = parse_url($Str);
|
||||
if(!$URLInfo) { return false; }
|
||||
$Host = $URLInfo['host'];
|
||||
@ -151,44 +205,45 @@ function local_url($Str) {
|
||||
}
|
||||
|
||||
|
||||
/* How parsing works
|
||||
/*
|
||||
How parsing works
|
||||
|
||||
Parsing takes $Str, breaks it into blocks, and builds it into $Array.
|
||||
Blocks start at the beginning of $Str, when the parser encounters a [, and after a tag has been closed.
|
||||
This is all done in a loop.
|
||||
Parsing takes $Str, breaks it into blocks, and builds it into $Array.
|
||||
Blocks start at the beginning of $Str, when the parser encounters a [, and after a tag has been closed.
|
||||
This is all done in a loop.
|
||||
|
||||
EXPLANATION OF PARSER LOGIC
|
||||
EXPLANATION OF PARSER LOGIC
|
||||
|
||||
1) Find the next tag (regex)
|
||||
1a) If there aren't any tags left, write everything remaining to a block and return (done parsing)
|
||||
1b) If the next tag isn't where the pointer is, write everything up to there to a text block.
|
||||
2) See if it's a [[wiki-link]] or an ordinary tag, and get the tag name
|
||||
3) If it's not a wiki link:
|
||||
3a) check it against the $this->ValidTags array to see if it's actually a tag and not [bullshit]
|
||||
If it's [not a tag], just leave it as plaintext and move on
|
||||
3b) Get the attribute, if it exists [name=attribute]
|
||||
4) Move the pointer past the end of the tag
|
||||
5) Find out where the tag closes (beginning of [/tag])
|
||||
5a) Different for different types of tag. Some tags don't close, others are weird like [*]
|
||||
5b) If it's a normal tag, it may have versions of itself nested inside - eg:
|
||||
[quote=bob]*
|
||||
[quote=joe]I am a redneck!**[/quote]
|
||||
Me too!
|
||||
***[/quote]
|
||||
If we're at the position *, the first [/quote] tag is denoted by **.
|
||||
However, our quote tag doesn't actually close there. We must perform
|
||||
a loop which checks the number of opening [quote] tags, and make sure
|
||||
they are all closed before we find our final [/quote] tag (***).
|
||||
1) Find the next tag (regex)
|
||||
1a) If there aren't any tags left, write everything remaining to a block and return (done parsing)
|
||||
1b) If the next tag isn't where the pointer is, write everything up to there to a text block.
|
||||
2) See if it's a [[wiki-link]] or an ordinary tag, and get the tag name
|
||||
3) If it's not a wiki link:
|
||||
3a) check it against the $this->ValidTags array to see if it's actually a tag and not [bullshit]
|
||||
If it's [not a tag], just leave it as plaintext and move on
|
||||
3b) Get the attribute, if it exists [name=attribute]
|
||||
4) Move the pointer past the end of the tag
|
||||
5) Find out where the tag closes (beginning of [/tag])
|
||||
5a) Different for different types of tag. Some tags don't close, others are weird like [*]
|
||||
5b) If it's a normal tag, it may have versions of itself nested inside - eg:
|
||||
[quote=bob]*
|
||||
[quote=joe]I am a redneck!**[/quote]
|
||||
Me too!
|
||||
***[/quote]
|
||||
If we're at the position *, the first [/quote] tag is denoted by **.
|
||||
However, our quote tag doesn't actually close there. We must perform
|
||||
a loop which checks the number of opening [quote] tags, and make sure
|
||||
they are all closed before we find our final [/quote] tag (***).
|
||||
|
||||
5c) Get the contents between [open] and [/close] and call it the block.
|
||||
In many cases, this will be parsed itself later on, in a new parse() call.
|
||||
5d) Move the pointer past the end of the [/close] tag.
|
||||
6) Depending on what type of tag we're dealing with, create an array with the attribute and block.
|
||||
In many cases, the block may be parsed here itself. Stick them in the $Array.
|
||||
7) Increment array pointer, start again (past the end of the [/close] tag)
|
||||
5c) Get the contents between [open] and [/close] and call it the block.
|
||||
In many cases, this will be parsed itself later on, in a new parse() call.
|
||||
5d) Move the pointer past the end of the [/close] tag.
|
||||
6) Depending on what type of tag we're dealing with, create an array with the attribute and block.
|
||||
In many cases, the block may be parsed here itself. Stick them in the $Array.
|
||||
7) Increment array pointer, start again (past the end of the [/close] tag)
|
||||
|
||||
*/
|
||||
function parse($Str) {
|
||||
*/
|
||||
private function parse ($Str) {
|
||||
$i = 0; // Pointer to keep track of where we are in $Str
|
||||
$Len = strlen($Str);
|
||||
$Array = array();
|
||||
@ -386,10 +441,23 @@ function parse($Str) {
|
||||
case 'code':
|
||||
case 'plain':
|
||||
$Block = strtr($Block, array('[inlineurl]'=>''));
|
||||
|
||||
$Callback = function ($matches) {
|
||||
$n = $matches[2];
|
||||
$text = '';
|
||||
if ($n < 5 && $n > 0) {
|
||||
$e = str_repeat('=', $matches[2]+1);
|
||||
$text = $e . $matches[3] . $e;
|
||||
}
|
||||
return $text;
|
||||
};
|
||||
$Block = preg_replace_callback('/\[(headline)\=(\d)\](.*?)\[\/\1\]/i', $Callback, $Block);
|
||||
|
||||
$Block = preg_replace('/\[inlinesize\=3\](.*?)\[\/inlinesize\]/i', '====$1====', $Block);
|
||||
$Block = preg_replace('/\[inlinesize\=5\](.*?)\[\/inlinesize\]/i', '===$1===', $Block);
|
||||
$Block = preg_replace('/\[inlinesize\=7\](.*?)\[\/inlinesize\]/i', '==$1==', $Block);
|
||||
|
||||
|
||||
$Array[$ArrayPos] = array('Type'=>$TagName, 'Val'=>$Block);
|
||||
break;
|
||||
case 'hide':
|
||||
@ -427,7 +495,71 @@ function parse($Str) {
|
||||
return $Array;
|
||||
}
|
||||
|
||||
function to_html($Array) {
|
||||
/**
|
||||
* Generates a navigation list for TOC
|
||||
* @param int $Min Minimum number of headlines required for a TOC list
|
||||
*/
|
||||
public function parse_toc ($Min = 3)
|
||||
{
|
||||
if (count($this->Headlines) > $Min) {
|
||||
$list = '<ol class="navigation_list">';
|
||||
$i = 0;
|
||||
$level = 0;
|
||||
$off = 0;
|
||||
|
||||
foreach ($this->Headlines as $t) {
|
||||
$n = (int) $t[0];
|
||||
if($i === 0 && $n > 1) $off = $n - $level;
|
||||
$this->headline_level($n, $level, $list, $i, $off);
|
||||
$list .= sprintf('<li><a href="#%2$s">%1$s</a>', $t[1], $t[2]);
|
||||
$level = $t[0];
|
||||
$off = 0;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$list .= str_repeat('</li></ol>', $level);
|
||||
$list .= "\n\n";
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the list items and proper depth
|
||||
*
|
||||
* First check if the item should be higher than the current level
|
||||
* - Close the list and previous lists
|
||||
*
|
||||
* Then check if the item should go lower than the current level
|
||||
* - If the list doesn't open on level one, use the Offset
|
||||
* - Open appropriate sub lists
|
||||
*
|
||||
* Otherwise the item is on the same as level as the previous item
|
||||
*
|
||||
* @param int $ItemLevel Current item level
|
||||
* @param int $Level Current list level
|
||||
* @param str $List reference to an xHTML string
|
||||
* @param int $i Iterator digit
|
||||
* @param int $Offset If the list doesn't start at level 1
|
||||
*/
|
||||
private function headline_level (&$ItemLevel, &$Level, &$List, $i, &$Offset)
|
||||
{
|
||||
if ($ItemLevel < $Level) {
|
||||
$diff = $Level - $ItemLevel;
|
||||
$List .= '</li>' . str_repeat('</ol></li>', $diff);
|
||||
} elseif ($ItemLevel > $Level) {
|
||||
$diff = $ItemLevel - $Level;
|
||||
if ($Offset > 0) $List .= str_repeat('<li><ol>', $Offset-2);
|
||||
|
||||
if ($ItemLevel > 1) {
|
||||
$List .= $i === 0 ? '<li>' : '';
|
||||
$List .= "\n" . '<ol>' . "\n";
|
||||
}
|
||||
} else {
|
||||
$List .= $i > 0 ? '</li>' : '<li>';
|
||||
}
|
||||
}
|
||||
|
||||
private function to_html ($Array) {
|
||||
global $SSL;
|
||||
$this->Levels++;
|
||||
if($this->Levels>10) { return $Block['Val']; } // Hax prevention
|
||||
@ -524,6 +656,18 @@ function to_html($Array) {
|
||||
$Str.='<span style="color:'.$Block['Attr'].'">'.$this->to_html($Block['Val']).'</span>';
|
||||
}
|
||||
break;
|
||||
case 'headline':
|
||||
$text = $this->to_html($Block['Val']);
|
||||
if(!in_array($Block['Attr'], $this->HeadlineLevels)) {
|
||||
$Str .= sprintf('%1$s%2$s%1$s', str_repeat('=', $Block['Attr'] + 1), $text);
|
||||
} else {
|
||||
$id = '_' . crc32($text . $this->HeadlineID);
|
||||
if ($this->InQuotes === 0) $this->Headlines[] = array($Block['Attr'], $text, $id);
|
||||
|
||||
$Str .= sprintf('<h%1$d id="%3$s">%2$s</h%1$d>', ($Block['Attr']+2), $text, $id);
|
||||
$this->HeadlineID++;
|
||||
}
|
||||
break;
|
||||
case 'inlinesize':
|
||||
case 'size':
|
||||
$ValidAttribs = array('1','2','3','4','5','6','7','8','9','10');
|
||||
@ -535,6 +679,7 @@ function to_html($Array) {
|
||||
break;
|
||||
case 'quote':
|
||||
$this->NoImg++; // No images inside quote tags
|
||||
$this->InQuotes++;
|
||||
if(!empty($Block['Attr'])) {
|
||||
$Exploded = explode("|", $this->to_html($Block['Attr']));
|
||||
if(isset($Exploded[1]) && is_numeric($Exploded[1])) {
|
||||
@ -547,6 +692,7 @@ function to_html($Array) {
|
||||
}
|
||||
$Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>';
|
||||
$this->NoImg--;
|
||||
$this->InQuotes--;
|
||||
break;
|
||||
case 'hide':
|
||||
$Str.='<strong>'.(($Block['Attr']) ? $Block['Attr'] : 'Hidden text').'</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
|
||||
@ -631,7 +777,7 @@ function to_html($Array) {
|
||||
return $Str;
|
||||
}
|
||||
|
||||
function raw_text($Array) {
|
||||
private function raw_text ($Array) {
|
||||
$Str = '';
|
||||
foreach($Array as $Block) {
|
||||
if(is_string($Block)) {
|
||||
@ -639,7 +785,8 @@ function raw_text($Array) {
|
||||
continue;
|
||||
}
|
||||
switch($Block['Type']) {
|
||||
|
||||
case 'headline':
|
||||
break;
|
||||
case 'b':
|
||||
case 'u':
|
||||
case 'i':
|
||||
@ -695,7 +842,7 @@ function raw_text($Array) {
|
||||
return $Str;
|
||||
}
|
||||
|
||||
function smileys($Str) {
|
||||
private function smileys ($Str) {
|
||||
global $LoggedUser;
|
||||
if(!empty($LoggedUser['DisableSmileys'])) {
|
||||
return $Str;
|
||||
@ -716,8 +863,7 @@ function check_perms($Perm) {return true;}
|
||||
==hi==[/pre]
|
||||
====hi====
|
||||
hi";
|
||||
$Text = NEW TEXT;
|
||||
$Text = new TEXT;
|
||||
echo $Text->full_format($Str);
|
||||
echo "\n"
|
||||
*/
|
||||
?>
|
||||
|
199
classes/class_textarea_preview.php
Normal file
199
classes/class_textarea_preview.php
Normal file
@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/**
|
||||
* This super class is used to manage the ammount of textareas there are and to
|
||||
* generate the required JavaScript that enables the previews to work.
|
||||
*/
|
||||
class TEXTAREA_PREVIEW_SUPER
|
||||
{
|
||||
/**
|
||||
* @static
|
||||
* @var int $Textareas Total number of textareas created
|
||||
*/
|
||||
static protected $Textareas = 0;
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @var array $_ID Array of textarea IDs
|
||||
*/
|
||||
static protected $_ID = array();
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @var bool For use in JavaScript method
|
||||
*/
|
||||
static private $Exectuted = false;
|
||||
|
||||
/**
|
||||
* This method should only run once with $all as true and should be placed
|
||||
* in the header or footer.
|
||||
*
|
||||
* If $all is true, it includes TextareaPreview and jQuery with noConflict()
|
||||
* for use with Sizzle.
|
||||
*
|
||||
* jQuery is required for this to work, include it in the headers.
|
||||
*
|
||||
* @static
|
||||
* @param bool $all Output all required scripts, otherwise just do iterator()
|
||||
* @example <pre><?php TEXT_PREVIEW::JavaScript(); ?></pre>
|
||||
* @return void
|
||||
*/
|
||||
static public function JavaScript ($all = true)
|
||||
{
|
||||
if (self::$Textareas === 0) return;
|
||||
if (self::$Exectuted === false && $all)
|
||||
View::parse('generic/textarea/script.phtml');
|
||||
|
||||
self::$Exectuted = true;
|
||||
self::iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* This iterator generates JavaScript to initialize each JavaScript
|
||||
* TextareaPreview object.
|
||||
*
|
||||
* It will generate a numeric or custom ID related to the textarea.
|
||||
* @static
|
||||
* @return void
|
||||
*/
|
||||
static private function iterator ()
|
||||
{
|
||||
$script = array();
|
||||
for($i = 0; $i < self::$Textareas; $i++) {
|
||||
if (isset(self::$_ID[$i]) && is_string(self::$_ID[$i])) {
|
||||
$a = sprintf('%d, "%s"', $i, self::$_ID[$i]);
|
||||
} else {
|
||||
$a = $i;
|
||||
}
|
||||
$script[] = sprintf('[%s]', $a);
|
||||
}
|
||||
if (!empty($script))
|
||||
View::parse('generic/textarea/script_factory.phtml',
|
||||
array('script' => join(', ', $script)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Textarea Preview Class
|
||||
*
|
||||
* This class generates a textarea that works with the JS preview script.
|
||||
*
|
||||
* Templates found in design/views/generic/textarea
|
||||
*
|
||||
* @example <pre><?php
|
||||
* // Create a textarea with a name of content.
|
||||
* // Buttons and preview divs are generated automatically near the textarea.
|
||||
* new TEXTAREA_PREVIEW('content');
|
||||
*
|
||||
* // Create a textarea with name and id body_text with default text and
|
||||
* // no buttons or wrap preview divs.
|
||||
* // Buttons and preview divs are generated manually
|
||||
* $text = new TEXTAREA_PREVIEW('body_text', 'body_text', 'default text',
|
||||
* 50, 20, false, false, array('disabled="disabled"', 'class="text"'));
|
||||
*
|
||||
* $text->buttons(); // output buttons
|
||||
*
|
||||
* $text->preview(); // output preview div
|
||||
*
|
||||
* // Create a textarea with custom preview wrapper around a table
|
||||
* // the table will be (in)visible depending on the toggle
|
||||
* $text = new TEXTAREA_PREVIEW('body', '', '', 30, 10, false, false);
|
||||
* $id = $text->getID();
|
||||
*
|
||||
* // some template
|
||||
* <div id="preview_wrap_<?=$id?>">
|
||||
* <table>
|
||||
* <tr>
|
||||
* <td>
|
||||
* <div id="preview_<?=$id?>"></div>
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </div>
|
||||
* </pre>
|
||||
*/
|
||||
class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER
|
||||
{
|
||||
/**
|
||||
* @var int Unique ID
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Flag for preview output
|
||||
* @var bool $preview
|
||||
*/
|
||||
private $preview = false;
|
||||
|
||||
/**
|
||||
* This method creates a textarea
|
||||
*
|
||||
* @param string $Name name attribute
|
||||
* @param string $ID id attribute
|
||||
* @param string $Value default text attribute
|
||||
* @param string $Cols cols attribute
|
||||
* @param string $Rows rows attribute
|
||||
* @param bool $Preview add the preview divs near the textarea
|
||||
* @param bool $Buttons add the edit/preview buttons near the textarea
|
||||
*
|
||||
* If false for either, use the appropriate methods to add the those
|
||||
* elements elsewhere. Alternatively, use getID to create your own.
|
||||
*
|
||||
* @param array $ExtraAttributes array of attribute="value"
|
||||
*/
|
||||
public function __construct ($Name, $ID = '', $Value='', $Cols=50, $Rows=10,
|
||||
$Preview = true, $Buttons = true, array $ExtraAttributes = array()
|
||||
) {
|
||||
$this->id = parent::$Textareas;
|
||||
parent::$Textareas += 1;
|
||||
array_push(parent::$_ID, $ID);
|
||||
|
||||
if (empty($ID)) $ID = 'quickpost_' . $this->id;
|
||||
|
||||
if (!empty($ExtraAttributes))
|
||||
$Attributes = ' ' . implode(' ', $ExtraAttributes);
|
||||
else
|
||||
$Attributes = '';
|
||||
|
||||
if ($Preview === true) $this->preview();
|
||||
|
||||
View::parse('generic/textarea/textarea.phtml', array(
|
||||
'ID' => $ID,
|
||||
'NID' => $this->id,
|
||||
'Name' => &$Name,
|
||||
'Value' => &$Value,
|
||||
'Cols' => &$Cols,
|
||||
'Rows' => &$Rows,
|
||||
'Attributes' => &$Attributes
|
||||
));
|
||||
|
||||
if ($Buttons === true) $this->buttons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the divs required for previewing the AJAX content
|
||||
* Will only output once
|
||||
*/
|
||||
public function preview ()
|
||||
{
|
||||
if (!$this->preview)
|
||||
View::parse('generic/textarea/preview.phtml', array('ID' => $this->id));
|
||||
$this->preview = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the preview and edit buttons
|
||||
* Can be called many times to place buttons in different areas
|
||||
*/
|
||||
public function buttons ()
|
||||
{
|
||||
View::parse('generic/textarea/buttons.phtml', array('ID' => $this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the textarea's numeric ID.
|
||||
*/
|
||||
public function getID ()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
@ -611,7 +611,7 @@ function show() {
|
||||
<tr>
|
||||
<td class="label">Album Description</td>
|
||||
<td>
|
||||
<textarea name="album_desc" id="album_desc" cols="60" rows="8" <?=$this->Disabled?>><?=display_str($Torrent['GroupDescription']); ?></textarea>
|
||||
<?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8, true, true, array($this->Disabled)); ?>
|
||||
<p class="min_padding">Contains background information such as album history and maybe a review.</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -619,17 +619,22 @@ function show() {
|
||||
<tr>
|
||||
<td class="label">Release Description (optional)</td>
|
||||
<td>
|
||||
<textarea name="release_desc" id="release_desc" cols="60" rows="8"><?=display_str($Torrent['TorrentDescription']); ?></textarea>
|
||||
<?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']), 60, 8); ?>
|
||||
<p class="min_padding">Contains information like encoder settings or details of the ripping process. <strong>DO NOT PASTE THE RIPPING LOG HERE.</strong></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
|
||||
// For AJAX requests (ie when changing the type from Music to Applications)
|
||||
// we don't need to include all scripts, but we do need to include the code
|
||||
// that generates previews. It will have to be eval'd after an AJAX request.
|
||||
if ($_SERVER['SCRIPT_NAME'] === '/ajax.php')
|
||||
TEXTAREA_PREVIEW::JavaScript(false);
|
||||
|
||||
}//function music_form
|
||||
|
||||
|
||||
|
||||
|
||||
function audiobook_form() {
|
||||
$Torrent = $this->Torrent;
|
||||
?>
|
||||
@ -714,7 +719,7 @@ function audiobook_form() {
|
||||
<tr>
|
||||
<td class="label">Description</td>
|
||||
<td>
|
||||
<textarea name="album_desc" id="album_desc" cols="60" rows="8"><?=display_str($Torrent['GroupDescription']); ?></textarea>
|
||||
<?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8); ?>
|
||||
<p class="min_padding">Contains information like the track listing, a review, a link to Discogs or MusicBrainz, etc.</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -722,18 +727,16 @@ function audiobook_form() {
|
||||
<tr>
|
||||
<td class="label">Release Description (optional)</td>
|
||||
<td>
|
||||
<textarea name="release_desc" id="release_desc" cols="60" rows="8"><?=display_str($Torrent['TorrentDescription']); ?></textarea>
|
||||
<?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']), 60, 8); ?>
|
||||
<p class="min_padding">Contains information like encoder settings. For analog rips, this frequently contains lineage information.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
TEXTAREA_PREVIEW::JavaScript(false);
|
||||
}//function audiobook_form
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function simple_form($CategoryID) {
|
||||
$Torrent = $this->Torrent;
|
||||
?> <table cellpadding="3" cellspacing="1" border="0" class="layout border slice" width="100%">
|
||||
@ -763,7 +766,10 @@ function simple_form($CategoryID) {
|
||||
<tr>
|
||||
<td class="label">Description</td>
|
||||
<td>
|
||||
<textarea name="desc" id="desc" cols="60" rows="8"><?=display_str($Torrent['GroupDescription']); ?></textarea>
|
||||
<?php
|
||||
new TEXTAREA_PREVIEW('desc', 'desc', display_str($Torrent['GroupDescription']), 60, 8);
|
||||
TEXTAREA_PREVIEW::JavaScript(false);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
|
@ -36,6 +36,12 @@ class Torrents {
|
||||
public static function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true) {
|
||||
global $DB, $Cache;
|
||||
|
||||
// Make sure there's something in $GroupIDs, otherwise the SQL
|
||||
// will break
|
||||
if (count($GroupIDs) == 0) {
|
||||
return array('matches'=>array(),'notfound'=>array());
|
||||
}
|
||||
|
||||
$Found = array_flip($GroupIDs);
|
||||
$NotFound = array_flip($GroupIDs);
|
||||
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
|
||||
@ -435,6 +441,7 @@ public static function torrent_info($Data, $ShowMedia = false, $ShowEdition = fa
|
||||
if (!empty($Data['RemasterTitle'])) { $EditionInfo[]=$Data['RemasterTitle']; }
|
||||
if (count($EditionInfo)) { $Info[]=implode(' ',$EditionInfo); }
|
||||
}
|
||||
if ($Data['SnatchedTorrent'] == '1') { $Info[]='<strong>Snatched!</strong>'; }
|
||||
if ($Data['FreeTorrent'] == '1') { $Info[]='<strong>Freeleech!</strong>'; }
|
||||
if ($Data['FreeTorrent'] == '2') { $Info[]='<strong>Neutral Leech!</strong>'; }
|
||||
if ($Data['PersonalFL']) { $Info[]='<strong>Personal Freeleech!</strong>'; }
|
||||
@ -498,7 +505,6 @@ public static function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the logged in user has an active freeleech token
|
||||
*
|
||||
@ -542,5 +548,23 @@ public static function can_use_token($Torrent) {
|
||||
&& empty($Torrent['FreeTorrent'])
|
||||
&& $LoggedUser['CanLeech'] == '1');
|
||||
}
|
||||
|
||||
public static function get_snatched_torrents($UserID = false) {
|
||||
global $DB, $Cache, $LoggedUser;
|
||||
if($LoggedUser['ShowSnatched']) {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
$SnatchedTorrents = $Cache->get_value('users_snatched_'.$UserID);
|
||||
if (empty($SnatchedTorrents)) {
|
||||
$DB->query("SELECT DISTINCT fid as TorrentID FROM xbt_snatched WHERE uid='$UserID'");
|
||||
$SnatchedTorrents = array_flip($DB->collect('TorrentID'));
|
||||
$Cache->cache_value('users_snatched_'.$UserID, $SnatchedTorrents, 86400);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$SnatchedTorrents = array();
|
||||
}
|
||||
return $SnatchedTorrents;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -442,5 +442,70 @@ public static function make_class_string($ClassID) {
|
||||
global $Classes;
|
||||
return $Classes[$ClassID]['Name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with User Bookmark data: group ids, collage data list, etc
|
||||
* @global CACHE $Cache
|
||||
* @global DB_MYSQL $DB
|
||||
* @param string|int $UserID
|
||||
* @return array
|
||||
*/
|
||||
function bookmark_data ($UserID)
|
||||
{
|
||||
global $Cache, $DB;
|
||||
|
||||
$UserID = (int) $UserID;
|
||||
|
||||
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
|
||||
|
||||
if($Data) {
|
||||
$Data = unserialize($Data);
|
||||
list($K, list($TorrentList, $CollageDataList)) = each($Data);
|
||||
} else {
|
||||
// Build the data for the collage and the torrent list
|
||||
$DB->query("SELECT
|
||||
bt.GroupID,
|
||||
bt.Sort,
|
||||
tg.WikiImage,
|
||||
tg.CategoryID,
|
||||
bt.Time
|
||||
FROM bookmarks_torrents AS bt
|
||||
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
|
||||
WHERE bt.UserID='$UserID'
|
||||
ORDER BY bt.Sort ASC");
|
||||
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||
|
||||
if(count($GroupIDs) > 0) {
|
||||
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||
$TorrentList = $TorrentList['matches'];
|
||||
} else {
|
||||
$TorrentList = array();
|
||||
}
|
||||
}
|
||||
|
||||
return array($K, $GroupIDs, $CollageDataList, $TorrentList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of torrents that a user has spent tokens on
|
||||
* @global CACHE $Cache
|
||||
* @global DB_MYSQL $DB
|
||||
* @param type $UserID
|
||||
* @return type
|
||||
*/
|
||||
function token_torrents ($UserID)
|
||||
{
|
||||
global $Cache, $DB;
|
||||
|
||||
$UserID = (int) $UserID;
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
return $TokenTorrents;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,5 +1,11 @@
|
||||
<?
|
||||
class View {
|
||||
class View
|
||||
{
|
||||
/**
|
||||
* @var string Path relative to where (P)HTML templates reside
|
||||
*/
|
||||
const IncludePath = './design/views/';
|
||||
|
||||
/**
|
||||
* This function is to include the header file on a page.
|
||||
*
|
||||
@ -8,7 +14,8 @@ class View {
|
||||
* the page, ONLY PUT THE RELATIVE LOCATION WITHOUT .js
|
||||
* ex: 'somefile,somdire/somefile'
|
||||
*/
|
||||
public static function show_header($PageTitle='',$JSIncludes='') {
|
||||
public static function show_header($PageTitle='',$JSIncludes='')
|
||||
{
|
||||
global $Document, $Cache, $DB, $LoggedUser, $Mobile, $Classes;
|
||||
|
||||
if($PageTitle!='') { $PageTitle.=' :: '; }
|
||||
@ -29,7 +36,8 @@ public static function show_header($PageTitle='',$JSIncludes='') {
|
||||
* Here is a list of parameters that work in the $Options array:
|
||||
* ['disclaimer'] = [boolean] (False) Displays the disclaimer in the footer
|
||||
*/
|
||||
public static function show_footer($Options=array()) {
|
||||
public static function show_footer ($Options=array())
|
||||
{
|
||||
global $ScriptStartTime, $LoggedUser, $Cache, $DB, $SessionID, $UserSessions, $Debug, $Time;
|
||||
if (!is_array($LoggedUser)) { require(SERVER_ROOT.'/design/publicfooter.php'); }
|
||||
else { require(SERVER_ROOT.'/design/privatefooter.php'); }
|
||||
@ -51,7 +59,8 @@ public static function show_footer($Options=array()) {
|
||||
* @param string $TemplateName The name of the template, in underscore_format
|
||||
* @param array $Args the arguments passed to the template.
|
||||
*/
|
||||
public static function render_template($TemplateName, $Args) {
|
||||
public static function render_template ($TemplateName, $Args)
|
||||
{
|
||||
static $LoadedTemplates; // Keep track of templates we've already loaded.
|
||||
$ClassName = '';
|
||||
if (isset($LoadedTemplates[$TemplateName])) {
|
||||
@ -69,5 +78,31 @@ public static function render_template($TemplateName, $Args) {
|
||||
}
|
||||
$ClassName::render($Args);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is similar to render_template, but does not require a
|
||||
* template class.
|
||||
*
|
||||
* Instead, this method simply renders a PHP file (PHTML) with the supplied
|
||||
* variables.
|
||||
*
|
||||
* All files must be placed within {self::IncludePath}. Create and organize
|
||||
* new paths and files. (eg: /design/views/artist/, design/view/forums/, etc.)
|
||||
*
|
||||
* @static
|
||||
* @param string $TemplateFile A relative path to a PHTML file
|
||||
* @param array $Variables Assoc. array of variables to extract for the template
|
||||
* @example <pre><?php
|
||||
* // The variable $id within box.phtml will be filled by $some_id
|
||||
* View::parse('section/box.phtml', array('id' => $some_id));
|
||||
* </pre>
|
||||
*/
|
||||
static public function parse ($TemplateFile, array $Variables = null)
|
||||
{
|
||||
$Template = self::IncludePath . $TemplateFile;
|
||||
if (file_exists($Template)) {
|
||||
extract($Variables);
|
||||
include $Template;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -16,6 +16,7 @@
|
||||
'site_advanced_search' => 'Advanced search access.',
|
||||
'site_top10' => 'Top 10 access.',
|
||||
'site_advanced_top10' => 'Advanced Top 10 access.',
|
||||
'site_album_votes' => 'Voting for favorite torrents.',
|
||||
'site_torrents_notify' => 'Notifications access.',
|
||||
'site_collages_create' => 'Collage create access.',
|
||||
'site_collages_manage' => 'Collage manage access.',
|
||||
@ -135,6 +136,7 @@ function permissions_form(){ ?>
|
||||
<? display_perm('site_collages_personal','Can have a personal collage.'); ?>
|
||||
<? display_perm('site_collages_renamepersonal','Can rename own personal collages.'); ?>
|
||||
<? display_perm('site_advanced_top10','Can access advanced top 10.'); ?>
|
||||
<? display_perm('site_album_votes', 'Can vote for favorite torrents.'); ?>
|
||||
<? display_perm('site_make_bookmarks','Can make bookmarks.'); ?>
|
||||
<? display_perm('site_edit_wiki','Can edit wiki pages.'); ?>
|
||||
<? display_perm('site_can_invite_always', 'Can invite users even when invites are closed.'); ?>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?
|
||||
|
||||
/*-- Script Start Class --------------------------------*/
|
||||
/*------------------------------------------------------*/
|
||||
/* This isnt really a class but a way to tie other */
|
||||
/* This isnt really a class but a way to tie other */
|
||||
/* classes and functions used all over the site to the */
|
||||
/* page currently being displayed. */
|
||||
/* page currently being displayed. */
|
||||
/*------------------------------------------------------*/
|
||||
/* The code that includes the main php files and */
|
||||
/* generates the page are at the bottom. */
|
||||
@ -117,6 +116,18 @@
|
||||
case 'View':
|
||||
$FileName = 'class_view';
|
||||
break;
|
||||
case 'MASS_USER_TORRENTS_EDITOR':
|
||||
$FileName = 'class_mass_user_torrents_editor';
|
||||
break;
|
||||
case 'MASS_USER_BOOKMARKS_EDITOR':
|
||||
$FileName = 'class_mass_user_bookmarks_editor';
|
||||
break;
|
||||
case 'MASS_USER_TORRENTS_TABLE_VIEW':
|
||||
$FileName = 'class_mass_user_torrents_table_view';
|
||||
break;
|
||||
case 'TEXTAREA_PREVIEW':
|
||||
$FileName = 'class_textarea_preview';
|
||||
break;
|
||||
default:
|
||||
die("Couldn't import class " . $ClassName);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
</div>
|
||||
<?php TEXTAREA_PREVIEW::JavaScript(); ?>
|
||||
<div id="footer">
|
||||
<? if (!empty($Options['disclaimer'])) { ?>
|
||||
<br /><br />
|
||||
|
@ -115,11 +115,11 @@
|
||||
|
||||
</ul>
|
||||
<ul id="userinfo_stats">
|
||||
<li id="stats_seeding"><a href="torrents.php?type=seeding&userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li>
|
||||
<li id="stats_leeching"><a href="torrents.php?type=leeching&userid=<?=$LoggedUser['ID']?>">Down</a>: <span class="stat"><?=Format::get_size($LoggedUser['BytesDownloaded'])?></span></li>
|
||||
<li id="stats_seeding"><a href="torrents.php?type=seeding&userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesUploaded'], 2)?></span></li>
|
||||
<li id="stats_leeching"><a href="torrents.php?type=leeching&userid=<?=$LoggedUser['ID']?>">Down</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesDownloaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesDownloaded'], 2)?></span></li>
|
||||
<li id="stats_ratio">Ratio: <span class="stat"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span></li>
|
||||
<? if(!empty($LoggedUser['RequiredRatio'])) {?>
|
||||
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
|
||||
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat" title="<?=number_format($LoggedUser['RequiredRatio'], 5)?>"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
|
||||
<? }
|
||||
if($LoggedUser['FLTokens'] > 0) { ?>
|
||||
<li id="fl_tokens"><a href="wiki.php?action=article&id=754">Tokens: </a><span class="stat"><a href="userhistory.php?action=token_history&userid=<?=$LoggedUser['ID']?>"><?=$LoggedUser['FLTokens']?></a></span></li>
|
||||
@ -181,6 +181,36 @@
|
||||
$Alerts = array();
|
||||
$ModBar = array();
|
||||
|
||||
//Quotes
|
||||
if($LoggedUser['NotifyOnQuote']) {
|
||||
$QuoteNotificationsCount = $Cache->get_value('forums_quotes_'.$LoggedUser['ID']);
|
||||
if($QuoteNotificationsCount === FALSE) {
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
|
||||
}
|
||||
$sql = "SELECT COUNT(UnRead) FROM users_notify_quoted AS q
|
||||
LEFT JOIN forums AS f ON f.ID = q.ForumID
|
||||
WHERE UserID='".$LoggedUser['ID']."'
|
||||
AND UnRead = '1' AND ((f.MinClassRead <= '$LoggedUser[Class]'";
|
||||
if(!empty($RestrictedForums)) {
|
||||
$sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if(!empty($PermittedForums)) {
|
||||
$sql.=' OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
$DB->query($sql);
|
||||
list($QuoteNotificationsCount) = $DB->next_record();
|
||||
$Cache->cache_value('forums_quotes_'.$LoggedUser['ID'], $QuoteNotificationsCount, 0);
|
||||
if($QuoteNotificationsCount > 0) {
|
||||
$Alerts[] = '<a href="userhistory.php?action=quote_notifications">'. 'New Quote'. ($QuoteNotificationsCount > 1 ? 's' : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// News
|
||||
$MyNews = $LoggedUser['LastReadNews'];
|
||||
$CurrentNews = $Cache->get_value('news_latest_id');
|
||||
|
@ -1,6 +1,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php TEXTAREA_PREVIEW::JavaScript(); ?>
|
||||
<div id="foot">
|
||||
<span><a href="#"><?=SITE_NAME?></a> | <a href="http://what-network.net">What-Network</a> | <a href="https://what.cd/gazelle/">Project Gazelle</a></span>
|
||||
</div>
|
||||
|
3
design/views/generic/textarea/buttons.phtml
Normal file
3
design/views/generic/textarea/buttons.phtml
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
<input type="button" value="Preview" class="hidden button_preview_<?=$ID?>" title="Preview text" />
|
||||
<input type="button" value="Edit" class="hidden button_edit_<?=$ID?>" title="Edit text" />
|
4
design/views/generic/textarea/preview.phtml
Normal file
4
design/views/generic/textarea/preview.phtml
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<div class="box vertical_space body hidden preview_wrap" id="preview_wrap_<?=$ID?>">
|
||||
<div id="preview_<?=$ID?>"></div>
|
||||
</div>
|
1
design/views/generic/textarea/script.phtml
Normal file
1
design/views/generic/textarea/script.phtml
Normal file
@ -0,0 +1 @@
|
||||
<script type="text/javascript" src="static/functions/class_textareapreview.js"></script>
|
4
design/views/generic/textarea/script_factory.phtml
Normal file
4
design/views/generic/textarea/script_factory.phtml
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<script type="text/javascript" class="preview_code">
|
||||
jQuery(document).ready(function () { TextareaPreview.factory([<?=$script?>]); });
|
||||
</script>
|
4
design/views/generic/textarea/textarea.phtml
Normal file
4
design/views/generic/textarea/textarea.phtml
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<div id="textarea_wrap_<?=$NID?>" class="textarea_wrap">
|
||||
<textarea name="<?=$Name?>" id="<?=$ID?>" cols="<?=$Cols?>" rows="<?=$Rows?>" <?=$Attributes?>><?=$Value?></textarea>
|
||||
</div>
|
74
gazelle.sql
74
gazelle.sql
File diff suppressed because one or more lines are too long
@ -101,6 +101,9 @@
|
||||
case 'userhistory':
|
||||
require(SERVER_ROOT.'/sections/ajax/userhistory/index.php');
|
||||
break;
|
||||
case 'votefavorite':
|
||||
require(SERVER_ROOT.'/sections/ajax/takevote.php');
|
||||
break;
|
||||
default:
|
||||
// If they're screwing around with the query string
|
||||
print json_encode(array('status' => 'failure'));
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* AJAX Previews, simple stuff. */
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
$Text = new TEXT(true);
|
||||
|
||||
if(!empty($_POST['AdminComment'])) {
|
||||
echo $Text->full_format($_POST['AdminComment']);
|
||||
@ -10,4 +10,4 @@
|
||||
$Content = $_REQUEST['body']; // Don't use URL decode.
|
||||
echo $Text->full_format($Content);
|
||||
}
|
||||
?>
|
||||
|
||||
|
204
sections/ajax/takevote.php
Normal file
204
sections/ajax/takevote.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?
|
||||
authorize();
|
||||
|
||||
$GroupID = $_REQUEST['groupid'];
|
||||
if (!is_number($GroupID)) {
|
||||
echo 'Invalid Group';
|
||||
die();
|
||||
}
|
||||
|
||||
// What groups has this guy voted?
|
||||
$UserVotes = $Cache->get_value('voted_albums_'.$LoggedUser['ID']);
|
||||
if ($UserVotes === FALSE) {
|
||||
$DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$LoggedUser['ID']);
|
||||
$UserVotes = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||
}
|
||||
|
||||
// What are the votes for this group?
|
||||
$GroupVotes = $Cache->get_value('votes_'.$GroupID);
|
||||
if ($GroupVotes === FALSE) {
|
||||
$DB->query("SELECT Ups AS Ups, Total AS Total FROM torrents_votes WHERE GroupID=$GroupID");
|
||||
if ($DB->record_count() == 0) {
|
||||
$GroupVotes = array('Ups'=>0, 'Total'=>0);
|
||||
} else {
|
||||
$GroupVotes = $DB->next_record(MYSQLI_ASSOC, false);
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
}
|
||||
|
||||
$UserID = $LoggedUser['ID'];
|
||||
if ($_REQUEST['do'] == 'vote') {
|
||||
if (isset($UserVotes[$GroupID]) || !check_perms('site_album_votes')) {
|
||||
echo 'noaction';
|
||||
die();
|
||||
}
|
||||
if ($_REQUEST['vote'] != 'up' && $_REQUEST['vote'] != 'down') {
|
||||
echo 'badvote';
|
||||
die();
|
||||
}
|
||||
$Type = ($_REQUEST['vote'] == 'up')?"Up":"Down";
|
||||
|
||||
// Update the group's cache key
|
||||
$GroupVotes['Total'] += 1;
|
||||
if ($Type == "Up") {
|
||||
$GroupVotes['Ups'] += 1;
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
|
||||
// Update the two votes tables
|
||||
$DB->query("INSERT INTO users_votes (UserID, GroupID, Type) VALUES ($UserID, $GroupID, '$Type') ON DUPLICATE KEY UPDATE Type = '$Type'");
|
||||
// If the group has no votes yet, we need an insert, otherwise an update
|
||||
// so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE...
|
||||
// to accomplish both in one query
|
||||
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
|
||||
VALUES ($GroupID, 1, ".($Type=='Up'?1:0).", 0)
|
||||
ON DUPLICATE KEY UPDATE Total = Total + 1,
|
||||
Score = binomial_ci(".$GroupVotes['Ups'].",". $GroupVotes['Total'].")".
|
||||
($Type=='Up'?', Ups = Ups+1':''));
|
||||
|
||||
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
|
||||
|
||||
// Update this guy's cache key
|
||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||
|
||||
// Update the paired cache keys for "people who liked"
|
||||
// First update this album's paired votes. If this keys is magically not set,
|
||||
// our life just got a bit easier. We're only tracking paired votes on upvotes.
|
||||
if ($Type == 'Up') {
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID);
|
||||
if ($VotePairs !== FALSE) {
|
||||
foreach ($UserVotes as $Vote) {
|
||||
if ($Vote['GroupID'] == $GroupID) {
|
||||
continue;
|
||||
}
|
||||
// Go through each of his other votes, incrementing the
|
||||
// corresponding keys in this groups vote_pairs array
|
||||
if (isset($VotePairs[$Vote['GroupID']])) {
|
||||
$VotePairs[$Vote['GroupID']]['Total'] += 1;
|
||||
if ($Vote['Type'] == 'Up') {
|
||||
$VotePairs[$Vote['GroupID']]['Ups'] += 1;
|
||||
}
|
||||
} else {
|
||||
$VotePairs[$Vote['GroupID']] = array('GroupID'=>$Vote['GroupID'],
|
||||
'Total' => 1,
|
||||
'Ups'=>($Type == 'Up')?1:0);
|
||||
}
|
||||
}
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
||||
}
|
||||
|
||||
// Now do the paired votes keys for all of this guy's other votes
|
||||
foreach ($UserVotes as $VGID => $Vote) {
|
||||
if ($Vote['Type'] != 'Up') {
|
||||
// We're only track paired votes on upvotes
|
||||
continue;
|
||||
}
|
||||
// Again, if the cache key is not set, move along
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$VGID);
|
||||
if ($VotePairs !== FALSE) {
|
||||
// Go through all of the other albums paired to this one, and update
|
||||
// this group's entry in their vote_pairs keys
|
||||
if (isset($VotePairs[$GroupID])) {
|
||||
$VotePairs[$GroupID]['Total']++;
|
||||
if ($Type == 'Up') {
|
||||
$VotePairs[$GroupID]['Ups']++;
|
||||
}
|
||||
} else {
|
||||
$VotePairs[$GroupID] = array('GroupID' => $GroupID,
|
||||
'Total' => 1,
|
||||
'Ups'=>($Type == 'Up')?1:0);
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$VGID, $VotePairs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo 'success';
|
||||
} elseif ($_REQUEST['do'] == 'unvote') {
|
||||
if (!isset($UserVotes[$GroupID])) {
|
||||
echo 'noaction';
|
||||
die();
|
||||
}
|
||||
$Type = $UserVotes[$GroupID]['Type'];
|
||||
|
||||
$DB->query("DELETE FROM users_votes WHERE UserID=$UserID AND GroupID=$GroupID");
|
||||
|
||||
// Update personal cache key
|
||||
unset($UserVotes[$GroupID]);
|
||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||
|
||||
// Update the group's cache key
|
||||
$GroupVotes['Total'] -= 1;
|
||||
if ($Type == "Up") {
|
||||
$GroupVotes['Ups'] -= 1;
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
|
||||
$DB->query("UPDATE torrents_votes SET Total = GREATEST(0, Total - 1),
|
||||
Score = binomial_ci(".$GroupVotes['Ups'].",".$GroupVotes['Total'].")".
|
||||
($Type=='Up'?', Ups = GREATEST(0, Ups - 1)':'')."
|
||||
WHERE GroupID=$GroupID");
|
||||
// Update paired cache keys
|
||||
// First update this album's paired votes. If this keys is magically not set,
|
||||
// our life just got a bit easier. We're only tracking paired votes on upvotes.
|
||||
if ($Type == 'Up') {
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID);
|
||||
if ($VotePairs !== FALSE) {
|
||||
foreach ($UserVotes as $Vote) {
|
||||
if (isset($VotePairs[$Vote['GroupID']])) {
|
||||
if ($VotePairs[$Vote['GroupID']]['Total'] == 0) {
|
||||
// Something is screwy
|
||||
$Cache->delete_value('vote_pairs_'.$GroupID);
|
||||
continue;
|
||||
}
|
||||
$VotePairs[$Vote['GroupID']]['Total'] -= 1;
|
||||
if ($Vote['Type'] == 'Up') {
|
||||
$VotePairs[$Vote['GroupID']]['Ups'] -= 1;
|
||||
}
|
||||
} else {
|
||||
// Something is screwy, kill the key and move on
|
||||
$Cache->delete_value('vote_pairs_'.$GroupID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
||||
}
|
||||
|
||||
// Now do the paired votes keys for all of this guy's other votes
|
||||
foreach ($UserVotes as $VGID => $Vote) {
|
||||
if ($Vote['Type'] != 'Up') {
|
||||
// We're only track paired votes on upvotes
|
||||
continue;
|
||||
}
|
||||
// Again, if the cache key is not set, move along
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$VGID);
|
||||
if ($VotePairs !== FALSE) {
|
||||
if (isset($VotePairs[$GroupID])) {
|
||||
if ($VotePairs[$GroupID]['Total'] == 0) {
|
||||
// Something is screwy
|
||||
$Cache->delete_value('vote_pairs_'.$VGID);
|
||||
continue;
|
||||
}
|
||||
$VotePairs[$GroupID]['Total'] -= 1;
|
||||
if ($Type == 'Up') {
|
||||
$VotePairs[$GroupID]['Ups'] -= 1;
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$VGID, $VotePairs);
|
||||
} else {
|
||||
// Something is screwy, kill the key and move on
|
||||
$Cache->delete_value('vote_pairs_'.$VGID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Let the script know what happened
|
||||
if ($Type == 'Up') {
|
||||
echo 'success-up';
|
||||
} else {
|
||||
echo 'success-down';
|
||||
}
|
||||
}
|
||||
?>
|
@ -61,6 +61,15 @@ function compare($X, $Y){
|
||||
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
|
||||
}
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
|
||||
//----------------- Build list and get stats
|
||||
|
||||
ob_start();
|
||||
@ -96,16 +105,14 @@ function compare($X, $Y){
|
||||
$LastReleaseType = 0;
|
||||
if(empty($Importances) || empty($TorrentList)) {
|
||||
$DB->query("SELECT
|
||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse
|
||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.ReleaseType
|
||||
FROM torrents_artists AS ta
|
||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||
WHERE ta.ArtistID='$ArtistID'
|
||||
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),1000 + ta.Importance, tg.ReleaseType) ASC,
|
||||
tg.Year DESC, tg.Name DESC");
|
||||
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
||||
|
||||
if(count($GroupIDs)>0) {
|
||||
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
|
||||
$TorrentList = $TorrentList['matches'];
|
||||
@ -170,8 +177,19 @@ function compare($X, $Y){
|
||||
if(!empty($ProducerAlbums)) {
|
||||
$ReleaseTypes[1021] = "Produced By";
|
||||
}
|
||||
|
||||
|
||||
//Custom sorting for releases
|
||||
if(!empty($LoggedUser['SortHide'])) {
|
||||
$SortOrder = array_keys($LoggedUser['SortHide']);
|
||||
uasort($Importances, function ($a, $b) {
|
||||
global $SortOrder;
|
||||
$c = array_search($a['ReleaseType'], $SortOrder);
|
||||
$d = array_search($b['ReleaseType'], $SortOrder);
|
||||
if ($c == $d) {
|
||||
return 0;
|
||||
}
|
||||
return $c < $d ? -1 : 1;
|
||||
});
|
||||
}
|
||||
reset($TorrentList);
|
||||
if(!empty($UsedReleases)) { ?>
|
||||
<div class="box center">
|
||||
@ -192,7 +210,7 @@ function compare($X, $Y){
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseID, $LoggedUser['HideTypes']))) {
|
||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['SortHide']) && array_key_exists($ReleaseType, $LoggedUser['SortHide']) && $LoggedUser['SortHide'][$ReleaseType] == 1)) {
|
||||
$ToggleStr = " onclick=\"$('.releases_$ReleaseID').show(); return true;\"";
|
||||
} else {
|
||||
$ToggleStr = '';
|
||||
@ -264,7 +282,12 @@ function compare($X, $Y){
|
||||
$OldReleaseType = $ReleaseType;
|
||||
}
|
||||
|
||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) {
|
||||
/* if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) {
|
||||
$HideDiscog = ' hidden';
|
||||
} else {
|
||||
$HideDiscog = '';
|
||||
} */
|
||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['SortHide']) && array_key_exists($ReleaseType, $LoggedUser['SortHide']) && $LoggedUser['SortHide'][$ReleaseType] == 1)) {
|
||||
$HideDiscog = ' hidden';
|
||||
} else {
|
||||
$HideDiscog = '';
|
||||
@ -431,7 +454,11 @@ function compare($X, $Y){
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?> ]
|
||||
</span>
|
||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||
<? if(array_key_exists($TorrentID, $SnatchedTorrents)) {
|
||||
$Torrent['SnatchedTorrent'] = '1';
|
||||
}
|
||||
?>
|
||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||
@ -450,7 +477,7 @@ function compare($X, $Y){
|
||||
|
||||
//----------------- End building list and getting stats
|
||||
|
||||
View::show_header($Name, 'browse,requests,bbcode');
|
||||
View::show_header($Name, 'browse,requests,bbcode,comments');
|
||||
?>
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
@ -879,6 +906,174 @@ function require(file, callback) {
|
||||
<div class="head"><strong>Artist info</strong></div>
|
||||
<div class="body"><?=$Text->full_format($Body)?></div>
|
||||
</div>
|
||||
<?php
|
||||
// --- Comments ---
|
||||
|
||||
// gets the amount of comments for this group
|
||||
$Results = $Cache->get_value('artist_comments_'.$ArtistID);
|
||||
if($Results === false) {
|
||||
$DB->query("SELECT
|
||||
COUNT(c.ID)
|
||||
FROM artist_comments as c
|
||||
WHERE c.ArtistID = '$ArtistID'");
|
||||
list($Results) = $DB->next_record();
|
||||
$Cache->cache_value('artist_comments_'.$ArtistID, $Results, 0);
|
||||
}
|
||||
|
||||
if(isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
|
||||
$DB->query("SELECT COUNT(ID) FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_GET[postid]");
|
||||
list($PostNum) = $DB->next_record();
|
||||
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
|
||||
} else {
|
||||
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
|
||||
}
|
||||
|
||||
//Get the cache catalogue
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
|
||||
|
||||
//---------- Get some data to start processing
|
||||
|
||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||
$Catalogue = $Cache->get_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID);
|
||||
if($Catalogue === false) {
|
||||
$DB->query("SELECT
|
||||
c.ID,
|
||||
c.AuthorID,
|
||||
c.AddedTime,
|
||||
c.Body,
|
||||
c.EditedUserID,
|
||||
c.EditedTime,
|
||||
u.Username
|
||||
FROM artist_comments as c
|
||||
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID
|
||||
WHERE c.ArtistID = '$ArtistID'
|
||||
ORDER BY c.ID
|
||||
LIMIT $CatalogueLimit");
|
||||
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
|
||||
$Cache->cache_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
||||
}
|
||||
|
||||
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
|
||||
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
|
||||
?>
|
||||
<div class="linkbox"><a name="comments"></a>
|
||||
<?
|
||||
$Pages=Format::get_pages($Page,$Results,TORRENT_COMMENTS_PER_PAGE,9,'#comments');
|
||||
echo $Pages;
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
//---------- Begin printing
|
||||
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));
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a class="post_id" href='artist.php?id=<?=$ArtistID?>&postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
|
||||
<strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&type=artist_comment&id=<?=$PostID?>">[Report]</a>
|
||||
<? 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<?=$PostID?>" action="" method="post">
|
||||
<input type="hidden" name="action" value="warn" />
|
||||
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>" />
|
||||
<input type="hidden" name="userid" value="<?=$AuthorID?>" />
|
||||
<input type="hidden" name="key" value="<?=$Key?>" />
|
||||
</form>
|
||||
- <a href="#" onclick="document.warn<?=$PostID?>.submit(); return false;">[Warn]</a>
|
||||
|
||||
<? }
|
||||
} ?>
|
||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
|
||||
<?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? }
|
||||
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
|
||||
</span>
|
||||
<span id="bar<?=$PostID?>" style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<? if(empty($HeavyInfo['DisableAvatars'])) { ?>
|
||||
<td class="avatar" valign="top">
|
||||
<? if ($Avatar) { ?>
|
||||
<img src="<?=$Avatar?>" width="150" alt="<?=$Username ?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<td class="body" valign="top">
|
||||
<div id="content<?=$PostID?>">
|
||||
<?=$Text->full_format($Body)?>
|
||||
<? if($EditedUserID){ ?>
|
||||
<br />
|
||||
<br />
|
||||
<? if(Paranoia::check_perms('site_admin_forums')) { ?>
|
||||
<a href="#content<?=$PostID?>" onclick="LoadEdit('artist', <?=$PostID?>, 1); return false;">«</a>
|
||||
<? } ?>
|
||||
Last edited by
|
||||
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? } ?>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
</div>
|
||||
<?
|
||||
if(!$LoggedUser['DisablePosting']) { ?>
|
||||
<br />
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad">
|
||||
<table id="quickreplypreview" class="forum_post box vertical_margin hidden" style="text-align:left;">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
|
||||
<a href="#quickreplypreview">[Report Comment]</a>
|
||||
</span>
|
||||
<span id="barpreview" style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form id="quickpostform" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post" style="display: block; text-align: center;">
|
||||
<div id="quickreplytext">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
|
||||
<textarea id="quickpost" name="body" cols="70" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" />
|
||||
</form>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
14
sections/artist/artistcomments.sql
Normal file
14
sections/artist/artistcomments.sql
Normal file
@ -0,0 +1,14 @@
|
||||
USE gazelle;
|
||||
|
||||
CREATE TABLE `artist_comments` (
|
||||
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`ArtistID` int(10) NOT NULL,
|
||||
`AuthorID` int(10) NOT NULL,
|
||||
`AddedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Body` mediumtext COLLATE utf8_bin,
|
||||
`EditedUserID` int(10) DEFAULT NULL,
|
||||
`EditedTime` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
KEY `TopicID` (`ArtistID`),
|
||||
KEY `AuthorID` (`AuthorID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
@ -35,11 +35,153 @@
|
||||
case 'change_artistid':
|
||||
require(SERVER_ROOT.'/sections/artist/change_artistid.php');
|
||||
break;
|
||||
default:
|
||||
case 'reply':
|
||||
authorize();
|
||||
|
||||
if (!isset($_POST['artistid']) || !isset($_POST['body']) || !is_number($_POST['artistid']) || trim($_POST['body'])==='') {
|
||||
error(0);
|
||||
}
|
||||
if($LoggedUser['DisablePosting']) {
|
||||
error('Your posting rights have been removed.');
|
||||
}
|
||||
|
||||
$ArtistID = $_POST['artistid'];
|
||||
if(!$ArtistID) { error(404); }
|
||||
|
||||
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM artist_comments AS ac WHERE ac.ArtistID='".db_string($ArtistID)."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages");
|
||||
list($Pages) = $DB->next_record();
|
||||
|
||||
$DB->query("INSERT INTO artist_comments (ArtistID,AuthorID,AddedTime,Body) VALUES (
|
||||
'".db_string($ArtistID)."', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
|
||||
$PostID=$DB->inserted_id();
|
||||
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID);
|
||||
$Post = array(
|
||||
'ID'=>$PostID,
|
||||
'AuthorID'=>$LoggedUser['ID'],
|
||||
'AddedTime'=>sqltime(),
|
||||
'Body'=>$_POST['body'],
|
||||
'EditedUserID'=>0,
|
||||
'EditedTime'=>'0000-00-00 00:00:00',
|
||||
'Username'=>''
|
||||
);
|
||||
$Cache->insert('', $Post);
|
||||
$Cache->commit_transaction(0);
|
||||
$Cache->increment('artist_comments_'.$ArtistID);
|
||||
|
||||
header('Location: artist.php?id='.$ArtistID.'&page='.$Pages);
|
||||
break;
|
||||
case 'warn' :
|
||||
include(SERVER_ROOT.'/sections/artist/warn.php');
|
||||
break;
|
||||
case 'take_warn' :
|
||||
include(SERVER_ROOT.'/sections/artist/take_warn.php');
|
||||
break;
|
||||
|
||||
case 'takeedit_post':
|
||||
authorize();
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_POST['post'] || !is_number($_POST['post'])) { error(0); }
|
||||
|
||||
// Mainly
|
||||
$DB->query("SELECT
|
||||
ac.Body,
|
||||
ac.AuthorID,
|
||||
ac.ArtistID,
|
||||
ac.AddedTime
|
||||
FROM artist_comments AS ac
|
||||
WHERE ac.ID='".db_string($_POST['post'])."'");
|
||||
list($OldBody, $AuthorID,$ArtistID,$AddedTime)=$DB->next_record();
|
||||
|
||||
$DB->query("SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_POST[post]");
|
||||
list($Page) = $DB->next_record();
|
||||
|
||||
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); }
|
||||
if ($DB->record_count()==0) { error(404); }
|
||||
|
||||
// Perform the update
|
||||
$DB->query("UPDATE artist_comments SET
|
||||
Body = '".db_string($_POST['body'])."',
|
||||
EditedUserID = '".db_string($LoggedUser['ID'])."',
|
||||
EditedTime = '".sqltime()."'
|
||||
WHERE ID='".db_string($_POST['post'])."'");
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID);
|
||||
|
||||
$Cache->update_row($_POST['key'], array(
|
||||
'ID'=>$_POST['post'],
|
||||
'AuthorID'=>$AuthorID,
|
||||
'AddedTime'=>$AddedTime,
|
||||
'Body'=>$_POST['body'],
|
||||
'EditedUserID'=>db_string($LoggedUser['ID']),
|
||||
'EditedTime'=>sqltime(),
|
||||
'Username'=>$LoggedUser['Username']
|
||||
));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('artist', ".db_string($_POST['post']).", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
|
||||
|
||||
// This gets sent to the browser, which echoes it in place of the old body
|
||||
echo $Text->full_format($_POST['body']);
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
} elseif(!empty($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
switch ($_GET['action']) {
|
||||
case 'get_post':
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); }
|
||||
$DB->query("SELECT Body FROM artist_comments WHERE ID='".db_string($_GET['post'])."'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
echo trim($Body);
|
||||
break;
|
||||
|
||||
case 'delete_comment':
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); }
|
||||
|
||||
// Make sure they are moderators
|
||||
if (!check_perms('site_moderate_forums')) { error(403); }
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
ArtistID,
|
||||
CEIL(COUNT(ac.ID)/".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
||||
CEIL(SUM(IF(ac.ID<=".$_GET['postid'].",1,0))/".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
||||
FROM artist_comments AS ac
|
||||
WHERE ac.ArtistID=(SELECT ArtistID FROM artist_comments WHERE ID=".$_GET['postid'].")
|
||||
GROUP BY ac.ArtistID");
|
||||
list($ArtistID,$Pages,$Page)=$DB->next_record();
|
||||
|
||||
// $Pages = number of pages in the thread
|
||||
// $Page = which page the post is on
|
||||
// These are set for cache clearing.
|
||||
|
||||
$DB->query("DELETE FROM artist_comments WHERE ID='".db_string($_GET['postid'])."'");
|
||||
|
||||
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
||||
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
for($i=$ThisCatalogue;$i<=$LastCatalogue;$i++) {
|
||||
$Cache->delete('artist_comments_'.$ArtistID.'_catalogue_'.$i);
|
||||
}
|
||||
|
||||
// Delete thread info cache (eg. number of pages)
|
||||
$Cache->delete('artist_comments_'.$ArtistID);
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
require(SERVER_ROOT.'/sections/artist/edit.php');
|
||||
break;
|
||||
|
73
sections/artist/take_warn.php
Normal file
73
sections/artist/take_warn.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);
|
||||
}
|
||||
isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'artistid', 'postid', 'userid'));
|
||||
|
||||
$Reason = db_string($_POST['reason']);
|
||||
$PrivateMessage = db_string($_POST['privatemessage']);
|
||||
$Body = db_string($_POST['body']);
|
||||
$Length = $_POST['length'];
|
||||
$ArtistID = (int)$_POST['artistid'];
|
||||
$PostID = (int)$_POST['postid'];
|
||||
$UserID = (int)$_POST['userid'];
|
||||
$Key = (int)$_POST['key'];
|
||||
$SQLTime = sqltime();
|
||||
$UserInfo = user_info($UserID);
|
||||
if($UserInfo['Class'] > $LoggedUser['Class']) {
|
||||
error(403);
|
||||
}
|
||||
$URL = "https://". SSL_SITE_URL."/artist.php?id=$ArtistID&postid=$PostID#post$PostID";
|
||||
if ($Length != 'verbal') {
|
||||
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
||||
warn_user($UserID, $Time, "$URL - ". $Reason);
|
||||
$Subject = "You have received a warning";
|
||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
|
||||
$WarnTime = time_plus($Time);
|
||||
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
|
||||
} else {
|
||||
$Subject = "You have received a verbal warning";
|
||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
|
||||
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
$DB -> query('UPDATE users_info SET
|
||||
Warned=\'' . db_string($WarnTime) . '\',
|
||||
WarnedTimes=WarnedTimes+1,
|
||||
AdminComment=CONCAT(\'' . db_string($AdminComment) . '\',AdminComment)
|
||||
WHERE UserID=\'' . db_string($UserID) . '\'');
|
||||
}
|
||||
$DB -> query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
// Mainly
|
||||
$DB -> query("SELECT
|
||||
ac.Body,
|
||||
ac.AuthorID,
|
||||
ac.ArtistID,
|
||||
ac.AddedTime
|
||||
FROM artist_comments AS ac
|
||||
WHERE ac.ID='$PostID'");
|
||||
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB -> next_record();
|
||||
|
||||
$DB -> query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $PostID");
|
||||
list($Page) = $DB -> next_record();
|
||||
|
||||
// Perform the update
|
||||
$DB -> query("UPDATE Artist_comments SET
|
||||
Body = '$Body',
|
||||
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
||||
EditedTime = '" . sqltime() . "'
|
||||
WHERE ID='$PostID'");
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache -> begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
||||
|
||||
$Cache -> update_row($_POST['key'], array('ID' => $_POST['postid'], 'AuthorID' => $AuthorID, 'AddedTime' => $AddedTime, 'Body' => $_POST['body'], 'EditedUserID' => db_string($LoggedUser['ID']), 'EditedTime' => sqltime(), 'Username' => $LoggedUser['Username']));
|
||||
$Cache -> commit_transaction(0);
|
||||
|
||||
$DB -> query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('artist', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
|
||||
|
||||
header("Location: artist.php?id=$ArtistID&postid=$PostID#post$PostID");
|
||||
?>;
|
68
sections/artist/warn.php
Normal file
68
sections/artist/warn.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);}
|
||||
isset_request($_POST, array('artistid', 'postid', 'userid', 'key'));
|
||||
|
||||
$ArtistID = (int) $_POST['artistid'];
|
||||
$PostID = (int) $_POST['postid'];
|
||||
$UserID = (int) $_POST['userid'];
|
||||
$Key = (int) $_POST['key'];
|
||||
$UserInfo = user_info($UserID);
|
||||
$DB -> query("SELECT
|
||||
tc.Body,
|
||||
tc.AddedTime
|
||||
FROM torrents_comments AS tc
|
||||
WHERE tc.ID='" . db_string($PostID) . "'");
|
||||
list($PostBody) = $DB -> next_record();
|
||||
|
||||
show_header('Warn User');
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<form action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<input type="hidden" name="artistid" value="<?=$ArtistID?>"/>
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>"/>
|
||||
<input type="hidden" name="userid" value="<?=$UserID?>"/>
|
||||
<input type="hidden" name="key" value="<?=$Key?>"/>
|
||||
<input type="hidden" name="action" value="take_warn"/>
|
||||
<table class="layout" align="center">
|
||||
<tr>
|
||||
<td class="label">Reason:</td>
|
||||
<td>
|
||||
<input type="text" name="reason" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Length:</td>
|
||||
<td>
|
||||
<select name="length">
|
||||
<option value="verbal">Verbal</option>
|
||||
<option value="1">1 week</option>
|
||||
<option value="2">2 week</option>
|
||||
<option value="4">4 week</option>
|
||||
<? if(check_perms("users_mod")) { ?>
|
||||
<option value="8">8 week</option>
|
||||
<? } ?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Private Message:</td>
|
||||
<td>
|
||||
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Edit Post:</td>
|
||||
<td>
|
||||
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
|
||||
<br />
|
||||
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<? show_footer(); ?>
|
@ -18,10 +18,21 @@
|
||||
|
||||
$DB->query("SELECT UserID FROM $Table WHERE UserID='$LoggedUser[ID]' AND $Col='".db_string($_GET['id'])."'");
|
||||
if($DB->record_count() == 0) {
|
||||
$DB->query("INSERT IGNORE INTO $Table
|
||||
(UserID, $Col, Time)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
|
||||
if ($Type === 'torrent') {
|
||||
$DB->query('SELECT MAX(Sort) FROM `bookmarks_torrents` WHERE UserID =' . $LoggedUser['ID']);
|
||||
list($Sort) = $DB->next_record();
|
||||
if (!$Sort) $Sort = 0;
|
||||
$Sort += 1;
|
||||
$DB->query("INSERT IGNORE INTO $Table
|
||||
(UserID, $Col, Time, Sort)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."', $Sort)");
|
||||
} else {
|
||||
$DB->query("INSERT IGNORE INTO $Table
|
||||
(UserID, $Col, Time)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
|
||||
}
|
||||
$Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
|
||||
if ($Type == 'torrent') {
|
||||
$Cache->delete_value('bookmarks_torrent_'.$LoggedUser['ID'].'_full');
|
||||
@ -61,4 +72,3 @@
|
||||
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
29
sections/bookmarks/edit_torrents.php
Normal file
29
sections/bookmarks/edit_torrents.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// ugly UserID code that should be turned into a function . . .
|
||||
if(!empty($_GET['userid'])) {
|
||||
if(!check_perms('users_override_paranoia')) {
|
||||
error(403);
|
||||
}
|
||||
$UserID = $_GET['userid'];
|
||||
if(!is_number($UserID)) { error(404); }
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
|
||||
list($Username) = $DB->next_record();
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
// Finally we start
|
||||
|
||||
//Require the table class
|
||||
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
|
||||
|
||||
View::show_header('Organize Bookmarks', 'browse,jquery');
|
||||
|
||||
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';
|
||||
|
||||
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
|
||||
|
||||
$TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks');
|
||||
$TT->render_all();
|
||||
|
||||
View::show_footer();
|
@ -16,6 +16,10 @@
|
||||
require(SERVER_ROOT.'/sections/bookmarks/remove.php');
|
||||
break;
|
||||
|
||||
case 'mass_edit':
|
||||
require(SERVER_ROOT.'/sections/bookmarks/mass_edit.php');
|
||||
break;
|
||||
|
||||
case 'remove_snatched':
|
||||
authorize();
|
||||
$DB->query("CREATE TEMPORARY TABLE snatched_groups_temp (GroupID int PRIMARY KEY)");
|
||||
@ -27,6 +31,17 @@
|
||||
die();
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = false; }
|
||||
switch ($_REQUEST['type']) {
|
||||
case 'torrents':
|
||||
require(SERVER_ROOT.'/sections/bookmarks/edit_torrents.php');
|
||||
break;
|
||||
default : error(404);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'view':
|
||||
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; }
|
||||
switch ($_REQUEST['type']) {
|
||||
@ -52,4 +67,3 @@
|
||||
default:
|
||||
error(404);
|
||||
}
|
||||
?>
|
||||
|
16
sections/bookmarks/mass_edit.php
Normal file
16
sections/bookmarks/mass_edit.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
authorize();
|
||||
|
||||
if ($UserID != $LoggedUser['ID'] || !can_bookmark('torrent')) error(403);
|
||||
|
||||
if ($_POST['type'] === 'torrents') {
|
||||
// require_once SERVER_ROOT.'/classes/class_mass_user_bookmarks_editor.php'; //Bookmark Updater Class
|
||||
$BU = new MASS_USER_BOOKMARKS_EDITOR;
|
||||
if ($_POST['delete'])
|
||||
$BU->mass_remove();
|
||||
else if ($_POST['update'])
|
||||
$BU->mass_update();
|
||||
}
|
||||
|
||||
header('Location: bookmarks.php?type=torrents');
|
@ -23,33 +23,17 @@ function compare($X, $Y){
|
||||
|
||||
$Sneaky = ($UserID != $LoggedUser['ID']);
|
||||
|
||||
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
|
||||
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
|
||||
|
||||
if($Data) {
|
||||
$Data = unserialize($Data);
|
||||
list($K, list($TorrentList, $CollageDataList)) = each($Data);
|
||||
} else {
|
||||
// Build the data for the collage and the torrent list
|
||||
$DB->query("SELECT
|
||||
bt.GroupID,
|
||||
tg.WikiImage,
|
||||
tg.CategoryID,
|
||||
bt.Time
|
||||
FROM bookmarks_torrents AS bt
|
||||
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
|
||||
WHERE bt.UserID='$UserID'
|
||||
ORDER BY bt.Time");
|
||||
$TokenTorrents = Users::token_torrents($UserID);
|
||||
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||
if(count($GroupIDs)>0) {
|
||||
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||
$TorrentList = $TorrentList['matches'];
|
||||
} else {
|
||||
$TorrentList = array();
|
||||
}
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
|
||||
|
||||
// Loop through the result set, building up $Collage and $TorrentTable
|
||||
@ -63,7 +47,7 @@ function compare($X, $Y){
|
||||
|
||||
foreach ($TorrentList as $GroupID=>$Group) {
|
||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
|
||||
list($GroupID2, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]);
|
||||
list($GroupID2, $Sort, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]);
|
||||
|
||||
// Handle stats and stuff
|
||||
$NumGroups++;
|
||||
@ -199,6 +183,10 @@ function compare($X, $Y){
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
</span>
|
||||
<? if(array_key_exists($TorrentID, $SnatchedTorrents)) {
|
||||
$Torrent['SnatchedTorrent'] = '1';
|
||||
}
|
||||
?>
|
||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
@ -310,6 +298,7 @@ function compare($X, $Y){
|
||||
<? if (count($TorrentList) > 0) { ?>
|
||||
<br /><br />
|
||||
<a href="bookmarks.php?action=remove_snatched&auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">[Remove Snatched]</a>
|
||||
<a href="bookmarks.php?action=edit&type=torrents">[Manage Torrents]</a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -341,7 +330,7 @@ function compare($X, $Y){
|
||||
$i++;
|
||||
if($i>5) { break; }
|
||||
?>
|
||||
<li><a href="torrents.php?taglist=<?=$TagName?>"><?=$TagName?></a> (<?=$Tag['count']?>)</li>
|
||||
<li><a href="torrents.php?taglist=<?=display_str($TagName)?>"><?=display_str($TagName)?></a> (<?=$Tag['count']?>)</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
@ -359,7 +348,7 @@ function compare($X, $Y){
|
||||
$i++;
|
||||
if($i>10) { break; }
|
||||
?>
|
||||
<li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=$Artist['count']?>)</li>
|
||||
<li><a href="artist.php?id=<?=$ID?>"><?=display_str($Artist['name'])?></a> (<?=$Artist['count']?>)</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
@ -414,4 +403,3 @@ function compare($X, $Y){
|
||||
<?
|
||||
View::show_footer();
|
||||
$Cache->cache_value('bookmarks_torrent_'.$UserID.'_full', serialize(array(array($TorrentList, $CollageDataList))), 3600);
|
||||
?>
|
||||
|
@ -108,19 +108,21 @@
|
||||
if($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
||||
?>
|
||||
<br />
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad" style="padding:20px 10px 10px 10px;">
|
||||
<div id="reply_box">
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad" style="padding:20px 10px 10px 10px;">
|
||||
<form class="send_form center" name="comment" id="quickpostform" action="" method="post">
|
||||
<input type="hidden" name="action" value="add_comment" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
|
||||
<div id="quickreplypreview" class="box" style="text-align: left; display: none; padding: 10px;"></div>
|
||||
<div id="quickreplytext">
|
||||
<textarea id="quickpost" name="body" cols="90" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input type="submit" value="Post reply" />
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
</form>
|
||||
<input type="hidden" name="action" value="add_comment" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
|
||||
<div id="quickreplypreview" class="box" style="text-align: left; display: none; padding: 10px;"></div>
|
||||
<div id="quickreplytext">
|
||||
<textarea id="quickpost" name="body" cols="90" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input type="submit" value="Post reply" />
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
@ -16,6 +16,14 @@ function compare($X, $Y){
|
||||
$CollageID = $_GET['id'];
|
||||
if(!is_number($CollageID)) { error(0); }
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
|
||||
$Data = $Cache->get_value('collage_'.$CollageID);
|
||||
|
||||
if($Data) {
|
||||
@ -244,6 +252,10 @@ function compare($X, $Y){
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
</span>
|
||||
<? if(array_key_exists($TorrentID, $SnatchedTorrents)) {
|
||||
$Torrent['SnatchedTorrent'] = '1';
|
||||
}
|
||||
?>
|
||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
|
@ -41,7 +41,7 @@
|
||||
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
|
||||
</div>
|
||||
<table width="100%" class="layout">
|
||||
<tr class="colhead"><td>Sorting</td></tr>
|
||||
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
|
||||
<tr>
|
||||
<td id="drag_drop_textnote">
|
||||
<ul>
|
||||
@ -51,7 +51,7 @@
|
||||
<li>Press <em>Save All Changes</em> when you are finished sorting.</li>
|
||||
<li>Press <em>Edit</em> or <em>Remove</em> to simply modify one entry.</li>
|
||||
</ul>
|
||||
<noscript><ul><li><strong class="important_text">Note: You cannot drag and drop while JavaScript is disabled.</strong></li></ul></noscript>
|
||||
<noscript><ul><li><strong class="important_text">Note: Enable JavaScript!</strong></li></ul></noscript>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -63,12 +63,12 @@
|
||||
<thead>
|
||||
<tr class="colhead">
|
||||
<th style="width:7%">Order</th>
|
||||
<th style="width:1%"><span><abbr title="Changes">Δ</abbr></span></th>
|
||||
<th style="width:1%"><span><abbr title="Current Rank">#</abbr></span></th>
|
||||
<th style="width:1%"><span>Year</span></th>
|
||||
<th style="width:15%"><span>Artist</span></th>
|
||||
<th><span>Torrent</span></th>
|
||||
<th style="width:1%"><span>User</span></th>
|
||||
<th style="width:1%; text-align: right" class="nobr"><abbr title="Modify an individual row.">Tweak</abbr></th>
|
||||
<th style="width:1%; text-align: right" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -101,10 +101,10 @@
|
||||
<input class="sort_numbers" type="text" name="sort" value="<?=$Sort?>" id="sort_<?=$GroupID?>" size="4" />
|
||||
</td>
|
||||
<td><?=$Number?></td>
|
||||
<td><?=$GroupYear?></td>
|
||||
<td><?=$DisplayName?> </td>
|
||||
<td><?=$TorrentLink?></td>
|
||||
<td class="nobr"><?=Users::format_username($UserID, $Username)?></td>
|
||||
<td><?=trim($GroupYear)?></td>
|
||||
<td><?=trim($DisplayName)?></td>
|
||||
<td><?=trim($TorrentLink)?></td>
|
||||
<td class="nobr"><?=Users::format_username($UserID, $Username, false, false, false)?></td>
|
||||
<td class="nobr">
|
||||
<input type="hidden" name="action" value="manage_handle" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
|
68
sections/comments/artistcomments.php
Normal file
68
sections/comments/artistcomments.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
$OtherLink = '';
|
||||
|
||||
$Title = 'Artist comments made by '.($Self?'you':$Username);
|
||||
$Header = 'Artist comments left by '.($Self?'you':format_username($UserID, false, false, false)).'';
|
||||
|
||||
$Comments = $DB->query("SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
ac.AuthorID,
|
||||
a.ArtistID,
|
||||
a.Name,
|
||||
ac.ID,
|
||||
ac.Body,
|
||||
ac.AddedTime,
|
||||
ac.EditedTime,
|
||||
ac.EditedUserID as EditorID
|
||||
|
||||
FROM artists_group as a
|
||||
JOIN artist_comments as ac ON ac.ArtistID = a.ArtistID
|
||||
|
||||
WHERE ac.AuthorId = $UserID
|
||||
|
||||
GROUP BY ac.ID
|
||||
|
||||
ORDER BY ac.AddedTime DESC
|
||||
|
||||
LIMIT $Limit;
|
||||
");
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
$Pages=get_pages($Page,$Results,$PerPage, 11);
|
||||
|
||||
$DB->set_query_id($Comments);
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
|
||||
|
||||
show_header($Title,'bbcode');
|
||||
$DB->set_query_id($Comments);
|
||||
|
||||
?><div class="thin">
|
||||
<div class="header">
|
||||
<h2><?=$Header?></h2>
|
||||
<? if ($OtherLink !== '') { ?>
|
||||
<div class="linkbox">
|
||||
<?=$OtherLink?>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
while(list($UserID, $ArtistID, $ArtistName, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
|
||||
$permalink = "artist.php?id=$ArtistID&postid=$PostID#post$PostID";
|
||||
$postheader = " on " . "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a>";
|
||||
|
||||
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $EditedTime);
|
||||
|
||||
} /* end while loop*/ ?>
|
||||
<div class="linkbox"><?= $Pages; ?></div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
show_footer();
|
||||
|
@ -1,23 +1,26 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
enforce_login();
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
if(!empty($_REQUEST['action'])) {
|
||||
if($_REQUEST['action'] == 'my_torrents') {
|
||||
$MyTorrents = true;
|
||||
}
|
||||
} else {
|
||||
$MyTorrents = false;
|
||||
}
|
||||
require(SERVER_ROOT.'/sections/comments/post.php'); // Post formatting function.
|
||||
|
||||
$action = '';
|
||||
if(!empty($_REQUEST['action']))
|
||||
$action = $_REQUEST['action'];
|
||||
|
||||
/**
|
||||
* Getting a userid if applicable
|
||||
*/
|
||||
if(isset($_GET['id'])) {
|
||||
$UserID = $_GET['id'];
|
||||
if(!is_number($UserID)) {
|
||||
if(!is_number($UserID))
|
||||
error(404);
|
||||
}
|
||||
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
|
||||
$Username = $UserInfo['Username'];
|
||||
if($LoggedUser['ID'] == $UserID) {
|
||||
$Self = true;
|
||||
@ -26,144 +29,32 @@
|
||||
}
|
||||
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||
$UserClass = $Perms['Class'];
|
||||
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID)) { error(403); }
|
||||
} else {
|
||||
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
|
||||
error(403);
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
$Username = $LoggedUser['Username'];
|
||||
$Self = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts per page limit stuff
|
||||
*/
|
||||
if (isset($LoggedUser['PostsPerPage'])) {
|
||||
$PerPage = $LoggedUser['PostsPerPage'];
|
||||
} else {
|
||||
$PerPage = POSTS_PER_PAGE;
|
||||
}
|
||||
|
||||
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||
$OtherLink = '';
|
||||
|
||||
if($MyTorrents) {
|
||||
$Conditions = "WHERE t.UserID = $UserID AND tc.AuthorID != t.UserID AND tc.AddedTime > t.Time";
|
||||
$Title = 'Comments left on your torrents';
|
||||
$Header = 'Comments left on your uploads';
|
||||
if($Self) $OtherLink = '<a href="comments.php">Display comments you\'ve made</a>';
|
||||
}
|
||||
else {
|
||||
$Conditions = "WHERE tc.AuthorID = $UserID";
|
||||
$Title = 'Comments made by '.($Self?'you':$Username);
|
||||
$Header = 'Torrent comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).'';
|
||||
if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>';
|
||||
switch($action) {
|
||||
case 'artists':
|
||||
require (SERVER_ROOT.'/sections/comments/artistcomments.php');
|
||||
break;
|
||||
case 'torrents':
|
||||
case 'my_torrents':
|
||||
default:
|
||||
require(SERVER_ROOT.'/sections/comments/torrentcomments.php');
|
||||
break;
|
||||
}
|
||||
|
||||
$Comments = $DB->query("SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
tc.AuthorID,
|
||||
t.ID,
|
||||
t.GroupID,
|
||||
tg.Name,
|
||||
tc.ID,
|
||||
tc.Body,
|
||||
tc.AddedTime,
|
||||
tc.EditedTime,
|
||||
tc.EditedUserID as EditorID
|
||||
|
||||
FROM torrents as t
|
||||
JOIN torrents_comments as tc ON tc.GroupID = t.GroupID
|
||||
JOIN torrents_group as tg ON t.GroupID = tg.ID
|
||||
|
||||
$Conditions
|
||||
|
||||
GROUP BY tc.ID
|
||||
|
||||
ORDER BY tc.AddedTime DESC
|
||||
|
||||
LIMIT $Limit;
|
||||
");
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
$Pages=Format::get_pages($Page,$Results,$PerPage, 11);
|
||||
|
||||
$DB->set_query_id($Comments);
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
|
||||
$Artists = Artists::get_artists($GroupIDs);
|
||||
|
||||
View::show_header($Title,'bbcode');
|
||||
$DB->set_query_id($Comments);
|
||||
|
||||
?><div class="thin">
|
||||
<div class="header">
|
||||
<h2><?=$Header?></h2>
|
||||
<? if ($OtherLink !== '') { ?>
|
||||
<div class="linkbox">
|
||||
<?=$OtherLink?>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href="torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||
by <strong><?=Users::format_username($UserID, true, true, true, true, false)?></strong> <?=time_diff($AddedTime) ?>
|
||||
on <?=Artists::display_artists($Artists[$GroupID])?><a href="torrents.php?id=<?=$GroupID?>"><?=$Title?></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
if(empty($HeavyInfo['DisableAvatars'])) {
|
||||
?>
|
||||
<td class="avatar" valign="top">
|
||||
<?
|
||||
if($UserInfo['Avatar']){
|
||||
?>
|
||||
<img src="<?=$UserInfo['Avatar']?>" width="150" alt="<?=$UserInfo['Username']?>'s avatar" />
|
||||
<?
|
||||
} else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<td class="body" valign="top">
|
||||
<?=$Text->full_format($Body) ?>
|
||||
<?
|
||||
if($EditorID){
|
||||
?>
|
||||
<br /><br />
|
||||
Last edited by
|
||||
<?=Users::format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="linkbox">
|
||||
<?
|
||||
echo $Pages;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
|
||||
?>
|
||||
|
50
sections/comments/post.php
Normal file
50
sections/comments/post.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Prints a table that contains a comment on something
|
||||
*
|
||||
* @param $UserID UserID of the guy/gal who posted the comment
|
||||
* @param $PostID The post number
|
||||
* @param $postheader the header used in the post.
|
||||
* @param $permalink the link to the post elsewhere on the site (torrents.php)
|
||||
* @param $Body the post body
|
||||
* @param $EditorID the guy who last edited the post
|
||||
* @param $EditedTime time last edited
|
||||
* @returns void, prints output
|
||||
*/
|
||||
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
|
||||
global $Text;
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
$postheader = "by <strong>" . Users::format_username($UserID, true, true, true, true, false) . "</strong> "
|
||||
. time_diff($AddedTime) . $postheader;
|
||||
|
||||
?>
|
||||
<table class='forum_post box vertical_margin<?=$noavatar ? ' noavatar' : ''?>' id="post<?=$PostID?>">
|
||||
<tr class='colhead_dark'>
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='<?=$permalink ?>'>#<?=$PostID?></a>
|
||||
<?=$postheader ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<? if(empty($UserInfo['DisableAvatars'])) { ?>
|
||||
<td class='avatar' valign="top">
|
||||
<? if($UserInfo['Avatar']){ ?>
|
||||
<img src='<?=$UserInfo['Avatar']?>' width='150' alt="<?=$UserInfo['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<? } ?>
|
||||
<td class='body' valign="top">
|
||||
<?=$Text->full_format($Body) ?>
|
||||
<? if($EditorID){ ?>
|
||||
<br /><br />
|
||||
Last edited by
|
||||
<?=Users::format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
|
||||
<? } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? }
|
93
sections/comments/torrentcomments.php
Normal file
93
sections/comments/torrentcomments.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
if(!empty($_REQUEST['action'])) {
|
||||
if($_REQUEST['action'] == 'my_torrents') {
|
||||
$MyTorrents = true;
|
||||
} elseif ($_REQUEST['action'] == 'torrents') {
|
||||
$MyTorrents = false;
|
||||
} else {
|
||||
error(404);
|
||||
}
|
||||
} else {
|
||||
$MyTorrents = false;
|
||||
}
|
||||
|
||||
$OtherLink = '';
|
||||
|
||||
if($MyTorrents) {
|
||||
$Conditions = "WHERE t.UserID = $UserID AND tc.AuthorID != t.UserID AND tc.AddedTime > t.Time";
|
||||
$Title = 'Comments left on your torrents';
|
||||
$Header = 'Comments left on your uploads';
|
||||
if($Self) $OtherLink = '<a href="comments.php?action=torrents">Display comments you\'ve made</a>';
|
||||
}
|
||||
else {
|
||||
$Conditions = "WHERE tc.AuthorID = $UserID";
|
||||
$Title = 'Comments made by '.($Self?'you':$Username);
|
||||
$Header = 'Torrent comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).'';
|
||||
if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>';
|
||||
}
|
||||
|
||||
$Comments = $DB->query("SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
tc.AuthorID,
|
||||
t.ID,
|
||||
t.GroupID,
|
||||
tg.Name,
|
||||
tc.ID,
|
||||
tc.Body,
|
||||
tc.AddedTime,
|
||||
tc.EditedTime,
|
||||
tc.EditedUserID as EditorID
|
||||
|
||||
FROM torrents as t
|
||||
JOIN torrents_comments as tc ON tc.GroupID = t.GroupID
|
||||
JOIN torrents_group as tg ON t.GroupID = tg.ID
|
||||
|
||||
$Conditions
|
||||
|
||||
GROUP BY tc.ID
|
||||
|
||||
ORDER BY tc.AddedTime DESC
|
||||
|
||||
LIMIT $Limit;
|
||||
");
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
$Pages=Format::get_pages($Page,$Results,$PerPage, 11);
|
||||
|
||||
$DB->set_query_id($Comments);
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
|
||||
$Artists = Artists::get_artists($GroupIDs);
|
||||
|
||||
View::show_header($Title,'bbcode');
|
||||
$DB->set_query_id($Comments);
|
||||
|
||||
?><div class="thin">
|
||||
<div class="header">
|
||||
<h2><?=$Header?></h2>
|
||||
<? if ($OtherLink !== '') { ?>
|
||||
<div class="linkbox">
|
||||
<?=$OtherLink?>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
|
||||
$permalink = "torrents.php?id=$GroupID&postid=$PostID#post$PostID";
|
||||
$postheader = " on " . Artists::display_artists($Artists[$GroupID]) . " <a href=\"torrents.php?id=$GroupID?>\">$Title</a>";
|
||||
|
||||
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
|
||||
|
||||
} /* end while loop*/ ?>
|
||||
<div class="linkbox"><?= $Pages; ?></div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
$Depth = $_GET['depth'];
|
||||
|
||||
if(empty($_GET['type']) || !in_array($_GET['type'], array('forums', 'collages', 'requests', 'torrents'))) {
|
||||
if(empty($_GET['type']) || !in_array($_GET['type'], array('forums', 'collages', 'requests', 'torrents', 'artist'))) {
|
||||
die();
|
||||
}
|
||||
$Type = $_GET['type'];
|
||||
@ -48,6 +48,7 @@
|
||||
break;
|
||||
case 'collages' :
|
||||
case 'requests' :
|
||||
case 'artist' :
|
||||
case 'torrents' :
|
||||
$DB->query("SELECT Body
|
||||
FROM ".$Type."_comments
|
||||
|
@ -10,8 +10,9 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false) {
|
||||
COUNT(fp.id) AS Posts,
|
||||
t.LastPostAuthorID,
|
||||
ISNULL(p.TopicID) AS NoPoll,
|
||||
t.StickyPostID
|
||||
FROM forums_topics AS t
|
||||
t.StickyPostID,
|
||||
t.AuthorID as OP
|
||||
FROM forums_topics AS t
|
||||
JOIN forums_posts AS fp ON fp.TopicID = t.ID
|
||||
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
||||
WHERE t.ID = '$ThreadID'
|
||||
|
54
sections/forums/quote_notify.php
Normal file
54
sections/forums/quote_notify.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$Matches = array();
|
||||
preg_match_all('/\[quote(.*?)]|\[\/quote]/', $Body, $Matches);
|
||||
|
||||
if (array_key_exists(0, $Matches)) {
|
||||
$Usernames = array();
|
||||
$Level = 0;
|
||||
foreach ($Matches[0] as $M) {
|
||||
if ($M != '[/quote]') {
|
||||
if ($Level == 0) {
|
||||
add_username($M);
|
||||
}
|
||||
$Level++;
|
||||
} else {
|
||||
$Level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
//remove any dupes in the array
|
||||
$Usernames = array_unique($Usernames);
|
||||
|
||||
$DB->query("SELECT m.ID FROM users_main AS m
|
||||
JOIN users_info AS i ON i.UserID = m.ID WHERE m.Username IN " . "('" . implode("', '", $Usernames)
|
||||
. "')
|
||||
AND i.NotifyOnQuote = '1' AND i.UserID != $LoggedUser[ID]");
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$QuoterID = db_string($LoggedUser['ID']);
|
||||
$UserID = db_string($UserID);
|
||||
$ForumID = db_string($ForumID);
|
||||
$TopicID = db_string($TopicID);
|
||||
$PostID = db_string($PostID);
|
||||
$DB->query("INSERT INTO users_notify_quoted (UserID, QuoterID, ForumID, TopicID, PostID, Date)
|
||||
VALUES ('$UserID', '$QuoterID', '$ForumID', '$TopicID', '$PostID', '" . sqltime() . "')");
|
||||
$Cache->delete_value('forums_quotes_' . $UserID);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the username and add it into the $Usernames array
|
||||
*/
|
||||
function add_username($Str) {
|
||||
global $Usernames;
|
||||
$Matches = array();
|
||||
if (preg_match('/\[quote=(.*)]/', $Str, $Matches)) {
|
||||
$Username = $Matches[1];
|
||||
$Username = trim($Username);
|
||||
if (strlen($Username) > 0 && !preg_match('/[^a-zA-Z0-9|]/i', $Username)) {
|
||||
$Exploded = explode('|', $Username);
|
||||
$Username = $Exploded[0];
|
||||
$Username = preg_replace('/(^[.,]*)|([.,]*$)/', '', $Username);
|
||||
$Usernames[] = $Username;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -232,6 +232,6 @@
|
||||
$Cache->delete_value('subscriptions_user_new_'.$Subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
include('quote_notify.php');
|
||||
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.ceil($ThreadInfo['Posts']/$PerPage));
|
||||
die();
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php');
|
||||
|
||||
$Text = new TEXT;
|
||||
$Text = new TEXT(true);
|
||||
|
||||
// Check for lame SQL injection attempts
|
||||
if(!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
|
||||
@ -137,8 +137,10 @@
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
|
||||
$DB->query("UPDATE users_notify_quoted SET Unread = '0' WHERE UserID = '$LoggedUser[ID]' AND TopicID = '$ThreadID'");
|
||||
|
||||
// Start printing
|
||||
View::show_header('Forums'.' > '.$Forums[$ForumID]['Name'].' > '.$ThreadInfo['Title'],'comments,subscriptions,bbcode');
|
||||
View::show_header($ThreadInfo['Title'] . ' < '.$Forums[$ForumID]['Name'].' < '. 'Forums','comments,subscriptions,bbcode,jquery');
|
||||
?>
|
||||
<div class="thin">
|
||||
<h2>
|
||||
@ -383,7 +385,7 @@
|
||||
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));
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?>" id="post<?=$PostID?>">
|
||||
<table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?> <? if($ThreadInfo['OP'] == $AuthorID) { echo "important_user"; }?> id="post<?=$PostID?>">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<div style="float:left;"><a class="post_id" href="forums.php?action=viewthread&threadid=<?=$ThreadID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||
@ -472,56 +474,64 @@
|
||||
//TODO: Preview, come up with a standard, make it look like post or just a block of formatted BBcode, but decide and write some proper XHTML
|
||||
?>
|
||||
<br />
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad">
|
||||
<table id="quickreplypreview" class="forum_post box vertical_margin hidden" style="text-align:left;">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
<div id="reply_box">
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad">
|
||||
<table id="quickreplypreview" class="forum_post box vertical_margin hidden" style="text-align:left;">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?> Just now
|
||||
</span>
|
||||
<span id="barpreview" style="float:right;">
|
||||
<a href="#quickreplypreview">[Report Post]</a>
|
||||
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
<span id="barpreview" style="float:right;">
|
||||
<a href="#quickreplypreview">[Report Post]</a>
|
||||
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class="send_form center" name="reply" id="quickpostform" action="" <? if(!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled=true;" <? } ?> method="post">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="thread" value="<?=$ThreadID?>" />
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="thread" value="<?=$ThreadID?>" />
|
||||
|
||||
<div id="quickreplytext">
|
||||
<textarea id="quickpost" style="width: 95%;" tabindex="1" onkeyup="resize('quickpost');" name="body" cols="90" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<div>
|
||||
<div id="quickreplytext">
|
||||
<textarea id="quickpost" style="width: 95%;" tabindex="1" onkeyup="resize('quickpost');" name="body" cols="90" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<div>
|
||||
<? if(!in_array($ThreadID, $UserSubscriptions)) { ?>
|
||||
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> tabindex="2" />
|
||||
<label for="subscribebox">Subscribe</label>
|
||||
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> tabindex="2" />
|
||||
<label for="subscribebox">Subscribe</label>
|
||||
<?
|
||||
}
|
||||
if($ThreadInfo['LastPostAuthorID']==$LoggedUser['ID'] && (check_perms('site_forums_double_post') || in_array($ForumID, $ForumsDoublePost))) {
|
||||
?>
|
||||
<input id="mergebox" type="checkbox" name="merge" tabindex="2" />
|
||||
<label for="mergebox">Merge</label>
|
||||
<input id="mergebox" type="checkbox" name="merge" tabindex="2" />
|
||||
<label for="mergebox">Merge</label>
|
||||
<? } ?>
|
||||
<input id="post_preview" type="button" value="Preview" tabindex="1" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" tabindex="1" />
|
||||
</div>
|
||||
<?
|
||||
if (!$LoggedUser['DisableAutoSave']) {
|
||||
?>
|
||||
<script type="application/javascript">new StoreText('quickpost', 'quickpostform');</script>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?
|
||||
include(SERVER_ROOT.'/classes/class_text.php');
|
||||
|
||||
$Text = new TEXT;
|
||||
$Text = new TEXT(true);
|
||||
|
||||
if (!$News = $Cache->get_value('news')) {
|
||||
$DB->query("SELECT
|
||||
|
@ -98,7 +98,17 @@
|
||||
"Such as posts containing racism, offensive language, flaming, pornography, and other rules violations.",
|
||||
"We encourage all users to use this feature when they see a rules violation of any form.",
|
||||
"This will get quicker action than PMing a staff member will.",
|
||||
"Please restrict the use of this feature to reporting rules violations, and remember, this is for reporting comments, not replying to them."
|
||||
"Please restrict the use of this feature to reporting Rules violations, and remember, this is for reporting comments, not replying to them."
|
||||
)
|
||||
),
|
||||
"artist_comment" => array(
|
||||
"title" => "Artist Comment",
|
||||
"guidelines" => array(
|
||||
"The Report comment option is specifically for reporting when the Chat Rules have been broken.",
|
||||
"Such as posts containing racism, offensive language, flaming, pornography, and other rules violations.",
|
||||
"We encourage all users to use this feature when they see a rules violation of any form.",
|
||||
"This will get quicker action than PMing a staff member will.",
|
||||
"Please restrict the use of this feature to reporting Rules violations, and remember, this is for reporting comments, not replying to them."
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -84,7 +84,8 @@
|
||||
break;
|
||||
|
||||
case "requests_comment" :
|
||||
case "torrents_comment" :
|
||||
case "torrents_comment" :
|
||||
case "artist_comment":
|
||||
case "collages_comment" :
|
||||
$Table = $Short.'s';
|
||||
if($Short == "collages_comment") {
|
||||
@ -252,7 +253,8 @@
|
||||
<?
|
||||
break;
|
||||
case "requests_comment" :
|
||||
case "torrents_comment" :
|
||||
case "torrents_comment" :
|
||||
case "artist_comment":
|
||||
case "collages_comment" :
|
||||
?>
|
||||
<p>You are reporting the <?=$Types[$Short]['title']?>:</p>
|
||||
|
@ -41,7 +41,7 @@
|
||||
$Where .= " AND Type = 'request_update'";
|
||||
}
|
||||
if(check_perms('site_moderate_forums')) {
|
||||
$Where .= " AND Type IN('collages_comment', 'Post', 'requests_comment', 'thread', 'torrents_comment')";
|
||||
$Where .= " AND Type IN('collages_comment', 'Post', 'requests_comment', 'thread', 'torrents_comment', 'torrent_comments')";
|
||||
}
|
||||
|
||||
}
|
||||
@ -179,7 +179,18 @@
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
echo "<a href='torrents.php?id=".$GroupID."&page=".$PageNum."#post".$ThingID."'>TORRENT COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
case "artist_comment" :
|
||||
$DB->query("SELECT ac.ArtistID, ac.Body, (SELECT COUNT(ID) FROM artist_comments WHERE ID <= ".$ThingID." AND artist_comments.ArtistID = ac.ArtistID) AS CommentNum FROM artist_comments AS ac WHERE ID=".$ThingID);
|
||||
if($DB->record_count() < 1) {
|
||||
echo "No comment with the reported ID found";
|
||||
} else {
|
||||
list($ArtistID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
echo "<a href='artist.php?id=".$ArtistID."&page=".$PageNum."#post".$ThingID."'>COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
|
||||
case "collages_comment" :
|
||||
$DB->query("SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$ThingID." AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID=".$ThingID);
|
||||
if($DB->record_count() < 1) {
|
||||
|
@ -99,12 +99,12 @@
|
||||
<? } else { ?>
|
||||
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Bookmark('request', <?=$RequestID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
|
||||
<? } ?>
|
||||
<a href="reports.php?action=report&type=request&id=<?=$RequestID?>">[Report request]</a>
|
||||
<a href="reports.php?action=report&type=request&id=<?=$RequestID?>">[Report Request]</a>
|
||||
<? if(!$IsFilled) { ?>
|
||||
<a href="upload.php?requestid=<?=$RequestID?><?=($GroupID?"&groupid=$GroupID":'')?>">[Upload request]</a>
|
||||
<a href="upload.php?requestid=<?=$RequestID?><?=($GroupID?"&groupid=$GroupID":'')?>">[Upload Request]</a>
|
||||
<? }
|
||||
if(!$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))) { ?>
|
||||
<a href="reports.php?action=report&type=request_update&id=<?=$RequestID?>">[Requestsv2 update]</a>
|
||||
<a href="reports.php?action=report&type=request_update&id=<?=$RequestID?>">[Request Update]</a>
|
||||
<? } ?>
|
||||
|
||||
<?
|
||||
@ -116,11 +116,11 @@
|
||||
$encoded_artist = urlencode($encoded_artist);
|
||||
|
||||
$worldcat_url = "http://worldcat.org/search?q=" . $encoded_artist . " " . $encoded_title;
|
||||
$google_url = "https://www.google.com/search?&tbm=shop&q=" . $encoded_artist . " " . $encoded_title;
|
||||
$google_url = "https://www.google.com/search?&tbm=shop&q=" . $encoded_artist . " " . $encoded_title;
|
||||
|
||||
?>
|
||||
<a href="<? echo $worldcat_url; ?>">[Find in library]</a>
|
||||
<a href="<? echo $google_url; ?>">[Find in stores]</a>
|
||||
<a href="<? echo $worldcat_url; ?>">[Find in Library]</a>
|
||||
<a href="<? echo $google_url; ?>">[Find in Stores]</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
@ -234,7 +234,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box box_votes">
|
||||
<div class="head"><strong>Top contributors</strong></div>
|
||||
<div class="head"><strong>Top Contributors</strong></div>
|
||||
<table class="layout">
|
||||
<? $VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
|
||||
$ViewerVote = false;
|
||||
@ -285,7 +285,7 @@
|
||||
<? if($CategoryName == "Music") {
|
||||
if(!empty($RecordLabel)) { ?>
|
||||
<tr>
|
||||
<td class="label">Record label</td>
|
||||
<td class="label">Record Label</td>
|
||||
<td>
|
||||
<?=$RecordLabel?>
|
||||
</td>
|
||||
@ -293,39 +293,39 @@
|
||||
<? }
|
||||
if(!empty($CatalogueNumber)) { ?>
|
||||
<tr>
|
||||
<td class="label">Catalogue number</td>
|
||||
<td class="label">Catalogue Number</td>
|
||||
<td>
|
||||
<?=$CatalogueNumber?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr>
|
||||
<td class="label">Release type</td>
|
||||
<td class="label">Release Type</td>
|
||||
<td>
|
||||
<?=$ReleaseName?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Acceptable bitrates</td>
|
||||
<td class="label">Acceptable Bitrates</td>
|
||||
<td>
|
||||
<?=$BitrateString?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Acceptable formats</td>
|
||||
<td class="label">Acceptable Formats</td>
|
||||
<td>
|
||||
<?=$FormatString?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Acceptable media</td>
|
||||
<td class="label">Acceptable Media</td>
|
||||
<td>
|
||||
<?=$MediaString?>
|
||||
</td>
|
||||
</tr>
|
||||
<? if(!empty($LogCue)) { ?>
|
||||
<tr>
|
||||
<td class="label">Required FLAC-only extras</td>
|
||||
<td class="label">Required FLAC only extra(s)</td>
|
||||
<td>
|
||||
<?=$LogCue?>
|
||||
</td>
|
||||
@ -358,8 +358,8 @@
|
||||
$GroupLink = Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$GroupID.'">'.$Group['Name'].'</a>';*/
|
||||
?>
|
||||
<tr>
|
||||
<td class="label">Torrent group</td>
|
||||
<td><a href="torrents.php?id=<?=$GroupID?>">torrents.php?id=<?=$GroupID?></a></td>
|
||||
<td class="label">Torrent Group</td>
|
||||
<td><a href="torrents.php?id=<?=$GroupID?>">torrents.php?id=<?=$GroupID?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr>
|
||||
@ -374,7 +374,7 @@
|
||||
</tr>
|
||||
<? if ($LastVote > $TimeAdded) { ?>
|
||||
<tr>
|
||||
<td class="label">Last voted</td>
|
||||
<td class="label">Last Voted</td>
|
||||
<td>
|
||||
<?=time_diff($LastVote)?>
|
||||
</td>
|
||||
@ -570,43 +570,45 @@
|
||||
<?
|
||||
if(!$LoggedUser['DisablePosting']) { ?>
|
||||
<br />
|
||||
<h3>Post comment</h3>
|
||||
<div class="box pad" style="padding:20px 10px 10px 10px;">
|
||||
<table id="quickreplypreview" class="hidden forum_post box vertical_margin" id="preview">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
|
||||
<a href="#quickreplypreview">[Report comment]</a>
|
||||
</span>
|
||||
<span style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="reply_box">
|
||||
<h3>Post comment</h3>
|
||||
<div class="box pad" style="padding:20px 10px 10px 10px;">
|
||||
<table id="quickreplypreview" class="hidden forum_post box vertical_margin" id="preview">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?> Just now
|
||||
<a href="#quickreplypreview">[Report Comment]</a>
|
||||
</span>
|
||||
<span style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class="send_form center" name="reply" id="quickpostform" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<div id="quickreplytext">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="requestid" value="<?=$RequestID?>" />
|
||||
<textarea id="quickpost" name="body" cols="70" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" />
|
||||
</form>
|
||||
<div id="quickreplytext">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="requestid" value="<?=$RequestID?>" />
|
||||
<textarea id="quickpost" name="body" cols="70" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
|
@ -142,6 +142,9 @@
|
||||
if(!check_perms('admin_manage_news')){ error(403); }
|
||||
|
||||
$DB->query("INSERT INTO news (UserID, Title, Body, Time) VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')");
|
||||
|
||||
|
||||
|
||||
$Cache->cache_value('news_latest_id', $DB->inserted_id(), 0);
|
||||
$Cache->delete_value('news');
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
$DB->query("UPDATE news SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['newsid'])."'");
|
||||
$Cache->delete_value('news');
|
||||
$Cache->delete_value('feed_news');
|
||||
|
||||
}
|
||||
header('Location: index.php');
|
||||
break;
|
||||
|
@ -11,6 +11,7 @@
|
||||
<a href="top10.php?type=users">[Users]</a>
|
||||
<a href="top10.php?type=tags">[Tags]</a>
|
||||
<a href="top10.php?type=history">[History]</a>
|
||||
<a href="top10.php?type=votes">[Favorites]</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pad box">
|
||||
|
@ -26,6 +26,9 @@
|
||||
case 'history' :
|
||||
include(SERVER_ROOT.'/sections/top10/history.php');
|
||||
break;
|
||||
/*case 'votes' :
|
||||
include(SERVER_ROOT.'/sections/top10/votes.php');
|
||||
break;*/
|
||||
default :
|
||||
error(404);
|
||||
break;
|
||||
|
@ -19,7 +19,9 @@
|
||||
<a href="top10.php?type=torrents">[Torrents]</a>
|
||||
<a href="top10.php?type=users">[Users]</a>
|
||||
<a href="top10.php?type=tags"><strong>[Tags]</strong></a>
|
||||
</div>
|
||||
<!-- <a href="top10.php?type=votes">[Favorites]</a>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?
|
||||
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
|
||||
|
||||
$Where = array();
|
||||
|
||||
if(!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
|
||||
@ -38,6 +40,7 @@
|
||||
$Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
|
||||
}
|
||||
$Filtered = !empty($Where);
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
View::show_header('Top '.$Limit.' Torrents');
|
||||
?>
|
||||
<div class="thin">
|
||||
@ -47,6 +50,8 @@
|
||||
<a href="top10.php?type=torrents"><strong>[Torrents]</strong></a>
|
||||
<a href="top10.php?type=users">[Users]</a>
|
||||
<a href="top10.php?type=tags">[Tags]</a>
|
||||
<!-- <a href="top10.php?type=votes">[Favorites]</a>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
@ -62,6 +67,12 @@
|
||||
<input type="text" name="tags" size="75" value="<? if(!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall']!='any'?' checked':'')?>><label for="rdoAll"> All</label>
|
||||
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall']=='any'?' checked':'')?>><label for="rdoAny"> Any</label>
|
||||
</td>
|
||||
<tr>
|
||||
<td class="label">Format</td>
|
||||
<td>
|
||||
@ -116,7 +127,11 @@
|
||||
</div>
|
||||
<?
|
||||
|
||||
$Where = implode(' AND ', $Where);
|
||||
if ($_GET['anyall'] == 'any') {
|
||||
$Where = '('.implode(' OR ', $Where).')';
|
||||
} else {
|
||||
$Where = implode(' AND ', $Where);
|
||||
}
|
||||
|
||||
$WhereSum = (empty($Where)) ? '' : md5($Where);
|
||||
$BaseQuery = "SELECT
|
||||
@ -329,7 +344,7 @@
|
||||
|
||||
// generate a table based on data from most recent query to $DB
|
||||
function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
global $LoggedUser,$Categories,$ReleaseTypes;
|
||||
global $LoggedUser,$Categories,$ReleaseTypes, $SnatchedTorrents;
|
||||
?>
|
||||
<h3>Top <?=$Limit.' '.$Caption?>
|
||||
<? if(empty($_GET['advanced'])){ ?>
|
||||
@ -421,7 +436,6 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
if($GroupCategoryID==1 && $ReleaseType > 0) {
|
||||
$DisplayName.= ' ['.$ReleaseTypes[$ReleaseType].']';
|
||||
}
|
||||
|
||||
// append extra info to torrent title
|
||||
$ExtraInfo='';
|
||||
$AddExtra='';
|
||||
@ -434,10 +448,13 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
|
||||
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
|
||||
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
|
||||
if(array_key_exists($TorrentID, $SnatchedTorrents)) { $ExtraInfo.=' / <strong>Snatched!</strong>'; }
|
||||
if($ExtraInfo!='') {
|
||||
$ExtraInfo = "- [$ExtraInfo]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$TagList=array();
|
||||
|
||||
$PrimaryTag = '';
|
||||
@ -454,7 +471,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
|
||||
// print row
|
||||
?>
|
||||
<tr class="torrent row<?=$Highlight?>">
|
||||
<tr class="torrent row<?=$Highlight?> <? has_bookmarked('torrent', $GroupID) ? "bookmarked" : ""?>">
|
||||
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
|
||||
<?
|
||||
//fix array offset php error
|
||||
@ -465,7 +482,20 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCatOffset]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div></td>
|
||||
<td>
|
||||
<span>[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]</span>
|
||||
|
||||
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
|
||||
<span class="bookmark" style="float:right;">
|
||||
<?
|
||||
if(has_bookmarked('torrent', $GroupID)) {
|
||||
?>
|
||||
<a href="#" class="bookmarklink_torrent_<?=$GroupID?>" onclick="Unbookmark('torrent', <?=$GroupID?>,'Bookmark');return false;">Remove Bookmark</a>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<a href="#" class="bookmarklink_torrent_<?=$GroupID?>" onclick="Bookmark('torrent', <?=$GroupID?>,'Remove Bookmark');return false;">Bookmark</a>
|
||||
<? }?>
|
||||
</span>
|
||||
|
||||
<?=$TorrentTags?>
|
||||
</td>
|
||||
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
|
||||
|
@ -19,6 +19,8 @@
|
||||
<a href="top10.php?type=torrents">[Torrents]</a>
|
||||
<a href="top10.php?type=users"><strong>[Users]</strong></a>
|
||||
<a href="top10.php?type=tags">[Tags]</a>
|
||||
<!-- <a href="top10.php?type=votes">[Favorites]</a>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
370
sections/top10/votes.php
Normal file
370
sections/top10/votes.php
Normal file
@ -0,0 +1,370 @@
|
||||
<?
|
||||
// We need these to do our rankification
|
||||
include(SERVER_ROOT.'/sections/torrents/ranking_funcs.php');
|
||||
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
|
||||
|
||||
if(!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
|
||||
$Details = 'all';
|
||||
$Limit = 10;
|
||||
|
||||
if($_GET['tags']) {
|
||||
$Tags = explode(',', str_replace(".","_",trim($_GET['tags'])));
|
||||
foreach ($Tags as $Tag) {
|
||||
$Tag = preg_replace('/[^a-z0-9_]/', '', $Tag);
|
||||
if($Tag != '') {
|
||||
$Where[]="g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
|
||||
}
|
||||
}
|
||||
}
|
||||
$Year1 = (int)$_GET['year1'];
|
||||
$Year2 = (int)$_GET['year2'];
|
||||
if ($Year1 > 0 && $Year2 <= 0) {
|
||||
$Where[] = "g.Year = $Year1";
|
||||
} elseif ($Year1 > 0 && $Year2 > 0) {
|
||||
$Where[] = "g.Year BETWEEN $Year1 AND $Year2";
|
||||
} elseif ($Year2 > 0 && $Year1 <= 0) {
|
||||
$Where[] = "g.Year <= $Year2";
|
||||
}
|
||||
} else {
|
||||
$Details = 'all';
|
||||
// defaults to 10 (duh)
|
||||
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
|
||||
$Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
|
||||
}
|
||||
$Filtered = !empty($Where);
|
||||
|
||||
|
||||
$Where = implode(' AND ', $Where);
|
||||
$WhereSum = (empty($Where)) ? '' : md5($Where);
|
||||
|
||||
// Unlike the other top 10s, this query just gets some raw stats
|
||||
// We'll need to do some fancy-pants stuff to translate it into
|
||||
// BPCI scores before getting the torrent data
|
||||
$Query = "SELECT v.GroupID
|
||||
FROM torrents_votes AS v";
|
||||
if (!empty($Where)) {
|
||||
$Query .= " JOIN torrents_group AS g ON g.ID = v.GroupID
|
||||
WHERE $Where AND ";
|
||||
} else {
|
||||
$Query .= " WHERE ";
|
||||
}
|
||||
$Query .= "Score > 0 ORDER BY Score DESC LIMIT $Limit";
|
||||
|
||||
$TopVotes = $Cache->get_value('top10votes_'.$Limit.$WhereSum);
|
||||
if ($TopVotes === false) {
|
||||
if (true || $Cache->get_query_lock('top10votes')) {
|
||||
$DB->query($Query);
|
||||
|
||||
$Results = $DB->collect('GroupID');
|
||||
$Groups = Torrents::get_groups($Results);
|
||||
if (count($Results) > 0) {
|
||||
$DB->query('SELECT ID, CategoryID FROM torrents_group
|
||||
WHERE ID IN ('.implode(',', $Results).')');
|
||||
$Cats = $DB->to_array('ID');
|
||||
}
|
||||
// Make sure it's still in order.
|
||||
$TopVotes = array();
|
||||
foreach ($Results as $GroupID) {
|
||||
$TopVotes[$GroupID] = $Groups['matches'][$GroupID];
|
||||
$TopVotes[$GroupID]['CategoryID'] = $Cats[$GroupID]['CategoryID'];
|
||||
}
|
||||
|
||||
$Cache->cache_value('top10votes_'.$Limit.$WhereSum,$TopVotes,60*30);
|
||||
$Cache->clear_query_lock('top10votes');
|
||||
} else {
|
||||
$TopVotes = false;
|
||||
}
|
||||
}
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
View::show_header('Top '.$Limit.' Voted Groups','browse');
|
||||
?>
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>Top <?=$Limit?> Voted Groups</h2>
|
||||
<div class="linkbox">
|
||||
<a href="top10.php?type=torrents">[Torrents]</a>
|
||||
<a href="top10.php?type=users">[Users]</a>
|
||||
<a href="top10.php?type=tags">[Tags]</a>
|
||||
<a href="top10.php?type=votes"><strong>[Favorites]</strong></a>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
if(check_perms('site_advanced_top10')) { ?>
|
||||
<form class="search_form" name="votes" action="" method="get">
|
||||
<input type="hidden" name="advanced" value="1" />
|
||||
<input type="hidden" name="type" value="votes" />
|
||||
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
|
||||
<tr>
|
||||
<td class="label">Tags (comma-separated):</td>
|
||||
<td>
|
||||
<input type="text" name="tags" size="75" value="<? if(!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Year:</td>
|
||||
<td>
|
||||
<input type="text" name="year1" size="4" value="<? if(!empty($_GET['year1'])) { echo display_str($_GET['year1']);} ?>" />
|
||||
to
|
||||
<input type="text" name="year2" size="4" value="<? if(!empty($_GET['year2'])) { echo display_str($_GET['year2']);} ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="center">
|
||||
<input type="submit" value="Filter torrents" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
|
||||
$Bookmarks = all_bookmarks('torrent');
|
||||
?>
|
||||
<h3>Top <?=$Limit.' '.$Caption?>
|
||||
<?
|
||||
if(empty($_GET['advanced'])){ ?>
|
||||
<small>
|
||||
<?
|
||||
switch($Limit) {
|
||||
case 100: ?>
|
||||
- [<a href="top10.php?type=votes">Top 10</a>]
|
||||
- [Top 100]
|
||||
- [<a href="top10.php?type=votes&limit=250">Top 250</a>]
|
||||
<? break;
|
||||
case 250: ?>
|
||||
- [<a href="top10.php?type=votes">Top 10</a>]
|
||||
- [<a href="top10.php?type=votes&limit=100">Top 100</a>]
|
||||
- [Top 250]
|
||||
<? break;
|
||||
default: ?>
|
||||
- [Top 10]
|
||||
- [<a href="top10.php?type=votes&limit=100">Top 100</a>]
|
||||
- [<a href="top10.php?type=votes&limit=250">Top 250</a>]
|
||||
<? } ?>
|
||||
</small>
|
||||
<?
|
||||
} ?>
|
||||
</h3>
|
||||
<?
|
||||
|
||||
// This code was copy-pasted from collages and should die in a fire
|
||||
$Number = 0;
|
||||
$NumGroups = 0;
|
||||
foreach ($TopVotes as $GroupID=>$Group) {
|
||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel,
|
||||
$GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse,
|
||||
$Torrents, $GroupArtists, $ExtendedArtists, $GroupCategoryID) = array_values($Group);
|
||||
|
||||
// Handle stats and stuff
|
||||
$Number++;
|
||||
$NumGroups++;
|
||||
|
||||
$TagList = explode(' ',str_replace('_','.',$TagList));
|
||||
$TorrentTags = array();
|
||||
foreach($TagList as $Tag) {
|
||||
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
|
||||
}
|
||||
$PrimaryTag = $TagList[0];
|
||||
$TorrentTags = implode(', ', $TorrentTags);
|
||||
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
|
||||
|
||||
$DisplayName = $Number.' - ';
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName .= Artists::display_artists($ExtendedArtists);
|
||||
} elseif(count($GroupArtists)>0) {
|
||||
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
|
||||
}
|
||||
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
|
||||
// Start an output buffer, so we can store this output in $TorrentTable
|
||||
ob_start();
|
||||
|
||||
if(count($Torrents)>1 || $GroupCategoryID==1) {
|
||||
// Grouped torrents
|
||||
?>
|
||||
<tr class="group discog" id="group_<?=$GroupID?>">
|
||||
<td class="center">
|
||||
<div title="View" id="showimg_<?=$GroupID?>" class="show_torrents">
|
||||
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?=$DisplayName?></strong>
|
||||
<? if(in_array($GroupID, $Bookmarks)) { ?>
|
||||
<span style="float:right;">[ <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a> ]</span>
|
||||
<? } else { ?>
|
||||
<span style="float:right;">[ <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a> ]</span>
|
||||
<? } ?>
|
||||
<?=$TorrentTags?>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?
|
||||
$LastRemasterYear = '-';
|
||||
$LastRemasterTitle = '';
|
||||
$LastRemasterRecordLabel = '';
|
||||
$LastRemasterCatalogueNumber = '';
|
||||
$LastMedia = '';
|
||||
|
||||
$EditionID = 0;
|
||||
unset($FirstUnknown);
|
||||
|
||||
foreach ($Torrents as $TorrentID => $Torrent) {
|
||||
|
||||
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Torrent['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
$EditionID++;
|
||||
if($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
|
||||
$RemasterName = $Torrent['RemasterYear'];
|
||||
$AddExtra = " - ";
|
||||
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
|
||||
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
||||
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
|
||||
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
|
||||
|
||||
?>
|
||||
<tr class="group_torrent groupid_<?=$GroupID?> edition hidden">
|
||||
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$RemasterName?></strong></td>
|
||||
</tr>
|
||||
<?
|
||||
} else {
|
||||
$AddExtra = " / ";
|
||||
if (!$Torrent['Remastered']) {
|
||||
$MasterName = "Original Release";
|
||||
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
|
||||
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
|
||||
} else {
|
||||
$MasterName = "Unknown Release(s)";
|
||||
}
|
||||
$MasterName .= $AddExtra.display_str($Torrent['Media']);
|
||||
?>
|
||||
<tr class="group_torrent groupid_<?=$GroupID?> edition hidden">
|
||||
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$MasterName?></strong></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
}
|
||||
$LastRemasterTitle = $Torrent['RemasterTitle'];
|
||||
$LastRemasterYear = $Torrent['RemasterYear'];
|
||||
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
|
||||
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
|
||||
$LastMedia = $Torrent['Media'];
|
||||
?>
|
||||
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?> hidden">
|
||||
<td colspan="3">
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
</span>
|
||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
} else {
|
||||
// Viewing a type that does not require grouping
|
||||
|
||||
list($TorrentID, $Torrent) = each($Torrents);
|
||||
|
||||
$DisplayName = $Number .' - <a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
|
||||
if(array_key_exists($TorrentID, $SnatchedTorrents)) { $DisplayName.=' <strong>Snatched!</strong>'; }
|
||||
|
||||
if(!empty($Torrent['FreeTorrent'])) {
|
||||
$DisplayName .=' <strong>Freeleech!</strong>';
|
||||
} elseif(in_array($TorrentID, $TokenTorrents)) {
|
||||
$DisplayName .= $AddExtra.'<strong>Personal Freeleech!</strong>';
|
||||
}
|
||||
?>
|
||||
<tr class="torrent" id="group_<?=$GroupID?>">
|
||||
<td></td>
|
||||
<td class="center">
|
||||
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>">
|
||||
</div>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a>
|
||||
<? if(in_array($GroupID, $Bookmarks)) { ?>
|
||||
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
|
||||
<? } else { ?>
|
||||
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
|
||||
<? } ?>
|
||||
]
|
||||
</span>
|
||||
<strong><?=$DisplayName?></strong>
|
||||
<?=$TorrentTags?>
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
$TorrentTable.=ob_get_clean();
|
||||
}
|
||||
?>
|
||||
<table class="torrent_table grouping cats" id="discog_table">
|
||||
<tr class="colhead_dark">
|
||||
<td><!-- expand/collapse --></td>
|
||||
<td><!-- Category --></td>
|
||||
<td width="70%"><strong>Torrents</strong></td>
|
||||
<td>Size</td>
|
||||
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
|
||||
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
|
||||
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
|
||||
</tr>
|
||||
<?
|
||||
if($TorrentList === false) { ?>
|
||||
<tr>
|
||||
<td colspan="7" class="center">Server is busy processing another top list request. Please try again in a minute.</td>
|
||||
</tr>
|
||||
<?
|
||||
} elseif (count($Groups) == 0) { ?>
|
||||
<tr>
|
||||
<td colspan="7" class="center">No torrents were found that meet your criteria.</td>
|
||||
</tr>
|
||||
<?
|
||||
} else {
|
||||
echo $TorrentTable;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
@ -80,6 +80,13 @@ function compare($X, $Y){
|
||||
die();
|
||||
}*/
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
$SnatchedTorrents = Torrents::get_snatched_torrents();
|
||||
// Start output
|
||||
View::show_header($Title,'browse,comments,torrent,bbcode');
|
||||
?>
|
||||
@ -357,6 +364,9 @@ function compare($X, $Y){
|
||||
<strong><a href="rules.php?p=tag">Tagging rules</a></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<? //include(SERVER_ROOT.'/sections/torrents/vote.php');
|
||||
?>
|
||||
</div>
|
||||
<div class="main_column">
|
||||
<table class="torrent_table details" id="torrent_details">
|
||||
@ -463,6 +473,7 @@ function filelist($Str) {
|
||||
if(!$ExtraInfo) {
|
||||
$ExtraInfo = $GroupName ; $AddExtra=' / ';
|
||||
}
|
||||
if(array_key_exists($TorrentID, $SnatchedTorrents)) {$ExtraInfo.=$AddExtra.'<strong>Snatched!</strong>'; $AddExtra=' / '; }
|
||||
if($FreeTorrent == '1') { $ExtraInfo.=$AddExtra.'<strong>Freeleech!</strong>'; $AddExtra=' / '; }
|
||||
if($FreeTorrent == '2') { $ExtraInfo.=$AddExtra.'<strong>Neutral Leech!</strong>'; $AddExtra=' / '; }
|
||||
if($PersonalFL) { $ExtraInfo.=$AddExtra.'<strong>Personal Freeleech!</strong>'; $AddExtra=' / '; }
|
||||
@ -566,18 +577,18 @@ function filelist($Str) {
|
||||
</blockquote>
|
||||
<? if(check_perms('site_moderate_requests')) { ?>
|
||||
<div class="linkbox">
|
||||
<a href="torrents.php?action=masspm&id=<?=$GroupID?>&torrentid=<?=$TorrentID?>">[Mass PM snatchers]</a>
|
||||
<a href="torrents.php?action=masspm&id=<?=$GroupID?>&torrentid=<?=$TorrentID?>">[Mass PM Snatchers]</a>
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="linkbox">
|
||||
<a href="#" onclick="show_peers('<?=$TorrentID?>', 0);return false;">(View peer list)</a>
|
||||
<a href="#" onclick="show_peers('<?=$TorrentID?>', 0);return false;">(View Peerlist)</a>
|
||||
<? if(check_perms('site_view_torrent_snatchlist')) { ?>
|
||||
<a href="#" onclick="show_downloads('<?=$TorrentID?>', 0);return false;" title="View the list of users that have clicked the "DL" button">(View downloader list)</a>
|
||||
<a href="#" onclick="show_snatches('<?=$TorrentID?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker">(View snatcher list)</a>
|
||||
<a href="#" onclick="show_downloads('<?=$TorrentID?>', 0);return false;">(View Downloadlist)</a>
|
||||
<a href="#" onclick="show_snatches('<?=$TorrentID?>', 0);return false;">(View Snatchlist)</a>
|
||||
<? } ?>
|
||||
<a href="#" onclick="show_files('<?=$TorrentID?>');return false;">(View file list)</a>
|
||||
<? if($Reported) { ?>
|
||||
<a href="#" onclick="show_reported('<?=$TorrentID?>');return false;">(View report information)</a>
|
||||
<a href="#" onclick="show_reported('<?=$TorrentID?>');return false;">(View Report Information)</a>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div id="peers_<?=$TorrentID?>" class="hidden"></div>
|
||||
@ -728,13 +739,17 @@ function filelist($Str) {
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
// Matched Votes
|
||||
//include(SERVER_ROOT.'/sections/torrents/voter_picks.php');
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="head"><strong><?=(!empty($ReleaseType) ? $ReleaseTypes[$ReleaseType].' info' : 'Info' )?></strong></div>
|
||||
<div class="body"><? if ($WikiBody!="") { echo $WikiBody; } else { echo "There is no information on this torrent."; } ?></div>
|
||||
</div>
|
||||
<?
|
||||
// --- Comments ---
|
||||
|
||||
// gets the amount of comments for this group
|
||||
$Results = $Cache->get_value('torrent_comments_'.$GroupID);
|
||||
if($Results === false) {
|
||||
$DB->query("SELECT
|
||||
@ -798,7 +813,7 @@ function filelist($Str) {
|
||||
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<div style="float:left;"><a class="post_id" href="torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||
<span style="float:left;"><a class="post_id" href='torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
|
||||
<strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&type=torrents_comment&id=<?=$PostID?>">[Report]</a>
|
||||
<? if(check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||
$AuthorInfo = Users::user_info($AuthorID);
|
||||
@ -817,7 +832,7 @@ function filelist($Str) {
|
||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
|
||||
<?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? }
|
||||
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
|
||||
</div>
|
||||
</span>
|
||||
<span id="bar<?=$PostID?>" style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
@ -860,43 +875,45 @@ function filelist($Str) {
|
||||
<?
|
||||
if(!$LoggedUser['DisablePosting']) { ?>
|
||||
<br />
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad">
|
||||
<table id="quickreplypreview" class="forum_post box vertical_margin hidden" style="text-align:left;">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
<div id="reply_box">
|
||||
<h3>Post reply</h3>
|
||||
<div class="box pad">
|
||||
<table id="quickreplypreview" class="forum_post box vertical_margin hidden" style="text-align:left;">
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
|
||||
<a href="#quickreplypreview">[Report Comment]</a>
|
||||
</span>
|
||||
<span id="barpreview" style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="#quickreplypreview">[Report Comment]</a>
|
||||
</span>
|
||||
<span id="barpreview" style="float:right;">
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="avatar" valign="top">
|
||||
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
||||
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
||||
<? } else { ?>
|
||||
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class="send_form center" name="reply" id="quickpostform" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<div id="quickreplytext">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<textarea id="quickpost" name="body" cols="70" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" />
|
||||
</form>
|
||||
<div id="quickreplytext">
|
||||
<input type="hidden" name="action" value="reply" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<textarea id="quickpost" name="body" cols="70" rows="8"></textarea> <br />
|
||||
</div>
|
||||
<input id="post_preview" type="button" value="Preview" onclick="if(this.preview){Quick_Edit();}else{Quick_Preview();}" />
|
||||
<input type="submit" id="submit_button" value="Post reply" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
|
@ -144,6 +144,30 @@
|
||||
|
||||
$DB->query("INSERT IGNORE INTO users_downloads (UserID, TorrentID, Time) VALUES ('$UserID', '$TorrentID', '".sqltime()."')");
|
||||
|
||||
$SnatchedTorrents = $Cache->get_value('users_snatched_'.$UserID);
|
||||
if (empty($SnatchedTorrents)) {
|
||||
$DB->query("SELECT DISTINCT fid as TorrentID FROM xbt_snatched WHERE uid='$UserID' ORDER BY TorrentID ASC");
|
||||
$SnatchedTorrents = array_flip($DB->collect('TorrentID'));
|
||||
$Cache->cache_value('users_snatched_'.$UserID, $SnatchedTorrents, 86400);
|
||||
}
|
||||
if(!array_key_exists($TorrentID, $SnatchedTorrents)) {
|
||||
$SnatchedTorrents[$TorrentID] = 1;
|
||||
$Cache->cache_value('users_snatched_'.$UserID, $SnatchedTorrents, 86400);
|
||||
}
|
||||
|
||||
|
||||
$SnatchedTorrents = $Cache->get_value('users_snatched_'.$UserID);
|
||||
if (empty($SnatchedTorrents)) {
|
||||
$DB->query("SELECT DISTINCT fid as TorrentID FROM xbt_snatched WHERE uid='$UserID' ORDER BY TorrentID ASC");
|
||||
$SnatchedTorrents = array_flip($DB->collect('TorrentID'));
|
||||
$Cache->cache_value('users_snatched_'.$UserID, $SnatchedTorrents, 86400);
|
||||
}
|
||||
if(!array_key_exists($TorrentID, $SnatchedTorrents)) {
|
||||
$SnatchedTorrents[$TorrentID] = 1;
|
||||
$Cache->cache_value('users_snatched_'.$UserID, $SnatchedTorrents, 86400);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'");
|
||||
|
||||
|
@ -153,42 +153,17 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
enforce_login();
|
||||
require(SERVER_ROOT.'/sections/torrents/manage_artists.php');
|
||||
break;
|
||||
|
||||
case 'notify_clear':
|
||||
enforce_login();
|
||||
authorize();
|
||||
if(!check_perms('site_torrents_notify')) {
|
||||
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
|
||||
}
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='0'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
|
||||
case 'notify_cleargroup':
|
||||
enforce_login();
|
||||
authorize();
|
||||
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
|
||||
error(0);
|
||||
}
|
||||
if(!check_perms('site_torrents_notify')) {
|
||||
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
|
||||
}
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND FilterID='$_GET[filterid]' AND UnRead='0'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
|
||||
case 'notify_clear_item':
|
||||
case 'notify_clearitem':
|
||||
enforce_login();
|
||||
case 'notify_clear_filter':
|
||||
case 'notify_cleargroup':
|
||||
case 'notify_catchup':
|
||||
case 'notify_catchup_filter':
|
||||
authorize();
|
||||
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
|
||||
error(0);
|
||||
}
|
||||
if(!check_perms('site_torrents_notify')) {
|
||||
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
|
||||
}
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND TorrentID='$_GET[torrentid]'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
enforce_login();
|
||||
require(SERVER_ROOT.'/sections/torrents/notify_actions.php');
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
@ -199,7 +174,7 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
enforce_login();
|
||||
authorize();
|
||||
|
||||
if (!isset($_POST['groupid']) || !is_number($_POST['groupid']) || $_POST['body']==='' || !isset($_POST['body'])) {
|
||||
if (!isset($_POST['groupid']) || !is_number($_POST['groupid']) || trim($_POST['body'])==='' || !isset($_POST['body'])) {
|
||||
error(0);
|
||||
}
|
||||
if($LoggedUser['DisablePosting']) {
|
||||
|
@ -1,29 +1,110 @@
|
||||
<?
|
||||
if(!check_perms('site_torrents_notify')) { error(403); }
|
||||
if (!check_perms('site_torrents_notify')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
define('NOTIFICATIONS_PER_PAGE', 50);
|
||||
define('NOTIFICATIONS_MAX_SLOWSORT', 10000);
|
||||
|
||||
$OrderBys = array(
|
||||
'time' => array('unt' => 'unt.TorrentID'),
|
||||
'size' => array('t' => 't.Size'),
|
||||
'snatches' => array('t' => 't.Snatched'),
|
||||
'seeders' => array('t' => 't.Seeders'),
|
||||
'leechers' => array('t' => 't.Leechers'),
|
||||
'year' => array('tg' => 'tnt.Year'));
|
||||
|
||||
if (empty($_GET['order_by']) || !isset($OrderBys[$_GET['order_by']])) {
|
||||
$_GET['order_by'] = 'time';
|
||||
}
|
||||
list($OrderTbl, $OrderCol) = each($OrderBys[$_GET['order_by']]);
|
||||
|
||||
if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
|
||||
$OrderWay = 'ASC';
|
||||
} else {
|
||||
$OrderWay = 'DESC';
|
||||
}
|
||||
|
||||
if (!empty($_GET['filterid']) && is_number($_GET['filterid'])) {
|
||||
$FilterID = $_GET['filterid'];
|
||||
} else {
|
||||
$FilterID = false;
|
||||
}
|
||||
|
||||
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
|
||||
|
||||
|
||||
// The "order by x" links on columns headers
|
||||
function header_link($SortKey, $DefaultWay = "desc") {
|
||||
global $OrderWay;
|
||||
if ($SortKey == $_GET['order_by']) {
|
||||
if ($OrderWay == "DESC") {
|
||||
$NewWay = "asc";
|
||||
} else {
|
||||
$NewWay = "desc";
|
||||
}
|
||||
} else {
|
||||
$NewWay = $DefaultWay;
|
||||
}
|
||||
return "?action=notify&order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('page','order_way','order_by'));
|
||||
}
|
||||
$UserID = $LoggedUser['ID'];
|
||||
|
||||
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, unf.Label, t.GroupID
|
||||
// Sorting by release year requires joining torrents_group, which is slow. Using a temporary table
|
||||
// makes it speedy enough as long as there aren't too many records to create
|
||||
if ($OrderTbl == 'tg') {
|
||||
$DB->query("SELECT COUNT(*) FROM users_notify_torrents AS unt
|
||||
JOIN torrents AS t ON t.ID=unt.TorrentID
|
||||
WHERE unt.UserID=$UserID".
|
||||
($FilterID
|
||||
? " AND FilterID=$FilterID"
|
||||
: ""));
|
||||
list($TorrentCount) = $DB->next_record();
|
||||
if ($TorrentCount > NOTIFICATIONS_MAX_SLOWSORT) {
|
||||
error("Due to performance issues, torrent lists with more than ".number_format(NOTIFICATIONS_MAX_SLOWSORT)." items cannot be ordered by release year.");
|
||||
}
|
||||
|
||||
$DB->query("CREATE TEMPORARY TABLE temp_notify_torrents
|
||||
(TorrentID int, GroupID int, UnRead tinyint, FilterID int, Year smallint, PRIMARY KEY(GroupID, TorrentID), KEY(Year)) ENGINE=MyISAM");
|
||||
$DB->query("INSERT INTO temp_notify_torrents (TorrentID, GroupID, UnRead, FilterID)
|
||||
SELECT t.ID, t.GroupID, unt.UnRead, unt.FilterID
|
||||
FROM users_notify_torrents AS unt JOIN torrents AS t ON t.ID=unt.TorrentID
|
||||
WHERE unt.UserID=$UserID".
|
||||
($FilterID
|
||||
? " AND unt.FilterID=$FilterID"
|
||||
: ""));
|
||||
$DB->query("UPDATE temp_notify_torrents AS tnt JOIN torrents_group AS tg ON tnt.GroupID=tg.ID SET tnt.Year=tg.Year");
|
||||
|
||||
$DB->query("SELECT TorrentID, GroupID, UnRead, FilterID
|
||||
FROM temp_notify_torrents AS tnt
|
||||
ORDER BY $OrderCol $OrderWay, GroupID $OrderWay LIMIT $Limit");
|
||||
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
|
||||
} else {
|
||||
$DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, t.GroupID
|
||||
FROM users_notify_torrents AS unt
|
||||
JOIN torrents AS t ON t.ID = unt.TorrentID
|
||||
LEFT JOIN users_notify_filters AS unf ON unf.ID = unt.FilterID
|
||||
WHERE unt.UserID=$UserID".
|
||||
((!empty($_GET['filterid']) && is_number($_GET['filterid']))
|
||||
? " AND unf.ID='$_GET[filterid]'"
|
||||
($FilterID
|
||||
? " AND unt.FilterID=$FilterID"
|
||||
: "")."
|
||||
ORDER BY TorrentID DESC LIMIT $Limit");
|
||||
$GroupIDs = array_unique($DB->collect('GroupID'));
|
||||
ORDER BY $OrderCol $OrderWay LIMIT $Limit");
|
||||
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($TorrentCount) = $DB->next_record();
|
||||
}
|
||||
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($TorrentCount) = $DB->next_record();
|
||||
$Debug->log_var($TorrentCount, 'Torrent count');
|
||||
$GroupIDs = $FilterIDs = $UnReadIDs = array();
|
||||
foreach ($Results as $Torrent) {
|
||||
$GroupIDs[$Torrent['GroupID']] = 1;
|
||||
$FilterIDs[$Torrent['FilterID']] = 1;
|
||||
if ($Torrent['UnRead']) {
|
||||
$UnReadIDs[] = $Torrent['TorrentID'];
|
||||
}
|
||||
}
|
||||
$Pages = Format::get_pages($Page, $TorrentCount, NOTIFICATIONS_PER_PAGE, 9);
|
||||
|
||||
if(count($GroupIDs)) {
|
||||
if (!empty($GroupIDs)) {
|
||||
$GroupIDs = array_keys($GroupIDs);
|
||||
$FilterIDs = array_keys($FilterIDs);
|
||||
$TorrentGroups = Torrents::get_groups($GroupIDs);
|
||||
$TorrentGroups = $TorrentGroups['matches'];
|
||||
|
||||
@ -31,21 +112,45 @@
|
||||
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
|
||||
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||
|
||||
//Clear before header but after query so as to not have the alert bar on this page load
|
||||
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
// Get the relevant filter labels
|
||||
$DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")");
|
||||
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array(2));
|
||||
foreach ($Filters as &$Filter) {
|
||||
$Filter['Artists'] = explode('|', trim($Filter['Artists'], '|'));
|
||||
}
|
||||
unset($Filter);
|
||||
|
||||
if (!empty($UnReadIDs)) {
|
||||
//Clear before header but after query so as to not have the alert bar on this page load
|
||||
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']." AND TorrentID IN (".implode(',', $UnReadIDs).")");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
}
|
||||
|
||||
View::show_header('My notifications', 'notifications');
|
||||
$DB->set_query_id($Results);
|
||||
|
||||
?>
|
||||
<div class="header">
|
||||
<h2>Latest notifications <a href="torrents.php?action=notify_clear&auth=<?=$LoggedUser['AuthKey']?>">(clear all)</a> <a href="javascript:SuperGroupClear()">(clear selected)</a> <a href="user.php?action=notify">(edit filters)</a></h2>
|
||||
<h2>Latest notifications</h2>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
<? if($FilterID) { ?>
|
||||
<a href="torrents.php?action=notify">View all</a>
|
||||
<? } else { ?>
|
||||
<a href="torrents.php?action=notify_clear&auth=<?=$LoggedUser['AuthKey']?>">Clear all</a>
|
||||
<a href="javascript:SuperGroupClear()">Clear selected</a>
|
||||
<a href="torrents.php?action=notify_catchup&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a>
|
||||
<? } ?>
|
||||
<a href="user.php?action=notify">Edit filters</a>
|
||||
</div>
|
||||
<? if ($TorrentCount > NOTIFICATIONS_PER_PAGE) { ?>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
</div>
|
||||
<? if(!$DB->record_count()) { ?>
|
||||
<?
|
||||
}
|
||||
if (empty($Results)) {
|
||||
?>
|
||||
<table class="layout border">
|
||||
<tr class="rowb">
|
||||
<td colspan="8" class="center">
|
||||
@ -53,75 +158,92 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? } else {
|
||||
<?
|
||||
} else {
|
||||
$FilterGroups = array();
|
||||
while($Result = $DB->next_record(MYSQLI_ASSOC)) {
|
||||
if(!$Result['FilterID']) {
|
||||
$Result['FilterID'] = 0;
|
||||
}
|
||||
if(!isset($FilterGroups[$Result['FilterID']])) {
|
||||
foreach ($Results as $Result) {
|
||||
if (!isset($FilterGroups[$Result['FilterID']])) {
|
||||
$FilterGroups[$Result['FilterID']] = array();
|
||||
$FilterGroups[$Result['FilterID']]['FilterLabel'] = $Result['Label'] ? $Result['Label'] : false;
|
||||
$FilterGroups[$Result['FilterID']]['FilterLabel'] = isset($Filters[$Result['FilterID']])
|
||||
? $Filters[$Result['FilterID']]['Label']
|
||||
: false;
|
||||
}
|
||||
array_push($FilterGroups[$Result['FilterID']], $Result);
|
||||
$FilterGroups[$Result['FilterID']][] = $Result;
|
||||
}
|
||||
unset($Result);
|
||||
$Debug->log_var($FilterGroups, 'Filter groups');
|
||||
foreach($FilterGroups as $FilterID => $FilterResults) {
|
||||
|
||||
foreach ($FilterGroups as $FilterID => $FilterResults) {
|
||||
?>
|
||||
<h3>
|
||||
Matches for <?=$FilterResults['FilterLabel'] !== false
|
||||
? '<a href="torrents.php?action=notify&filterid='.$FilterID.'">'.$FilterResults['FilterLabel'].'</a>'
|
||||
: 'unknown filter['.$FilterID.']'?>
|
||||
<a href="torrents.php?action=notify_cleargroup&filterid=<?=$FilterID?>&auth=<?=$LoggedUser['AuthKey']?>">(clear)</a>
|
||||
<a href="javascript:GroupClear($('#notificationform_<?=$FilterID?>').raw())">(clear selected)</a>
|
||||
</h3>
|
||||
<div class="header">
|
||||
<h3>
|
||||
Matches for <?=$FilterResults['FilterLabel'] !== false
|
||||
? '<a href="torrents.php?action=notify&filterid='.$FilterID.'">'.$FilterResults['FilterLabel'].'</a>'
|
||||
: 'unknown filter['.$FilterID.']'?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="notify_filter_links">
|
||||
<a href="javascript:GroupClear($('#notificationform_<?=$FilterID?>').raw())">Clear selected in filter</a>
|
||||
<a href="torrents.php?action=notify_clear_filter&filterid=<?=$FilterID?>&auth=<?=$LoggedUser['AuthKey']?>">Clear all in filter</a>
|
||||
<a href="torrents.php?action=notify_catchup_filter&filterid=<?=$FilterID?>&auth=<?=$LoggedUser['AuthKey']?>">Mark all in filter as read</a>
|
||||
</div>
|
||||
<form class="manage_form" name="torrents" id="notificationform_<?=$FilterID?>">
|
||||
<table class="torrent_table cats checkboxes border">
|
||||
<tr class="colhead">
|
||||
<td style="text-align: center"><input type="checkbox" name="toggle" onclick="ToggleBoxes(this.form, this.checked)" /></td>
|
||||
<td class="small cats_col"></td>
|
||||
<td style="width:100%;"><strong>Name</strong></td>
|
||||
<td><strong>Files</strong></td>
|
||||
<td><strong>Time</strong></td>
|
||||
<td><strong>Size</strong></td>
|
||||
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
|
||||
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
|
||||
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
|
||||
<td style="width:100%;">Name<?=$TorrentCount <= NOTIFICATIONS_MAX_SLOWSORT ? ' / <a href="'.header_link('year').'">Year</a>' : ''?></td>
|
||||
<td>Files</td>
|
||||
<td><a href="<?=header_link('time')?>">Time</a></td>
|
||||
<td><a href="<?=header_link('size')?>">Size</a></td>
|
||||
<td class="sign"><a href="<?=header_link('snatches')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></a></td>
|
||||
<td class="sign"><a href="<?=header_link('seeders')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></a></td>
|
||||
<td class="sign"><a href="<?=header_link('leechers')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></a></td>
|
||||
</tr>
|
||||
<?
|
||||
unset($FilterResults['FilterLabel']);
|
||||
foreach($FilterResults as $Result) {
|
||||
foreach ($FilterResults as $Result) {
|
||||
$TorrentID = $Result['TorrentID'];
|
||||
$GroupID = $Result['GroupID'];
|
||||
$GroupInfo = $TorrentGroups[$Result['GroupID']];
|
||||
if(!isset($GroupInfo['Torrents'][$TorrentID]) || !isset($GroupInfo['ID'])) {
|
||||
if (!isset($GroupInfo['Torrents'][$TorrentID]) || !isset($GroupInfo['ID'])) {
|
||||
// If $GroupInfo['ID'] is unset, the torrent group associated with the torrent doesn't exist
|
||||
continue;
|
||||
}
|
||||
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
|
||||
// generate torrent's title
|
||||
$DisplayName = '';
|
||||
if(!empty($GroupInfo['ExtendedArtists'])) {
|
||||
if (!empty($GroupInfo['ExtendedArtists'])) {
|
||||
$MatchingArtists = array();
|
||||
foreach ($GroupInfo['ExtendedArtists'] as $GroupArtists) {
|
||||
foreach ($GroupArtists as $GroupArtist) {
|
||||
foreach ($Filters[$FilterID]['Artists'] as $FilterArtist) {
|
||||
if (!strcasecmp($FilterArtist, $GroupArtist['name'])) {
|
||||
$MatchingArtists[] = $GroupArtist['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$MatchingArtistsText = !empty($MatchingArtists)
|
||||
? 'Caught by filter for '.implode(', ', $MatchingArtists)
|
||||
: '';
|
||||
$DisplayName = Artists::display_artists($GroupInfo['ExtendedArtists'], true, true);
|
||||
}
|
||||
$DisplayName .= "<a href='torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID' title='View Torrent'>".$GroupInfo['Name']."</a>";
|
||||
|
||||
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
|
||||
if($GroupCategoryID == 1) {
|
||||
if($GroupInfo['Year'] > 0) {
|
||||
if ($GroupCategoryID == 1) {
|
||||
if ($GroupInfo['Year'] > 0) {
|
||||
$DisplayName .= " [$GroupInfo[Year]]";
|
||||
}
|
||||
if($GroupInfo['ReleaseType'] > 0) {
|
||||
if ($GroupInfo['ReleaseType'] > 0) {
|
||||
$DisplayName.= " [".$ReleaseTypes[$GroupInfo['ReleaseType']]."]";
|
||||
}
|
||||
}
|
||||
|
||||
// append extra info to torrent title
|
||||
$ExtraInfo = Torrents::torrent_info($TorrentInfo, true, true);
|
||||
$Debug->log_var($ExtraInfo, "Extra torrent info ($TorrentID)");
|
||||
|
||||
$TagLinks = array();
|
||||
if($GroupInfo['TagList'] != '') {
|
||||
if ($GroupInfo['TagList'] != '') {
|
||||
$TorrentTags = explode(' ', $GroupInfo['TagList']);
|
||||
$MainTag = $TorrentTags[0];
|
||||
foreach ($TorrentTags as $TagKey => $TagName) {
|
||||
@ -137,20 +259,21 @@
|
||||
|
||||
// print row
|
||||
?>
|
||||
<tr class="torrent" id="torrent<?=$TorrentID?>">
|
||||
<tr class="torrent" id="torrent<?=$TorrentID?>"<?=$MatchingArtistsText ? 'title="'.$MatchingArtistsText.'"' : ''?>>
|
||||
<td style="text-align: center"><input type="checkbox" value="<?=$TorrentID?>" id="clear_<?=$TorrentID?>" /></td>
|
||||
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$MainTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1])).' tags_'.str_replace('.','_',$MainTag)?>"></div></td>
|
||||
<td>
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($TorrentInfo['Size'] < 1073741824)
|
||||
&& !$TorrentInfo['PersonalFL'] && empty($TorrentInfo['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
<? if (Torrents::can_use_token($TorrentInfo)) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="#" onclick="Clear(<?=$TorrentID?>);return false;" title="Remove from notifications list">CL</a> ]
|
||||
</span>
|
||||
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
|
||||
<? if($Result['UnRead']) { echo '<strong class="new">New!</strong>'; } ?>
|
||||
<? if ($Result['UnRead']) {
|
||||
echo '<strong class="new">New!</strong>';
|
||||
} ?>
|
||||
<?=$TorrentTags?>
|
||||
</td>
|
||||
<td><?=$TorrentInfo['FileCount']?></td>
|
||||
|
48
sections/torrents/notify_actions.php
Normal file
48
sections/torrents/notify_actions.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?
|
||||
switch($_GET['action']) {
|
||||
case 'notify_clear':
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND UnRead = '0'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
|
||||
case 'notify_clear_item':
|
||||
case 'notify_clearitem':
|
||||
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND TorrentID = '$_GET[torrentid]'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
break;
|
||||
|
||||
case 'notify_clear_filter':
|
||||
case 'notify_cleargroup':
|
||||
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND FilterID = '$_GET[filterid]' AND UnRead = '0'");
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
|
||||
case 'notify_catchup':
|
||||
$DB->query("UPDATE users_notify_torrents SET UnRead = '0' WHERE UserID=$LoggedUser[ID]");
|
||||
if($DB->affected_rows()) {
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
|
||||
case 'notify_catchup_filter':
|
||||
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID = $LoggedUser[ID] AND FilterID = $_GET[filterid]");
|
||||
if($DB->affected_rows()) {
|
||||
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
header('Location: torrents.php?action=notify');
|
||||
break;
|
||||
default:
|
||||
error(0);
|
||||
}
|
93
sections/torrents/ranking_funcs.php
Normal file
93
sections/torrents/ranking_funcs.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
function inverse_ncdf($p) {
|
||||
/***************************************************************************
|
||||
* inverse_ncdf.php
|
||||
* -------------------
|
||||
* begin : Friday, January 16, 2004
|
||||
* copyright : (C) 2004 Michael Nickerson
|
||||
* email : nickersonm@yahoo.com
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
//Inverse ncdf approximation by Peter John Acklam, implementation adapted to
|
||||
//PHP by Michael Nickerson, using Dr. Thomas Ziegler's C implementation as
|
||||
//a guide. http://home.online.no/~pjacklam/notes/invnorm/index.html
|
||||
//I have not checked the accuracy of this implementation. Be aware that PHP
|
||||
//will truncate the coeficcients to 14 digits.
|
||||
|
||||
//You have permission to use and distribute this function freely for
|
||||
//whatever purpose you want, but please show common courtesy and give credit
|
||||
//where credit is due.
|
||||
|
||||
//Input paramater is $p - probability - where 0 < p < 1.
|
||||
|
||||
//Coefficients in rational approximations
|
||||
$a = array(1 => -3.969683028665376e+01, 2 => 2.209460984245205e+02,
|
||||
3 => -2.759285104469687e+02, 4 => 1.383577518672690e+02,
|
||||
5 => -3.066479806614716e+01, 6 => 2.506628277459239e+00);
|
||||
|
||||
$b = array(1 => -5.447609879822406e+01, 2 => 1.615858368580409e+02,
|
||||
3 => -1.556989798598866e+02, 4 => 6.680131188771972e+01,
|
||||
5 => -1.328068155288572e+01);
|
||||
|
||||
$c = array(1 => -7.784894002430293e-03, 2 => -3.223964580411365e-01,
|
||||
3 => -2.400758277161838e+00, 4 => -2.549732539343734e+00,
|
||||
5 => 4.374664141464968e+00, 6 => 2.938163982698783e+00);
|
||||
|
||||
$d = array(1 => 7.784695709041462e-03, 2 => 3.224671290700398e-01,
|
||||
3 => 2.445134137142996e+00, 4 => 3.754408661907416e+00);
|
||||
|
||||
//Define break-points.
|
||||
$p_low = 0.02425; //Use lower region approx. below this
|
||||
$p_high = 1 - $p_low; //Use upper region approx. above this
|
||||
|
||||
//Define/list variables (doesn't really need a definition)
|
||||
//$p (probability), $sigma (std. deviation), and $mu (mean) are user inputs
|
||||
$q = NULL; $x = NULL; $y = NULL; $r = NULL;
|
||||
|
||||
//Rational approximation for lower region.
|
||||
if (0 < $p && $p < $p_low) {
|
||||
$q = sqrt(-2 * log($p));
|
||||
$x = ((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) *
|
||||
$q + $c[6]) / (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) *
|
||||
$q + 1);
|
||||
}
|
||||
|
||||
//Rational approximation for central region.
|
||||
elseif ($p_low <= $p && $p <= $p_high) {
|
||||
$q = $p - 0.5;
|
||||
$r = $q * $q;
|
||||
$x = ((((($a[1] * $r + $a[2]) * $r + $a[3]) * $r + $a[4]) * $r + $a[5]) *
|
||||
$r + $a[6]) * $q / ((((($b[1] * $r + $b[2]) * $r + $b[3]) * $r +
|
||||
$b[4]) * $r + $b[5]) * $r + 1);
|
||||
}
|
||||
|
||||
//Rational approximation for upper region.
|
||||
elseif ($p_high < $p && $p < 1) {
|
||||
$q = sqrt(-2 * log(1 - $p));
|
||||
$x = -((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q +
|
||||
$c[5]) * $q + $c[6]) / (((($d[1] * $q + $d[2]) * $q + $d[3]) *
|
||||
$q + $d[4]) * $q + 1);
|
||||
}
|
||||
|
||||
//If 0 < p < 1, return a null value
|
||||
else {
|
||||
$x = NULL;
|
||||
}
|
||||
|
||||
return $x;
|
||||
//END inverse ncdf implementation.
|
||||
}
|
||||
|
||||
// Confidence level for binomial scoring. Just compute this once.
|
||||
define(Z_VAL, inverse_ncdf(1-(1-.95)/2));
|
||||
|
||||
// Implementation of the algorithm described at http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
|
||||
function binomial_score($Ups, $Total) {
|
||||
if (($Total <= 0) || ($Ups < 0)) {
|
||||
return 0;
|
||||
}
|
||||
$phat = $Ups/$Total;
|
||||
return ($phat + Z_VAL*Z_VAL/(2*$Total) - Z_VAL*sqrt(($phat*(1-$phat)+Z_VAL*Z_VAL/(4*$Total))/$Total))/(1+Z_VAL*Z_VAL/$Total);
|
||||
}
|
||||
?>
|
34
sections/torrents/vote.php
Normal file
34
sections/torrents/vote.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?
|
||||
$UserVotes = $Cache->get_value('voted_albums_'.$LoggedUser['ID']);
|
||||
if ($UserVotes === FALSE) {
|
||||
$DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$LoggedUser['ID']);
|
||||
$UserVotes = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||
}
|
||||
|
||||
$GroupVotes = $Cache->get_value('votes_'.$GroupID);
|
||||
if ($GroupVotes === FALSE) {
|
||||
$DB->query("SELECT Ups AS Ups, Total AS Total FROM torrents_votes WHERE GroupID=$GroupID");
|
||||
if ($DB->record_count() == 0) {
|
||||
$GroupVotes = array('Ups'=>0, 'Total'=>0);
|
||||
} else {
|
||||
$GroupVotes = $DB->next_record(MYSQLI_ASSOC, false);
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
}
|
||||
$TotalVotes = $GroupVotes['Total'];
|
||||
$UpVotes = $GroupVotes['Ups'];
|
||||
|
||||
$Voted = isset($UserVotes[$GroupID])?$UserVotes[$GroupID]['Type']:false;
|
||||
?>
|
||||
<div class="box" id="votes">
|
||||
<div class="head"><strong>Favorite Album Votes</strong></div>
|
||||
<div class="album_votes body">
|
||||
This has <span id="upvotes" class="favoritecount"><?=$UpVotes?></span> <?=(($UpVotes==1)?'upvote':'upvotes')?> out of <span id="totalvotes" class="favoritecount"><?=$TotalVotes?></span> total<span id="upvoted" <?=($Voted!='Up'?'class="hidden"':'')?>>, including your upvote</span><span id="downvoted" <?=($Voted!='Down'?'class="hidden"':'')?>>, including your downvote</span>.
|
||||
<br /><br />
|
||||
<? if (check_perms('site_album_votes')) { ?>
|
||||
<span <?=($Voted?'class="hidden"':'')?> id="vote_message"><a href="#" onClick="UpVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Upvote</a> - <a href="#" onClick="DownVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Downvote</a></span>
|
||||
<? } ?>
|
||||
<span <?=($Voted?'':'class="hidden"')?> id="unvote_message">Changed your mind?<br /><a href="#" onClick="UnvoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Clear your vote</a></span>
|
||||
</div>
|
||||
</div>
|
55
sections/torrents/voter_picks.php
Normal file
55
sections/torrents/voter_picks.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?
|
||||
//global $Cache, $DB;
|
||||
include(SERVER_ROOT.'/sections/torrents/ranking_funcs.php');
|
||||
|
||||
$Top10 = $Cache->get_value('similar_albums_'.$GroupID);
|
||||
if ($Top10 === False) {
|
||||
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID);
|
||||
if ($VotePairs === False) {
|
||||
$DB->query("SELECT v.GroupID, SUM(IF(v.Type='Up',1,0)) AS Ups, COUNT(1) AS Total
|
||||
FROM (SELECT UserID FROM users_votes WHERE GroupID = $GroupID AND Type='Up') AS a
|
||||
JOIN users_votes AS v USING (UserID)
|
||||
WHERE v.GroupID <> $GroupID
|
||||
GROUP BY v.GroupID
|
||||
HAVING Ups > 0");
|
||||
$VotePairs = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
||||
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
||||
}
|
||||
|
||||
$GroupScores = array();
|
||||
foreach ($VotePairs as $RatingGroup) {
|
||||
// Cutting out the junk should speed the sort significantly
|
||||
$Score = binomial_score($RatingGroup['Ups'], $RatingGroup['Total']);
|
||||
if ($Score > 0.3) {
|
||||
$GroupScores[$RatingGroup['GroupID']] = binomial_score($RatingGroup['Ups'], $RatingGroup['Total']);
|
||||
}
|
||||
}
|
||||
|
||||
arsort($GroupScores);
|
||||
$Top10 = array_slice($GroupScores, 0, 10, true);
|
||||
$Cache->cache_value('similar_albums_'.$GroupID, $Top10, 12*3600);
|
||||
}
|
||||
if (count($Top10) > 0) {
|
||||
?>
|
||||
<table class="vote_matches_table" id="vote_matches">
|
||||
<tr class="colhead">
|
||||
<td>People who like this album also liked... <a href="#" onclick="$('.votes_rows').toggle(); return false;">(Show)</a></td>
|
||||
</tr>
|
||||
<?
|
||||
$Top10Groups = array_keys($Top10);
|
||||
|
||||
$Groups = Torrents::get_groups($Top10Groups, true, true, false);
|
||||
$i = 0;
|
||||
foreach ($Groups['matches'] as $MatchGroupID => $MatchGroup) {
|
||||
$i++;
|
||||
$Str = Artists::display_artists($MatchGroup['ExtendedArtists']).'<a href="torrents.php?id='.$MatchGroupID.'">'.$MatchGroup['Name'].'</a>';
|
||||
?>
|
||||
<tr class="votes_rows hidden <?=($i%2?'rowb':'rowa')?>">
|
||||
<td><span class="like_ranks"><?=$i?>.</span> <?=$Str?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
?>
|
@ -25,7 +25,7 @@
|
||||
<ul class="stats nobullet">
|
||||
<li>Forum posts: <?=number_format($ForumPosts)?> [<a href="userhistory.php?action=posts&userid=<?=$UserID?>" title="View">View</a>]</li>
|
||||
<? if (($Override=check_paranoia_here('torrentcomments+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Torrent comments: <?=number_format($NumComments)?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Torrent comments: <?=number_format($NumComments)?>
|
||||
<? if($Override=check_paranoia_here('torrentcomments')) { ?>[<a href="comments.php?id=<?=$UserID?>" <?= $Override===2 ? 'class="paranoia_override"'
|
||||
: ''
|
||||
?> title="View">View</a>]
|
||||
@ -33,7 +33,7 @@
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('collages+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages started: <?=number_format($NumCollages)?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Collages started: <?=number_format($NumCollages)?>
|
||||
<? if(($Override=check_paranoia_here('collages'))) { ?>[<a <?= ($Override===2) ? 'class="paranoia_override"'
|
||||
:'' ?>
|
||||
href="collages.php?userid=<?=$UserID?>" title="View">View</a>]
|
||||
@ -41,7 +41,7 @@
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('collagecontribs+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages contributed to: <? echo number_format($NumCollageContribs);
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Collages contributed to: <? echo number_format($NumCollageContribs);
|
||||
if (($Override=check_paranoia_here('collagecontribs'))) {
|
||||
?> [<a <?= ($Override===2) ?
|
||||
'class="paranoia_override"' : ''?> href="collages.php?userid=<?=$UserID?>&contrib=1" title="View">View</a>]
|
||||
@ -62,7 +62,7 @@
|
||||
<li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?></li>
|
||||
<? } elseif($ViewAll) { ?>
|
||||
<li>
|
||||
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?> >Requests filled: <?=number_format($RequestsFilled)?> </span>
|
||||
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?>>Requests filled: <?=number_format($RequestsFilled)?> </span>
|
||||
<span <?= ($ViewBounty===2) ? 'class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalBounty) ?> </span>
|
||||
[<a href="requests.php?type=filled&userid=<?=$UserID?>" <?= ($ViewAll===2) ? 'class="paranoia_override"' : ''?> title="View">View</a>]
|
||||
</li>
|
||||
@ -81,19 +81,19 @@
|
||||
<li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li>
|
||||
<? } elseif($ViewAll) { ?>
|
||||
<li>
|
||||
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?> >Requests voted: <?=number_format($RequestsVoted)?> </span>
|
||||
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?>>Requests voted: <?=number_format($RequestsVoted)?> </span>
|
||||
<span <?= ($ViewBounty===2) ? 'class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalSpent)?> </span>
|
||||
[<a href="requests.php?type=voted&userid=<?=$UserID?>" <?= ($ViewAll===2) ? 'class="paranoia_override"' : ''?> title="View">View</a>]
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('uploads+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Uploaded: <?=number_format($Uploads)?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Uploaded: <?=number_format($Uploads)?>
|
||||
<? if(($Override=check_paranoia_here('uploads'))) { ?>[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&userid=<?=$UserID?>" title="View">View</a>]<? if(check_perms('zip_downloader')) { ?> [<a href="torrents.php?action=redownload&type=uploads&userid=<?=$UserID?>"
|
||||
onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');">Download</a>]<? } } ?>
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('uniquegroups+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>
|
||||
Unique groups: <?echo number_format($UniqueGroups);
|
||||
if(($Override=check_paranoia_here('uniquegroups'))) {?>
|
||||
[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&userid=<?=$UserID?>&filter=uniquegroup">View</a>]
|
||||
@ -101,7 +101,7 @@
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('perfectflacs+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >"Perfect" FLACs: <?echo number_format($PerfectFLACs);
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>"Perfect" FLACs: <?echo number_format($PerfectFLACs);
|
||||
if (($Override=check_paranoia_here('perfectflacs'))) { ?>
|
||||
[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&userid=<?=$UserID?>&filter=perfectflac">View</a>]</li>
|
||||
<? }
|
||||
@ -115,7 +115,7 @@
|
||||
}
|
||||
?>
|
||||
<? if (($Override=check_paranoia_here('seeding+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Seeding: <?=number_format($Seeding)?> <?
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Seeding: <?=number_format($Seeding)?> <?
|
||||
if(($AOverride=check_paranoia_here('seeding'))) {
|
||||
echo ((($Override=check_paranoia_here('snatched')) && $UniqueSnatched > 0 )
|
||||
? '<span ' .($Override===2 ? 'class="paranoia_override" ' : '').' >(' . 100*min(1,round($Seeding/$UniqueSnatched,2)).'%)</span> '
|
||||
@ -128,7 +128,7 @@
|
||||
</li>
|
||||
<? }
|
||||
if (($Override=check_paranoia_here('leeching+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Leeching: <? echo number_format($Leeching);
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Leeching: <? echo number_format($Leeching);
|
||||
if(($Override=check_paranoia_here('leeching'))) { ?>
|
||||
[<a <?= $Override===2 ? 'class="paranoia_override"' : ''?> href="torrents.php?type=leeching&userid=<?=$UserID?>" title="View">View</a>]
|
||||
<? }
|
||||
@ -137,7 +137,7 @@
|
||||
<? }
|
||||
?>
|
||||
<? if (($Override=check_paranoia_here('snatched+'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Snatched: <?=number_format($Snatched)?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Snatched: <?=number_format($Snatched)?>
|
||||
<? if(($Override=check_perms('site_view_torrent_snatchlist', $Class))) { ?>
|
||||
(<?= $Override === 2 ? '<span class="paranoia_override">'.number_format($UniqueSnatched).'</span>' : number_format($UniqueSnatched) ?>)
|
||||
<? } ?>
|
||||
@ -151,7 +151,7 @@
|
||||
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) FROM users_downloads AS ud INNER JOIN torrents AS t ON t.ID=ud.TorrentID WHERE ud.UserID='$UserID'");
|
||||
list($NumDownloads, $UniqueDownloads) = $DB->next_record();
|
||||
?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>) [<a href="torrents.php?type=downloaded&userid=<?=$UserID?>" title="View">View</a>]</li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>) [<a href="torrents.php?type=downloaded&userid=<?=$UserID?>" title="View">View</a>]</li>
|
||||
<?
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,18 @@ function checked($Checked) {
|
||||
$SiteOptions = array();
|
||||
}
|
||||
|
||||
View::show_header($Username.' > Settings','user,jquery,password_validate,validate');
|
||||
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings');
|
||||
|
||||
$DB->query("SELECT PushService, PushOptions FROM
|
||||
users_push_notifications WHERE UserID = '$LoggedUser[ID]'");
|
||||
|
||||
list($PushService, $PushOptions) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
if ($PushOptions) {
|
||||
$PushOptions = unserialize($PushOptions);
|
||||
} else {
|
||||
$PushOptions = array();
|
||||
}
|
||||
echo $Val->GenerateJS('userform');
|
||||
?>
|
||||
<div class="thin">
|
||||
@ -125,6 +136,14 @@ function checked($Checked) {
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Show Snatched Torrents</strong></td>
|
||||
<td>
|
||||
<input type="checkbox" name="showsnatched" id="showsnatched" <? if (!empty($SiteOptions['ShowSnatched'])) { ?>checked="checked"<? } ?> />
|
||||
<label for="showsnatched">"Snatched!" next to snatched torrents</label>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Posts per page (Forum)</strong></td>
|
||||
<td>
|
||||
@ -136,7 +155,7 @@ function checked($Checked) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Hide release types</strong></td>
|
||||
<td class="label"><strong>Sort/Hide release types</strong></td>
|
||||
<td>
|
||||
<table class="layout" style="border:none;">
|
||||
<?
|
||||
@ -144,6 +163,52 @@ function checked($Checked) {
|
||||
$ReleaseTypes[1023] = "Remixed By";
|
||||
$ReleaseTypes[1022] = "Composition";
|
||||
$ReleaseTypes[1021] = "Produced By";
|
||||
?>
|
||||
|
||||
<a href="#" id="toggle_sortable" onclick="return false;">Expand</a>
|
||||
<div id="sortable_container" style="display: none;">
|
||||
<ul class="sortable_list" id="sortable">
|
||||
|
||||
<?
|
||||
//Generate list of release types for sorting and hiding.
|
||||
//If statement is in place because on the first usage user will not have 'SortHide' set in $SiteOptions
|
||||
if(empty($SiteOptions['SortHide'])) {
|
||||
for($i = 0; list($Key,$Val) = each($ReleaseTypes); $i++) {
|
||||
if(!empty($SiteOptions['HideTypes']) && in_array($Key, $SiteOptions['HideTypes'])) {
|
||||
$Checked = 'checked="checked" ';
|
||||
} else {
|
||||
$Checked='';
|
||||
}
|
||||
?>
|
||||
<li class="sortable_item"><input type="checkbox" <?=$Checked?>
|
||||
id="<?=$Key."_".($Checked == 'checked="checked" ' ? 1 : 0)?>"><?=$Val?></li>
|
||||
<? }
|
||||
}
|
||||
else {
|
||||
for($i = 0; list($Key,$Val) = each($SiteOptions['SortHide']); $i++) {
|
||||
if($Val == true) {
|
||||
$Checked = 'checked="checked" ';
|
||||
} else {
|
||||
$Checked='';
|
||||
}
|
||||
if(array_key_exists($Key, $ReleaseTypes)) {
|
||||
$Name = $ReleaseTypes[$Key];
|
||||
}
|
||||
else {
|
||||
$Name = "Error";
|
||||
}
|
||||
?>
|
||||
<li class="sortable_item"><input type="checkbox" <?=$Checked?>
|
||||
id="<?=$Key."_".($Checked == 'checked="checked" ' ? 1 : 0)?>"><?=$Name?></li>
|
||||
<? }
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<input type="hidden" id="sorthide" name="sorthide" value=""/>
|
||||
|
||||
<?
|
||||
/*
|
||||
for($i = 0; list($Key,$Val) = each($ReleaseTypes); $i++) {
|
||||
if(!($i % 7)) {
|
||||
if($i) {
|
||||
@ -161,10 +226,10 @@ function checked($Checked) {
|
||||
$Checked='';
|
||||
}
|
||||
?>
|
||||
<td style="border:none;">
|
||||
<label><input type="checkbox" id="hide_type_<?=$Key?>" name="hidetypes[]=" value="<?=$Key?>" <?=$Checked?>/>
|
||||
<?=$Val?></label>
|
||||
</td>
|
||||
<td style="border:none;">
|
||||
<label><input type="checkbox" id="hide_type_<?=$Key?>" name="hidetypes[]=" value="<?=$Key?>" <?=$Checked?>/>
|
||||
<?=$Val?></label>
|
||||
</td>
|
||||
<?
|
||||
}
|
||||
if($i % 7) {
|
||||
@ -172,6 +237,7 @@ function checked($Checked) {
|
||||
<td style="border:none;" colspan="<?=7 - ($i % 7)?>"></td>
|
||||
<?
|
||||
}
|
||||
*/
|
||||
unset($ReleaseTypes[1023], $ReleaseTypes[1024], $ReleaseTypes[1022]);
|
||||
?>
|
||||
</tr>
|
||||
@ -216,6 +282,13 @@ function checked($Checked) {
|
||||
<label for="autosubscribe">Subscribe to topics when posting</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Quote Notifications</strong></td>
|
||||
<td>
|
||||
<input type="checkbox" name="notifyquotes" id="notifyquotes" <? if (!empty($SiteOptions['NotifyOnQuote'])) { ?>checked="checked"<? } ?> />
|
||||
<label for="notifyquotes">Notifications when somebody quotes you in the forum</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Smileys</strong></td>
|
||||
<td>
|
||||
@ -230,6 +303,56 @@ function checked($Checked) {
|
||||
<label for="disableavatars">Disable avatars</label>
|
||||
</td>
|
||||
</tr>
|
||||
<? /*
|
||||
<tr>
|
||||
<td class="label"><strong>Push Notifications</strong></td>
|
||||
<td>
|
||||
<select name="pushservice" id="pushservice">
|
||||
<option value="0" <? if(empty($PushService)) { ?> selected="selected" <? } ?>/>Disable Push Notifications</option>
|
||||
<option value="1" <? if($PushService == 1) { ?> selected="selected" <? } ?>/>Notify My Android</option>
|
||||
<option value="2" <? if($PushService == 2) { ?> selected="selected" <? } ?>/>Prowl</option>
|
||||
<option value="3" <? if($PushService == 3) { ?> selected="selected" <? } ?>/>Notifo</option>
|
||||
</select>
|
||||
<div id="pushsettings" style="display: none">
|
||||
<br />
|
||||
<label for="pushkey">API Key</label>
|
||||
<input type="text" size="50" name="pushkey" id="pushkey" value="<?=display_str($PushOptions['PushKey'])?>" />
|
||||
<div id="pushsettings_username" style="display: none">
|
||||
<label for="pushusername">Username</label> <input type="text"
|
||||
size="50" name="pushusername" id="pushusername"
|
||||
value="<?=display_str($PushOptions['PushUsername'])?>" />
|
||||
</div>
|
||||
<br />
|
||||
Push me on
|
||||
<br />
|
||||
<input type="checkbox" name="pushfilters[]" value="News" <? if(isset($PushOptions['PushFilters']['News'])) { ?> checked="checked" <? } ?>/>Announcements<br />
|
||||
<input type="checkbox" name="pushfilters[]" value="PM" <? if(isset($PushOptions['PushFilters']['PM'])) { ?> checked="checked" <? } ?>/>Private Messages<br />
|
||||
<?
|
||||
<input type="checkbox" name="pushfilters[]" value="Rippy" <? if(isset($PushOptions['PushFilters']['Rippy'])) { ?> checked="checked" <? } ?>/>Rippys<br />
|
||||
?>
|
||||
[<a href="user.php?action=take_push&push=1&userid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>">Test Push</a>]
|
||||
[<a href="wiki.php?action=article&id=1017>">Wiki Guide</a>]
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
*/ ?>
|
||||
<tr>
|
||||
<td class="label"><strong>Rippy!</strong></td>
|
||||
<td>
|
||||
<select name="rippy">
|
||||
<option value="On" <? if($SiteOptions['Rippy'] == 'On') { ?> selected="selected" <? } ?> >On</option>
|
||||
<option value="Off" <? if($SiteOptions['Rippy'] == 'Off') { ?> selected="selected" <? } ?> >Off</option>
|
||||
<option value="PM" <? if($SiteOptions['Rippy'] == 'PM' || empty($SiteOptions['Rippy'])) { ?> selected="selected" <? } ?> >Personal rippies only</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Auto-save Text</strong></td>
|
||||
<td>
|
||||
<input type="checkbox" name="disableautosave" id="disableautosave" <? if (!empty($SiteOptions['DisableAutoSave'])) { ?>checked="checked"<? } ?> />
|
||||
<label for="disableautosave">Disable reply text from being saved automatically when change pages in a thread</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Download torrents as text files</strong></td>
|
||||
<td>
|
||||
@ -264,7 +387,7 @@ function checked($Checked) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Info</strong></td>
|
||||
<td><textarea name="info" cols="50" rows="8"><?=display_str($Info)?></textarea></td>
|
||||
<td><?php $textarea = new TEXTAREA_PREVIEW('info', 'info', display_str($Info), 50, 8); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>IRCKey</strong></td>
|
||||
|
@ -91,6 +91,7 @@
|
||||
$Cache->delete_value('collage_subs_user_new_'.$UserID);
|
||||
include(SERVER_ROOT.'/sections/user/user.php');
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isset($_REQUEST['id'])) {
|
||||
include(SERVER_ROOT.'/sections/user/user.php');
|
||||
|
@ -192,19 +192,25 @@
|
||||
$Options['DisableSmileys'] = (!empty($_POST['disablesmileys']) ? 1 : 0);
|
||||
$Options['DisableAvatars'] = (!empty($_POST['disableavatars']) ? 1 : 0);
|
||||
$Options['DisablePMAvatars'] = (!empty($_POST['disablepmavatars']) ? 1 : 0);
|
||||
$Options['NotifyOnQuote'] = (!empty($_POST['notifyquotes']) ? 1 : 0);
|
||||
$Options['ShowSnatched'] = (!empty($_POST['showsnatched']) ? 1 : 0);
|
||||
|
||||
|
||||
|
||||
if(isset($LoggedUser['DisableFreeTorrentTop10'])) {
|
||||
$Options['DisableFreeTorrentTop10'] = $LoggedUser['DisableFreeTorrentTop10'];
|
||||
}
|
||||
|
||||
if(!empty($_POST['hidetypes'])) {
|
||||
foreach($_POST['hidetypes'] as $Type) {
|
||||
$Options['HideTypes'][] = (int) $Type;
|
||||
if(!empty($_POST['sorthide'])) {
|
||||
$JSON = json_decode($_POST['sorthide']);
|
||||
foreach($JSON as $J) {
|
||||
$E = explode("_", $J);
|
||||
$Options['SortHide'][$E[0]] = $E[1];
|
||||
}
|
||||
} else {
|
||||
$Options['HideTypes'] = array();
|
||||
$Options['SortHide'] = array();
|
||||
}
|
||||
|
||||
if (check_perms('site_advanced_search')) {
|
||||
$Options['SearchType'] = $_POST['searchtype'];
|
||||
} else {
|
||||
@ -219,6 +225,32 @@
|
||||
$DownloadAlt = (isset($_POST['downloadalt']))? 1:0;
|
||||
$UnseededAlerts = (isset($_POST['unseededalerts']))? 1:0;
|
||||
|
||||
if(isset($_POST['pushnotifications'])) {
|
||||
if($_POST['pushnotifications'] == 1) {
|
||||
$Options['PushService'] = "nma";
|
||||
$Options['PushKey'] = $_POST['pushkey'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Options['PushService'] = "0";
|
||||
}
|
||||
|
||||
if(is_numeric($_POST['pushservice'])) {
|
||||
$CanInsert = true;
|
||||
if($_POST['pushservice'] == 0) {
|
||||
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$LoggedUser[ID]'");
|
||||
if($DB->record_count() == 0) {
|
||||
$CanInsert = false;
|
||||
}
|
||||
}
|
||||
if($CanInsert) {
|
||||
$PushService = db_string($_POST['pushservice']);
|
||||
$PushOptions = array("PushKey" => trim($_POST['pushkey']), "PushUsername" => trim($_POST['pushusername']), "PushFilters" => array_flip($_POST['pushfilters']));
|
||||
$PushOptions = db_string(serialize($PushOptions));
|
||||
$DB->query("INSERT INTO users_push_notifications (UserID, PushService, PushOptions) VALUES ('$LoggedUser[ID]', '$PushService', '$PushOptions')
|
||||
ON DUPLICATE KEY UPDATE PushService = '$PushService', PushOptions = '$PushOptions'");
|
||||
}
|
||||
}
|
||||
// Information on how the user likes to download torrents is stored in cache
|
||||
if($DownloadAlt != $LoggedUser['DownloadAlt']) {
|
||||
$Cache->delete_value('user_'.$LoggedUser['torrent_pass']);
|
||||
@ -248,6 +280,7 @@
|
||||
i.StyleURL='".db_string($_POST['styleurl'])."',
|
||||
i.Avatar='".db_string($_POST['avatar'])."',
|
||||
i.SiteOptions='".db_string(serialize($Options))."',
|
||||
i.NotifyOnQuote = '".db_string($Options['NotifyOnQuote'])."',
|
||||
i.Info='".db_string($_POST['info'])."',
|
||||
i.DownloadAlt='$DownloadAlt',
|
||||
i.UnseededAlerts='$UnseededAlerts',
|
||||
|
@ -159,7 +159,16 @@ function check_paranoia_here($Setting) {
|
||||
<div class="linkbox">
|
||||
<? if (!$OwnProfile) { ?>
|
||||
[<a href="inbox.php?action=compose&to=<?=$UserID?>">Send Message</a>]
|
||||
<? $DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
|
||||
|
||||
<? if(check_perms("users_mod")) {
|
||||
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$UserID'");
|
||||
if($DB->record_count() > 0) { ?>
|
||||
[<a
|
||||
href="user.php?action=take_push&push=1&userid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>">Push
|
||||
User</a>]
|
||||
<? }
|
||||
}
|
||||
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
|
||||
if($DB->record_count() == 0) { ?>
|
||||
[<a href="friends.php?action=add&friendid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>">Add to friends</a>]
|
||||
<? }?>
|
||||
@ -214,22 +223,22 @@ function check_paranoia_here($Setting) {
|
||||
<ul class="stats nobullet">
|
||||
<li>Joined: <?=$JoinedDate?></li>
|
||||
<? if (($Override = check_paranoia_here('lastseen'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Last seen: <?=$LastAccess?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Last seen: <?=$LastAccess?></li>
|
||||
<? } ?>
|
||||
<? if (($Override=check_paranoia_here('uploaded'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Uploaded: <?=Format::get_size($Uploaded)?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded, 2)?></li>
|
||||
<? } ?>
|
||||
<? if (($Override=check_paranoia_here('downloaded'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Downloaded: <?=Format::get_size($Downloaded)?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded, 2)?></li>
|
||||
<? } ?>
|
||||
<? if (($Override=check_paranoia_here('ratio'))) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
|
||||
<? } ?>
|
||||
<? if (($Override=check_paranoia_here('requiredratio')) && isset($RequiredRatio)) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size((double)$RequiredRatio, 5)?>">Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
|
||||
<? } ?>
|
||||
<? if ($OwnProfile || ($Override=check_paranoia_here(false)) || check_perms('users_mod')) { ?>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> ><a href="userhistory.php?action=token_history&userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
|
||||
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?>><a href="userhistory.php?action=token_history&userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -57,14 +57,17 @@
|
||||
break;
|
||||
case 'subscribed_collages':
|
||||
require('subscribed_collages.php');
|
||||
break;
|
||||
case 'catchup_collages':
|
||||
require('catchup_collages.php');
|
||||
break;
|
||||
break;
|
||||
case 'catchup_collages':
|
||||
require('catchup_collages.php');
|
||||
break;
|
||||
|
||||
case 'token_history':
|
||||
require('token_history.php');
|
||||
break;
|
||||
case 'token_history':
|
||||
require('token_history.php');
|
||||
break;
|
||||
case 'quote_notifications':
|
||||
require('quote_notifications.php');
|
||||
break;
|
||||
default:
|
||||
//You trying to mess with me query string? To the home page with you!
|
||||
header('Location: index.php');
|
||||
|
96
sections/userhistory/quote_notifications.php
Normal file
96
sections/userhistory/quote_notifications.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
if (!empty($LoggedUser['DisableForums'])) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$UnreadSQL = "AND q.UnRead = '1'";
|
||||
if ($_GET['showall']) {
|
||||
$UnreadSQL = "";
|
||||
}
|
||||
|
||||
list($Page, $Limit) = Format::page_limit(TOPICS_PER_PAGE);
|
||||
|
||||
View::show_header('Quote Notifications');
|
||||
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
|
||||
}
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS f.ID as ForumID, f.Name as ForumName, t.Title, q.TopicID, q.PostID, q.QuoterID
|
||||
FROM users_notify_quoted AS q LEFT JOIN forums_topics AS t ON t.ID = q.TopicID LEFT JOIN forums AS f ON f.ID = q.ForumID
|
||||
WHERE q.UserID = $LoggedUser[ID] AND ((f.MinClassRead <= '$LoggedUser[Class]'";
|
||||
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql .= ' AND f.ID NOT IN (\'' . $RestrictedForums . '\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if (!empty($PermittedForums)) {
|
||||
$sql .= ' OR f.ID IN (\'' . $PermittedForums . '\')';
|
||||
}
|
||||
$sql .= ") $UnreadSQL ORDER BY q.Date DESC LIMIT $Limit";
|
||||
$DB->query($sql);
|
||||
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($NumResults) = $DB->next_record();
|
||||
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>
|
||||
Quote notifications
|
||||
<?=$NumResults ? " ($NumResults new)" : ""
|
||||
?>
|
||||
</h2>
|
||||
<div class="linkbox pager">
|
||||
<br />
|
||||
<? if ($UnreadSQL) { ?>
|
||||
<a href="userhistory.php?action=quote_notifications&showall=1">Show
|
||||
all quotes</a>
|
||||
<? } else { ?>
|
||||
<a href="userhistory.php?action=quote_notifications">Show unread
|
||||
quotes</a>
|
||||
<? } ?>
|
||||
<a href="userhistory.php?action=subscriptions">Show subscriptions</a>
|
||||
<br /> <br />
|
||||
<?
|
||||
$Pages = Format::get_pages($Page, $NumResults, TOPICS_PER_PAGE, 9);
|
||||
echo $Pages;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
if (!$NumResults) {
|
||||
?>
|
||||
<div class="center">No new quotes.</div>
|
||||
<? } ?>
|
||||
<br />
|
||||
<?
|
||||
foreach ($Results as $Result) {
|
||||
?>
|
||||
<table class='forum_post box vertical_margin noavatar'>
|
||||
<tr class='colhead_dark'>
|
||||
<td colspan="2"><span style="float: left;"> <a
|
||||
href="forums.php?action=viewforum&forumid=<?=$Result['ForumID'] ?>"><?=$Result['ForumName']
|
||||
?></a>
|
||||
> <a
|
||||
href="forums.php?action=viewthread&threadid=<?=$Result['TopicID'] ?>"
|
||||
title="<?=display_str($Result['Title']) ?>"><?=Format::cut_string($Result['Title'], 75)
|
||||
?></a>
|
||||
> Quoted by <?=Users::format_username($Result['QuoterID'], false, false, false, false) ?>
|
||||
</span><span style="float: left;" class="last_read"
|
||||
title="Jump to last read"> <a
|
||||
href="forums.php?action=viewthread&threadid=<?=$Result['TopicID']
|
||||
. ($Result['PostID'] ? '&postid=' . $Result['PostID']
|
||||
. '#post' . $Result['PostID']
|
||||
: '')
|
||||
?>"></a>
|
||||
</span><span id="bar<?=$Result['PostID'] ?>" style="float: right;"> <a
|
||||
href="#">↑</a>
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<? } ?>
|
||||
</div>
|
||||
<? View::show_footer(); ?>
|
@ -118,6 +118,7 @@
|
||||
?>
|
||||
<a href="userhistory.php?action=catchup&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a>
|
||||
<a href="userhistory.php?action=posts&userid=<?=$LoggedUser['ID']?>">Go to post history</a>
|
||||
<a href="userhistory.php?action=quote_notifications">Quote Notifications</a>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
$Text = new TEXT(true);
|
||||
|
||||
if(!empty($_GET['id']) && is_number($_GET['id'])){ //Visiting article via ID
|
||||
$ArticleID = $_GET['id'];
|
||||
@ -35,6 +35,9 @@
|
||||
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
|
||||
if($Read > $LoggedUser['EffectiveClass']){ error('You must be a higher user class to view this wiki article'); }
|
||||
|
||||
$TextBody = $Text->full_format($Body, false);
|
||||
$TOC = $Text->parse_toc(0);
|
||||
|
||||
View::show_header($Title,'wiki,bbcode');
|
||||
?>
|
||||
<div class="thin">
|
||||
@ -51,14 +54,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<!--
|
||||
<div class="box pad">
|
||||
Table of Contents
|
||||
<ul>
|
||||
<li>Deferred for later with the KB broken</li>
|
||||
</ul>
|
||||
<div class="box">
|
||||
<div class="head">Table of Contents</div>
|
||||
<div class="body">
|
||||
<?=$TOC?>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="box pad center">
|
||||
<form class="search_form" name="articles" action="wiki.php" method="get">
|
||||
<input type="hidden" name="action" value="search" />
|
||||
@ -127,7 +128,7 @@
|
||||
</div>
|
||||
<div class="main_column">
|
||||
<div class="box">
|
||||
<div class="pad"><?=$Text->full_format($Body)?></div>
|
||||
<div class="pad"><?=$TextBody?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -116,13 +116,26 @@ var ajax = {
|
||||
};
|
||||
//Bookmarks
|
||||
function Bookmark(type, id, newName) {
|
||||
var lnk = $('#bookmarklink_' + type + '_' + id).raw();
|
||||
var oldName = lnk.innerHTML;
|
||||
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
|
||||
lnk.onclick = function() { Unbookmark(type, id, oldName); return false; };
|
||||
lnk.innerHTML = newName;
|
||||
lnk.title = 'Remove bookmark';
|
||||
});
|
||||
if (window.location.pathname.indexOf('top10.php') != -1) {
|
||||
var oldName = $('.bookmarklink_' + type + '_' + id).raw().innerHTML;
|
||||
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
|
||||
var bookmarklinks = $('.bookmarklink_' + type + '_' + id).objects;
|
||||
for (var i = 0; i < bookmarklinks.length; i++) {
|
||||
$(bookmarklinks[i].parentNode.parentNode.parentNode).add_class('bookmarked');
|
||||
bookmarklinks[i].onclick = function() { Unbookmark(type, id, oldName); return false; };
|
||||
bookmarklinks[i].innerHTML = newName;
|
||||
bookmarklinks[i].title = 'Remove bookmark';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var lnk = $('#bookmarklink_' + type + '_' + id).raw();
|
||||
var oldName = lnk.innerHTML;
|
||||
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
|
||||
lnk.onclick = function() { Unbookmark(type, id, oldName); return false; };
|
||||
lnk.innerHTML = newName;
|
||||
lnk.title = 'Remove bookmark';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Unbookmark(type, id, newName) {
|
||||
@ -132,6 +145,17 @@ function Unbookmark(type, id, newName) {
|
||||
$('.groupid_' + id).remove();
|
||||
$('.bookmark_' + id).remove();
|
||||
});
|
||||
} else if (window.location.pathname.indexOf('top10.php') != -1) {
|
||||
var oldName = $('.bookmarklink_' + type + '_' + id).raw().innerHTML;
|
||||
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
|
||||
var bookmarklinks = $('.bookmarklink_' + type + '_' + id).objects;
|
||||
for (var i = 0; i < bookmarklinks.length; i++) {
|
||||
$(bookmarklinks[i].parentNode.parentNode.parentNode).remove_class('bookmarked');
|
||||
bookmarklinks[i].onclick = function() { Bookmark(type, id, oldName); return false; };
|
||||
bookmarklinks[i].innerHTML = newName;
|
||||
bookmarklinks[i].title = 'Add bookmark';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var lnk = $('#bookmarklink_' + type + '_' + id).raw();
|
||||
var oldName = lnk.innerHTML;
|
||||
|
79
static/functions/class_textareapreview.js
Normal file
79
static/functions/class_textareapreview.js
Normal file
@ -0,0 +1,79 @@
|
||||
var TextareaPreview;
|
||||
jQuery(document).ready(function ($) {
|
||||
TextareaPreview = function (id, textarea_id) {
|
||||
if (typeof(id) === 'number') {
|
||||
var textarea = document.getElementById(textarea_id || 'quickpost_'+id);
|
||||
if (textarea) {
|
||||
this.id = id;
|
||||
this.init(textarea);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TextareaPreview.factory = function (arrays) {
|
||||
var i = 0, j = arrays.length, t;
|
||||
for (i; i < j; i++) {
|
||||
t = arrays[i];
|
||||
t = new TextareaPreview(t[0], t[1]);
|
||||
}
|
||||
}
|
||||
|
||||
TextareaPreview.prototype = {
|
||||
constructor: TextareaPreview,
|
||||
last : false,
|
||||
init : function (textarea) {
|
||||
var toggle = $.proxy(this.toggle, this);
|
||||
this.elements(textarea);
|
||||
|
||||
this.buttons.edit.on('click.preview', toggle);
|
||||
this.el.preview
|
||||
.on('dblclick.preview', toggle)
|
||||
.addClass('text_preview')
|
||||
.attr('title', 'Double click to edit.');
|
||||
|
||||
this.buttons.preview
|
||||
.on('click.preview', $.proxy(this.get, this))
|
||||
.toggleClass('hidden');
|
||||
},
|
||||
elements : function (textarea) {
|
||||
this.el = {
|
||||
textarea : $(textarea),
|
||||
wrap : $('#textarea_wrap_'+this.id),
|
||||
preview : $('#preview_'+this.id),
|
||||
pwrap : $('#preview_wrap_'+this.id)
|
||||
};
|
||||
this.buttons = {
|
||||
edit : $('.button_edit_'+this.id),
|
||||
preview : $('.button_preview_'+this.id)
|
||||
};
|
||||
},
|
||||
toggle : function () {
|
||||
this.el.wrap.toggleClass('hidden');
|
||||
this.el.pwrap.toggleClass('hidden');
|
||||
this.buttons.edit.toggleClass('hidden');
|
||||
this.buttons.preview.toggleClass('hidden');
|
||||
},
|
||||
get : function () {
|
||||
if(this.el.textarea.val().length > 0) {
|
||||
this.toggle();
|
||||
if (this.last !== this.el.textarea.val()) {
|
||||
this.el.preview.text('Loading . . .');
|
||||
this.last = this.el.textarea.val();
|
||||
this.post();
|
||||
}
|
||||
}
|
||||
},
|
||||
post : function () {
|
||||
$.post('ajax.php?action=preview',
|
||||
{ body : this.el.textarea.val() },
|
||||
$.proxy(this.html, this),
|
||||
'html'
|
||||
).fail(function (jqXHR, textStatus) {
|
||||
alert('Request failed: ' + textStatus);
|
||||
});
|
||||
},
|
||||
html : function (data) {
|
||||
this.el.preview.html(data);
|
||||
}
|
||||
};
|
||||
});
|
@ -30,10 +30,11 @@ function Quote(post, user, link) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function Edit_Form(post,key) {
|
||||
$('#reply_box').toggle();
|
||||
postid = post;
|
||||
if (location.href.match(/torrents\.php/)) {
|
||||
if (location.href.match(/torrents\.php/) ||
|
||||
location.href.match(/artist\.php/)) {
|
||||
boxWidth="50";
|
||||
} else {
|
||||
boxWidth="80";
|
||||
@ -49,6 +50,7 @@ function Edit_Form(post,key) {
|
||||
}
|
||||
|
||||
function Cancel_Edit(postid) {
|
||||
$('#reply_box').toggle();
|
||||
$('#bar' + postid).raw().innerHTML = $('#bar' + postid).raw().oldbar;
|
||||
$('#content' + postid).raw().innerHTML = $('#bar' + postid).raw().cancel;
|
||||
}
|
||||
@ -68,6 +70,7 @@ function Cancel_Preview(postid) {
|
||||
}
|
||||
|
||||
function Save_Edit(postid) {
|
||||
$('#reply_box').toggle();
|
||||
if (location.href.match(/forums\.php/)) {
|
||||
ajax.post("forums.php?action=takeedit","form" + postid, function (response) {
|
||||
$('#bar' + postid).raw().innerHTML = "";
|
||||
@ -86,6 +89,12 @@ function Save_Edit(postid) {
|
||||
$('#preview' + postid).raw().innerHTML = response;
|
||||
$('#editbox' + postid).hide();
|
||||
});
|
||||
} else if (location.href.match(/artist\.php/)) {
|
||||
ajax.post("artist.php?action=takeedit_post","form" + postid, function (response) {
|
||||
$('#bar' + postid).raw().innerHTML = "";
|
||||
$('#preview' + postid).raw().innerHTML = response;
|
||||
$('#editbox' + postid).hide();
|
||||
});
|
||||
} else {
|
||||
ajax.post("torrents.php?action=takeedit_post","form" + postid, function (response) {
|
||||
$('#bar' + postid).raw().innerHTML = "";
|
||||
@ -110,6 +119,10 @@ function Delete(post) {
|
||||
ajax.get("requests.php?action=delete_comment&auth=" + authkey + "&postid=" + postid, function () {
|
||||
$('#post' + postid).hide();
|
||||
});
|
||||
} else if (location.href.match(/artist\.php/)) {
|
||||
ajax.get("artist.php?action=delete_comment&auth="+authkey+ "&postid=" + postid, function (){
|
||||
$('#post' + postid).hide();
|
||||
});
|
||||
} else {
|
||||
ajax.get("torrents.php?action=delete_post&auth=" + authkey + "&postid=" + postid, function () {
|
||||
$('#post' + postid).hide();
|
||||
@ -226,3 +239,59 @@ function AddPollOption(id) {
|
||||
item.appendChild(form);
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* HTML5-compatible storage system
|
||||
* Tries to use 'oninput' event to detect text changes and sessionStorage to save it.
|
||||
*
|
||||
* new StoreText('some_textarea_id', 'some_form_id')
|
||||
* The form is required to remove the stored text once it is submitted.
|
||||
**/
|
||||
function StoreText (field, form) {
|
||||
this.field = document.getElementById(field);
|
||||
this.form = document.getElementById(form);
|
||||
this.key = 'auto_save_temp';
|
||||
this.load();
|
||||
}
|
||||
StoreText.prototype = {
|
||||
constructor : StoreText,
|
||||
load : function () {
|
||||
if(this.field && this.enabled()){
|
||||
this.retrieve();
|
||||
this.autosave();
|
||||
this.clearForm();
|
||||
}
|
||||
},
|
||||
enabled : function () {
|
||||
return window.sessionStorage && typeof window.sessionStorage === 'object';
|
||||
},
|
||||
retrieve : function () {
|
||||
var r = sessionStorage.getItem(this.key);
|
||||
if (r) {
|
||||
this.field.value = sessionStorage.getItem(this.key);
|
||||
}
|
||||
},
|
||||
remove : function () {
|
||||
sessionStorage.removeItem(this.key);
|
||||
},
|
||||
save : function () {
|
||||
sessionStorage.setItem(this.key, this.field.value);
|
||||
},
|
||||
autosave : function () {
|
||||
jQuery(this.field).on(this.getInputEvent(), jQuery.proxy(this.save, this));
|
||||
},
|
||||
getInputEvent : function () {
|
||||
var e;
|
||||
if ('oninput' in this.field) {
|
||||
e = 'input';
|
||||
} else if (document.body.addEventListener) {
|
||||
e = 'change keyup paste cut';
|
||||
} else {
|
||||
e = 'propertychange';
|
||||
}
|
||||
return e;
|
||||
},
|
||||
clearForm : function () {
|
||||
jQuery(this.form).submit(jQuery.proxy(this.remove, this));
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
function Clear(torrentid) {
|
||||
ajax.get("?action=notify_clearitem&torrentid=" + torrentid + "&auth=" + authkey, function() {
|
||||
ajax.get("?action=notify_clear_item&torrentid=" + torrentid + "&auth=" + authkey, function() {
|
||||
$("#torrent" + torrentid).remove();
|
||||
});
|
||||
}
|
||||
|
26
static/functions/push_settings.js
Normal file
26
static/functions/push_settings.js
Normal file
@ -0,0 +1,26 @@
|
||||
(function ($) {
|
||||
$(document).ready(function() {
|
||||
if($("#pushservice").val() > 0) {
|
||||
$('#pushsettings').show();
|
||||
if($("#pushservice").val() == 3) {
|
||||
$('#pushsettings_username').show();
|
||||
}
|
||||
}
|
||||
$("#pushservice").change(function() {
|
||||
if($(this).val() > 0) {
|
||||
$('#pushsettings').show(500);
|
||||
if($(this).val() == 3) {
|
||||
$('#pushsettings_username').show();
|
||||
}
|
||||
else {
|
||||
$('#pushsettings_username').hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#pushsettings').hide(500);
|
||||
$('#pushsettings_username').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
||||
|
35
static/functions/release_sort.js
Normal file
35
static/functions/release_sort.js
Normal file
@ -0,0 +1,35 @@
|
||||
//Couldn't use an associative array because javascript sorting is stupid http://dev-answers.blogspot.com/2012/03/javascript-object-keys-being-sorted-in.html
|
||||
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
serialize();
|
||||
$("#sortable").sortable({
|
||||
placeholder: "ui-state-highlight",
|
||||
update: function() {
|
||||
serialize();
|
||||
}
|
||||
});
|
||||
$("#toggle_sortable").click(function () {
|
||||
$('#sortable_container').slideToggle(function() {
|
||||
$("#toggle_sortable").text($(this).is(":visible") ? "Collapse" : "Expand");
|
||||
});
|
||||
});
|
||||
});
|
||||
function serialize() {
|
||||
var a = new Array();
|
||||
$("#sortable").find("input").each(function (i) {
|
||||
$(this).unbind("click");
|
||||
$(this).click(function() {
|
||||
var c = $(this).attr("checked") == "checked" ? 1 : 0;
|
||||
var old_id = $(this).attr("id");
|
||||
var new_id = old_id.slice(0, - 1) + c;
|
||||
$(this).attr("id", new_id);
|
||||
serialize();
|
||||
});
|
||||
a.push($(this).attr("id"));
|
||||
});
|
||||
$("#sorthide").val(JSON.stringify(a));
|
||||
}
|
||||
}
|
||||
(jQuery));
|
||||
|
@ -1,13 +1,14 @@
|
||||
function say() {
|
||||
ajax.get("ajax.php?action=rippy", function (message) {
|
||||
if(message) {
|
||||
$('#rippy-says').raw().innerHTML = message;
|
||||
$('#bubble').raw().style.display = "block";
|
||||
} else {
|
||||
$('#bubble').raw().style.display = "none";
|
||||
}
|
||||
}
|
||||
);
|
||||
ajax.get("ajax.php?action=rippy", function(message) {
|
||||
if (message) {
|
||||
$('#rippywrap').raw().style.display = "inline";
|
||||
$('#rippy-says').raw().innerHTML = message;
|
||||
$('#bubble').raw().style.display = "block";
|
||||
} else {
|
||||
$('#bubble').raw().style.display = "none";
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function rippyclick() {
|
||||
|
@ -1,82 +1,105 @@
|
||||
var sortCollageTable;
|
||||
jQuery(document).ready(function ($) {
|
||||
sortCollageTable = {
|
||||
counter: function () {
|
||||
var x = 10;
|
||||
$('.sort_numbers').each(function () {
|
||||
this.value = x;
|
||||
x += 10;
|
||||
});
|
||||
this.serializer();
|
||||
},
|
||||
color : function () {
|
||||
var i = 0, css;
|
||||
$('.drag').each(function () {
|
||||
css = i % 2 === 0 ? ['rowa', 'rowb'] : ['rowb', 'rowa'];
|
||||
$(this).removeClass(css[0]).addClass(css[1]);
|
||||
i++;
|
||||
});
|
||||
},
|
||||
serializer : function () {
|
||||
var s = this.container.sortable('serialize');
|
||||
this.serialInput.val(s);
|
||||
},
|
||||
save : function () {
|
||||
this.form.submit();
|
||||
},
|
||||
widthFix : function(e, row) {
|
||||
row.children('td').each(function () {
|
||||
$(this).width($(this).width());
|
||||
});
|
||||
return row;
|
||||
},
|
||||
init : function () {
|
||||
this.container = $('#manage_collage_table');
|
||||
this.form = $('#drag_drop_collage_form');
|
||||
this.serialInput = $('#drag_drop_collage_sort_order');
|
||||
$('.drag_drop_save').toggleClass('hidden');
|
||||
var sortableTable;
|
||||
jQuery(document).ready(function ($) {
|
||||
sortableTable = {
|
||||
container : $('#manage_collage_table'),
|
||||
form : $('#drag_drop_collage_form'),
|
||||
serialInput : $('#drag_drop_collage_sort_order'),
|
||||
check : $('#check_all'),
|
||||
counter : function () {
|
||||
var x = 10;
|
||||
$('input.sort_numbers').each(function () {
|
||||
this.value = x;
|
||||
x += 10;
|
||||
});
|
||||
this.serializer();
|
||||
},
|
||||
color : function () {
|
||||
var i = 0, css;
|
||||
$('tr.drag').each(function () {
|
||||
css = i % 2 === 0 ? ['rowa', 'rowb'] : ['rowb', 'rowa'];
|
||||
$(this).removeClass(css[0]).addClass(css[1]);
|
||||
i++;
|
||||
});
|
||||
},
|
||||
serializer : function () {
|
||||
this.serialInput.val(this.container.sortable('serialize'));
|
||||
},
|
||||
save : function () {
|
||||
sortableTable.form.submit();
|
||||
},
|
||||
widthFix : function(e, row) {
|
||||
row.children('td').each(function () {
|
||||
$(this).width($(this).width());
|
||||
});
|
||||
return row;
|
||||
},
|
||||
init : function () {
|
||||
$('.drag_drop_save').removeClass('hidden');
|
||||
|
||||
this.container.sortable({
|
||||
items: '.drag',
|
||||
axis: 'y',
|
||||
containment: '.thin',
|
||||
forcePlaceholderSize: true,
|
||||
helper: sortCollageTable.widthFix,
|
||||
stop: function () {
|
||||
sortCollageTable.postSort();
|
||||
}
|
||||
});
|
||||
this.noteToggle();
|
||||
this.draggable();
|
||||
this.tableSorter();
|
||||
|
||||
$('.save_sortable_collage').click(function () {
|
||||
sortCollageTable.save();
|
||||
});
|
||||
|
||||
this.tableSorter();
|
||||
},
|
||||
tableSorter : function () {
|
||||
this.container.tablesorter({
|
||||
cssHeader : 'headerSort',
|
||||
textExtraction: sortCollageTable.extractor,
|
||||
headers : {
|
||||
0: {
|
||||
sorter : false
|
||||
},
|
||||
6: {
|
||||
sorter : false
|
||||
}
|
||||
}
|
||||
});
|
||||
this.container.bind('sortEnd', function () {
|
||||
sortCollageTable.postSort();
|
||||
});
|
||||
},
|
||||
extractor : function (node) {
|
||||
return node.textContent || node.innerText;
|
||||
},
|
||||
postSort : function () {
|
||||
this.color();
|
||||
this.counter();
|
||||
if (this.check.length !== 0) {
|
||||
this.checks();
|
||||
} else {
|
||||
$('.save_sortable_collage').click(sortableTable.save);
|
||||
}
|
||||
};
|
||||
sortCollageTable.init();
|
||||
});
|
||||
},
|
||||
draggable : function () {
|
||||
this.container.sortable({
|
||||
items: '.drag',
|
||||
axis: 'y',
|
||||
containment: '.thin',
|
||||
forcePlaceholderSize: true,
|
||||
helper: sortableTable.widthFix,
|
||||
stop: sortableTable.postSort
|
||||
});
|
||||
},
|
||||
tableSorter : function () {
|
||||
this.container.tablesorter({
|
||||
cssHeader : 'headerSort',
|
||||
textExtraction: sortableTable.extractor,
|
||||
headers : {
|
||||
0: {
|
||||
sorter : false
|
||||
},
|
||||
6: {
|
||||
sorter : false
|
||||
}
|
||||
}
|
||||
}).on('sortEnd', sortableTable.postSort);
|
||||
},
|
||||
extractor : function (node) {
|
||||
return node.textContent || node.innerText;
|
||||
},
|
||||
postSort : function () {
|
||||
sortableTable.color();
|
||||
sortableTable.counter();
|
||||
},
|
||||
noteToggle : function () {
|
||||
var span = $('<a href="#" title="Toggle Note">(Hide)</a>').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('#drag_drop_textnote > :first-child').toggle();
|
||||
$this = $(this);
|
||||
$this.text($this.text() === '(Hide)' ? '(Show)' : '(Hide)');
|
||||
});
|
||||
$('#sorting_head').append(' ', span);
|
||||
},
|
||||
checks : function () {
|
||||
this.check.on('click', 'input', function () {
|
||||
var s = this.checked ?
|
||||
'td.center :checkbox:not(:checked)' :
|
||||
'td.center :checked';
|
||||
$(s).click();
|
||||
}).find('span').html('<input type="checkbox" />');
|
||||
|
||||
this.container.on('click', 'td > :checkbox', function() {
|
||||
$(this).parents('tr').toggleClass('row_checked');
|
||||
}).on('dblclick', 'tr.drag', function () {
|
||||
$(this).find(':checkbox').click();
|
||||
});
|
||||
}
|
||||
};
|
||||
sortableTable.init();
|
||||
});
|
@ -252,3 +252,53 @@ function Vote(amount, requestid) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function DownVoteGroup(groupid, authkey) {
|
||||
ajax.get('ajax.php?action=votefavorite&do=vote&groupid='+groupid+'&vote=down'+'&auth='+authkey, function (response) {
|
||||
if (response == 'noaction') {
|
||||
//No increment
|
||||
} else if (response == 'success') {
|
||||
$('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) + 1;
|
||||
}
|
||||
}
|
||||
);
|
||||
$('#vote_message').hide();
|
||||
$('#unvote_message').show();
|
||||
$('#upvoted').hide();
|
||||
$('#downvoted').show();
|
||||
}
|
||||
|
||||
function UpVoteGroup(groupid, authkey) {
|
||||
ajax.get('ajax.php?action=votefavorite&do=vote&groupid='+groupid+'&vote=up'+'&auth='+authkey, function (response) {
|
||||
if (response == 'noaction') {
|
||||
//No increment
|
||||
} else if (response == 'success') {
|
||||
// Increment both the upvote count and the total votes count
|
||||
$('#upvotes').raw().innerHTML = (parseInt($('#upvotes').raw().innerHTML)) + 1;
|
||||
$('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) + 1;
|
||||
}
|
||||
}
|
||||
);
|
||||
$('#vote_message').hide();
|
||||
$('#unvote_message').show();
|
||||
$('#upvoted').show();
|
||||
$('#downvoted').hide();
|
||||
}
|
||||
|
||||
function UnvoteGroup(groupid, authkey) {
|
||||
ajax.get('ajax.php?action=votefavorite&do=unvote&groupid='+groupid+'&auth='+authkey, function (response) {
|
||||
if (response == 'noaction') {
|
||||
//No increment
|
||||
} else if (response == 'success-down') {
|
||||
$('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) - 1;
|
||||
} else if (response == 'success-up') {
|
||||
$('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) - 1;
|
||||
$('#upvotes').raw().innerHTML = (parseInt($('#upvotes').raw().innerHTML)) - 1;
|
||||
}
|
||||
}
|
||||
);
|
||||
$('#vote_message').show();
|
||||
$('#unvote_message').hide();
|
||||
$('#upvoted').hide();
|
||||
$('#downvoted').hide();
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
function Categories() {
|
||||
ajax.get('ajax.php?action=upload_section&categoryid=' + $('#categories').raw().value, function (response) {
|
||||
$('#dynamic_form').raw().innerHTML = response;
|
||||
// Evaluate the code that generates previews.
|
||||
eval(jQuery('#dynamic_form script.preview_code').html());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ strong.quoteheader{color: #878787;}
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki .sidebar ul ul {
|
||||
#wiki .sidebar ul ul, #wiki .sidebar ol ol {
|
||||
margin: 0 0 0 10px;
|
||||
}
|
||||
|
||||
@ -2001,3 +2001,6 @@ ul#userinfo_random li a:hover {
|
||||
font-size: 1.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before { content:""; }
|
||||
tr.torrent .bookmark > a:after { content:""; }
|
||||
|
@ -1,6 +1,19 @@
|
||||
.box h3 {
|
||||
font-size: 140%;
|
||||
}
|
||||
.box h4 {
|
||||
font-size: 130%;
|
||||
}
|
||||
.box h5 {
|
||||
font-size: 120%;
|
||||
}
|
||||
.box h6 {
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
pre br {
|
||||
line-height:0px;
|
||||
display:none;
|
||||
line-height: 0px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.center {
|
||||
@ -28,9 +41,9 @@ ul.collage_images li {
|
||||
}
|
||||
|
||||
ul.collage_images li a {
|
||||
display: block;
|
||||
height: 118px;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
height: 118px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ul.collage_images img {
|
||||
@ -38,8 +51,7 @@ ul.collage_images img {
|
||||
width: 118px;
|
||||
}
|
||||
|
||||
|
||||
.selected a{
|
||||
.selected a {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
@ -71,47 +83,47 @@ ul.collage_images img {
|
||||
|
||||
.log1 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.log2 {
|
||||
color: yellow;
|
||||
}
|
||||
.log2 {
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.log3 {
|
||||
color: #0E88C6;
|
||||
}
|
||||
.log3 {
|
||||
color: #0E88C6;
|
||||
}
|
||||
|
||||
.log4 {
|
||||
.log4 {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.log5 {
|
||||
.log5 {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.good {
|
||||
font-weight: bold;
|
||||
color: green;
|
||||
}
|
||||
.good {
|
||||
font-weight: bold;
|
||||
color: green;
|
||||
}
|
||||
|
||||
.bad {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
.bad {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.goodish {
|
||||
font-weight: bold;
|
||||
color: #35BF00;
|
||||
}
|
||||
.goodish {
|
||||
font-weight: bold;
|
||||
color: #35BF00;
|
||||
}
|
||||
|
||||
.badish {
|
||||
font-weight: bold;
|
||||
color: #E5B244;
|
||||
}
|
||||
.badish {
|
||||
font-weight: bold;
|
||||
color: #E5B244;
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow: auto;
|
||||
}
|
||||
pre {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
@ -121,17 +133,21 @@ ul.collage_images img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form textarea, form input {max-width:100%;}
|
||||
form textarea,form input {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
a.beta {
|
||||
font-weight: bold;
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
strong.important_text {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
.invalid, .warning, .error, .new {
|
||||
|
||||
.invalid,.warning,.error,.new {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
@ -170,47 +186,168 @@ div#AddArtists a {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.rippywrap { z-index:25; display: block; position: fixed; background: transparent url('../rippy/rippy.png') no-repeat bottom center; color: black; text-align: center; width: 190px; height: 180px; bottom: 0px; right: 0px; }
|
||||
.rippywrap div.rippy { z-index: 25; height: 111px; width: 190px; position: fixed; bottom: 0px; right: 0px; }
|
||||
span.rbt { display: block; padding: 8px 0 0; background: url('../rippy/rippy_top.gif') no-repeat top; }
|
||||
span.rbm { display: block; background: url('../rippy/rippy_middle.gif') repeat bottom; padding: 2px; }
|
||||
span.rbb { display: block; padding: 4px 0px 18px; margin-bottom: 5px; background: url('../rippy/rippy_bottom.gif') no-repeat bottom; }
|
||||
.rippywrap {
|
||||
z-index: 25;
|
||||
display: block;
|
||||
position: fixed;
|
||||
background: transparent url('../rippy/rippy_bday.png') no-repeat bottom
|
||||
center;
|
||||
color: black;
|
||||
text-align: center;
|
||||
width: 190px;
|
||||
height: 180px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
span.secondary_class { font-size:85%; font-weight:bold; }
|
||||
.breadcrumbs { font-weight: bold; text-align: right; }
|
||||
.rippywrap div.rippy {
|
||||
z-index: 25;
|
||||
height: 111px;
|
||||
width: 190px;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
span.rbt {
|
||||
display: block;
|
||||
padding: 8px 0 0;
|
||||
background: url('../rippy/rippy_top.gif') no-repeat top;
|
||||
}
|
||||
|
||||
span.rbm {
|
||||
display: block;
|
||||
background: url('../rippy/rippy_middle.gif') repeat bottom;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.rbb {
|
||||
display: block;
|
||||
padding: 4px 0px 18px;
|
||||
margin-bottom: 5px;
|
||||
background: url('../rippy/rippy_bottom.gif') no-repeat bottom;
|
||||
}
|
||||
|
||||
span.secondary_class {
|
||||
font-size: 85%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.breadcrumbs {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
<<<<<<<
|
||||
HEAD
|
||||
.paranoia_override {
|
||||
font-style: italic;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#manage_collage_table.ui-sortable .drag {
|
||||
cursor: n-resize;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
#manage_collage_table.ui-sortable .ui-sortable-helper.drag {
|
||||
cursor:grabbing;
|
||||
cursor:-moz-grabbing;
|
||||
cursor:-webkit-grabbing;
|
||||
cursor: grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
#manage_collage_table .ui-sortable-helper td,
|
||||
#manage_collage_table .ui-sortable-placeholder {
|
||||
|
||||
#manage_collage_table .ui-sortable-helper td,#manage_collage_table .ui-sortable-placeholder
|
||||
{
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.drag_drop_save {
|
||||
padding: 6px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.headerSort {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.headerSort span {
|
||||
background: url("../common/table-order.png") no-repeat scroll right -38px transparent;
|
||||
padding: 0px 20px 0 0;
|
||||
}
|
||||
.headerSortDown span {
|
||||
background: url("../common/table-order.png") no-repeat scroll right 4px transparent;
|
||||
}
|
||||
.headerSortUp span {
|
||||
background: url("../common/table-order.png") no-repeat scroll right -79px transparent;
|
||||
background: url("../common/table-order.png") no-repeat scroll right
|
||||
-38px transparent;
|
||||
padding: 0px 20px 0 0;
|
||||
}
|
||||
|
||||
.headerSortDown span {
|
||||
background: url("../common/table-order.png") no-repeat scroll right 4px
|
||||
transparent;
|
||||
}
|
||||
|
||||
.headerSortUp span {
|
||||
background: url("../common/table-order.png") no-repeat scroll right
|
||||
-79px transparent;
|
||||
}
|
||||
|
||||
.album_votes {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.favoritecount {
|
||||
font-size: 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.votedalbums li {
|
||||
list-style: none;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark>a:before {
|
||||
content: "[ ";
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark>a:after {
|
||||
content: " ]";
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#sortable {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#sortable li {
|
||||
padding: 0px;
|
||||
font-size: 1.2em;
|
||||
height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
.ui-state-highlight {
|
||||
background: #007DC6 /*{bgColorHighlight}*/;
|
||||
opacity : 0.15;
|
||||
width: 50%;
|
||||
|
||||
}
|
||||
.navigation_list {
|
||||
list-style-position: inside;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.navigation_list > li {
|
||||
list-style-type: upper-roman !important;
|
||||
}
|
||||
.navigation_list li li {
|
||||
list-style-type: upper-alpha;
|
||||
}
|
||||
.navigation_list li li li {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
.navigation_list li li li li {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
.text_preview { min-height: 100px }
|
||||
|
||||
|
@ -1409,3 +1409,7 @@ body#forums .poll li.graph {
|
||||
.lightbox .colhead span {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.navigation_list li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
@ -888,3 +888,6 @@ form tr {
|
||||
font-size: 1.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before { color:#999; }
|
||||
tr.torrent .bookmark > a:after { color:#999; }
|
||||
|
@ -781,3 +781,10 @@ ul .invitetree {
|
||||
font-size: 1.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before {
|
||||
color:black;
|
||||
}
|
||||
tr.torrent .bookmark > a:after {
|
||||
color:black;
|
||||
}
|
||||
|
@ -537,3 +537,12 @@ h3{margin:10px 0}
|
||||
font-size: 1.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
tr.torrent .bookmark > a:before { content:""; }
|
||||
tr.torrent .bookmark > a:after { content:""; }
|
||||
|
||||
.sidebar .navigation_list li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
|
@ -1185,3 +1185,6 @@ table.debug_table td.debug_query_data>div {
|
||||
.nobr {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before { content:""; }
|
||||
tr.torrent .bookmark > a:after { content:""; }
|
||||
|
@ -1045,3 +1045,10 @@ select:hover, option:hover {
|
||||
ul, ol{
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before {
|
||||
color:#646054;
|
||||
}
|
||||
tr.torrent .bookmark > a:after {
|
||||
color:#646054;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ strong.quoteheader {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki .sidebar ul ul {
|
||||
#wiki .sidebar ul ul, #wiki .sidebar ol ol {
|
||||
margin: 0 0 0 10px;
|
||||
}
|
||||
|
||||
@ -1735,3 +1735,6 @@ div.invitetree ul.invitetree {
|
||||
table.noavatar, table.noavatar tr, table.noavatar td.body, table.noavatar td.body div {
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
tr.torrent .bookmark > a:before { content:""; }
|
||||
tr.torrent .bookmark > a:after { content:""; }
|
||||
|
@ -25,3 +25,12 @@ ul.collage_images img {
|
||||
#drag_drop_textnote ul {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
|
||||
tr.torrent .bookmark > a:before { content:""; }
|
||||
tr.torrent .bookmark > a:after { content:""; }
|
||||
|
||||
.navigation_list li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user