mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
69c8524bff
commit
e78e066207
@ -83,7 +83,7 @@ public static function all_bookmarks($Type, $UserID = false) {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
$CacheKey = 'bookmarks_' . $Type . '_' . $UserID;
|
||||
if (($Bookmarks = $Cache->get_value($CacheKey)) === FALSE) {
|
||||
if (($Bookmarks = $Cache->get_value($CacheKey)) === false) {
|
||||
list ($Table, $Col) = self::bookmark_schema($Type);
|
||||
$DB->query("SELECT $Col FROM $Table WHERE UserID = '$UserID'");
|
||||
$Bookmarks = $DB->collect($Col);
|
||||
|
@ -91,10 +91,10 @@ public function get_cpu_time() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function log_var($Var, $VarName = FALSE) {
|
||||
public function log_var($Var, $VarName = false) {
|
||||
$BackTrace = debug_backtrace();
|
||||
$ID = uniqid();
|
||||
if(!$VarName) {
|
||||
if (!$VarName) {
|
||||
$VarName = $ID;
|
||||
}
|
||||
$File = array('path' => substr($BackTrace[0]['file'], strlen(SERVER_ROOT)), 'line' => $BackTrace[0]['line']);
|
||||
@ -103,7 +103,7 @@ public function log_var($Var, $VarName = FALSE) {
|
||||
|
||||
public function set_flag($Event) {
|
||||
global $ScriptStartTime;
|
||||
$this->Flags[] = array($Event, (microtime(true)-$ScriptStartTime)*1000, memory_get_usage(true), $this->get_cpu_time());
|
||||
$this->Flags[] = array($Event, (microtime(true) - $ScriptStartTime) * 1000, memory_get_usage(true), $this->get_cpu_time());
|
||||
}
|
||||
|
||||
//This isn't in the constructor because $this is not available, and the function cannot be made static
|
||||
@ -118,7 +118,7 @@ protected function format_args($Array) {
|
||||
$Return = array();
|
||||
foreach ($Array as $Key => $Val) {
|
||||
$Return[$Key] = '';
|
||||
if (!is_int($Key) || $Key != $LastKey+1) {
|
||||
if (!is_int($Key) || $Key != $LastKey + 1) {
|
||||
$Return[$Key] .= "'$Key' => ";
|
||||
}
|
||||
if ($Val === true) {
|
||||
@ -194,7 +194,7 @@ public function php_error_handler($Level, $Error, $File, $Line) {
|
||||
|
||||
/*
|
||||
//Hiding "session_start(): Server 10.10.0.1 (tcp 11211) failed with: No route to host (113)" errors
|
||||
if($Call != "session_start") {
|
||||
if ($Call != "session_start") {
|
||||
$this->Errors[] = array($Error, $File.':'.$Line, $Call, $Args);
|
||||
}
|
||||
*/
|
||||
@ -277,13 +277,13 @@ public function get_sphinx_time() {
|
||||
}
|
||||
|
||||
public function get_sphinxql_queries() {
|
||||
if(class_exists('Sphinxql')) {
|
||||
if (class_exists('Sphinxql')) {
|
||||
return Sphinxql::$Queries;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_sphinxql_time() {
|
||||
if(class_exists('Sphinxql')) {
|
||||
if (class_exists('Sphinxql')) {
|
||||
return Sphinxql::$Time;
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ public function perf_table($Perf=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_perf').toggle();return false;">(View)</a> Performance stats:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_perf').toggle();return false;" class="brackets">View</a> Performance stats:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_perf" class="debug_table hidden" width="100%">
|
||||
@ -339,7 +339,7 @@ public function include_table($Includes=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_include').toggle();return false;">(View)</a> <?=number_format(count($Includes))?> Includes:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_include').toggle();return false;" class="brackets">View</a> <?=number_format(count($Includes))?> Includes:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_include" class="debug_table hidden" width="100%">
|
||||
@ -363,7 +363,7 @@ public function class_table($Classes=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_classes').toggle();return false;">(View)</a> Classes:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_classes').toggle();return false;" class="brackets">View</a> Classes:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_classes" class="debug_table hidden" width="100%">
|
||||
@ -380,7 +380,7 @@ public function extension_table() {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_extensions').toggle();return false;">(View)</a> Extensions:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_extensions').toggle();return false;" class="brackets">View</a> Extensions:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_extensions" class="debug_table hidden" width="100%">
|
||||
@ -403,7 +403,7 @@ public function flag_table($Flags=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_flags').toggle();return false;">(View)</a> Flags:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_flags').toggle();return false;" class="brackets">View</a> Flags:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_flags" class="debug_table hidden" width="100%">
|
||||
@ -441,7 +441,7 @@ public function constant_table($Constants=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_constants').toggle();return false;">(View)</a> Constants:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_constants').toggle();return false;" class="brackets">View</a> Constants:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_constants" class="debug_table hidden" width="100%">
|
||||
@ -469,11 +469,11 @@ public function cache_table($CacheKeys=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_cache').toggle();return false;">(View)</a><?=$Header?></strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_cache').toggle();return false;" class="brackets">View</a><?=$Header?></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_cache" class="debug_table hidden" width="100%">
|
||||
<? foreach($CacheKeys as $Key) { ?>
|
||||
<? foreach ($CacheKeys as $Key) { ?>
|
||||
<tr>
|
||||
<td align="left" class="debug_info debug_cache_key">
|
||||
<a href="#" onclick="$('#debug_cache_<?=$Key?>').toggle(); return false;"><?=display_str($Key)?></a>
|
||||
@ -497,7 +497,7 @@ public function error_table($Errors=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_error').toggle();return false;">(View)</a> <?=number_format(count($Errors))?> Errors:</strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_error').toggle();return false;" class="brackets">View</a> <?=number_format(count($Errors))?> Errors:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_error" class="debug_table hidden" width="100%">
|
||||
@ -536,7 +536,7 @@ public function query_table($Queries=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_database').toggle();return false;">(View)</a><?=$Header?></strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_database').toggle();return false;" class="brackets">View</a><?=$Header?></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_database" class="debug_table hidden" width="100%">
|
||||
@ -546,7 +546,7 @@ public function query_table($Queries=false) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="debug_data debug_query_data"><div><?=str_replace("\t", ' ', nl2br(display_str($SQL)))?></div></td>
|
||||
<td class="rowa debug_info debug_query_time" style="width:130px;" align="left"><?=number_format($Time, 5)?> ms</td>
|
||||
<td class="rowa debug_info debug_query_time" style="width: 130px;" align="left"><?=number_format($Time, 5)?> ms</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
@ -559,10 +559,10 @@ public function sphinx_table($Queries=false) {
|
||||
$Header = 'Searches';
|
||||
if (!is_array($Queries)) {
|
||||
$Queries = $this->get_sphinx_queries();
|
||||
if($QueriesQL = $this->get_sphinxql_queries()) {
|
||||
if ($QueriesQL = $this->get_sphinxql_queries()) {
|
||||
$Queries = array_merge($Queries, $QueriesQL);
|
||||
}
|
||||
$Header .= ' ('.number_format($this->get_sphinx_time()+$this->get_sphinxql_time(), 5).' ms)';
|
||||
$Header .= ' ('.number_format($this->get_sphinx_time() + $this->get_sphinxql_time(), 5).' ms)';
|
||||
}
|
||||
if (empty($Queries)) {
|
||||
return;
|
||||
@ -571,7 +571,7 @@ public function sphinx_table($Queries=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_sphinx').toggle();return false;">(View)</a><?=$Header?></strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_sphinx').toggle();return false;" class="brackets">View</a><?=$Header?></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_sphinx" class="debug_table hidden" width="100%">
|
||||
@ -581,7 +581,7 @@ public function sphinx_table($Queries=false) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="debug_data debug_sphinx_data"><pre><?=str_replace("\t", ' ', $Params)?></pre></td>
|
||||
<td class="rowa debug_info debug_sphinx_time" style="width:130px;" align="left"><?=number_format($Time, 5)?> ms</td>
|
||||
<td class="rowa debug_info debug_sphinx_time" style="width: 130px;" align="left"><?=number_format($Time, 5)?> ms</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
@ -593,7 +593,7 @@ public function sphinx_table($Queries=false) {
|
||||
public function vars_table($Vars=false) {
|
||||
$Header = 'Logged Variables';
|
||||
if (empty($Vars)) {
|
||||
if(empty($this->LoggedVars)) {
|
||||
if (empty($this->LoggedVars)) {
|
||||
return;
|
||||
}
|
||||
$Vars = $this->LoggedVars;
|
||||
@ -603,12 +603,12 @@ public function vars_table($Vars=false) {
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_loggedvars').toggle();return false;">(View)</a><?=$Header?></strong></td>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_loggedvars').toggle();return false;" class="brackets">View</a><?=$Header?></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_loggedvars" class="debug_table hidden" width="100%">
|
||||
<?
|
||||
foreach($Vars as $ID => $Var) {
|
||||
foreach ($Vars as $ID => $Var) {
|
||||
list($Key, $Data) = each($Var);
|
||||
$Size = count($Data['data']);
|
||||
?>
|
||||
|
@ -72,8 +72,7 @@ class MASS_USER_TORRENTS_TABLE_VIEW
|
||||
* @param string $EditType
|
||||
* @param string $Heading
|
||||
*/
|
||||
public function __construct (array &$TorrentList, array &$CollageDataList, $EditType, $Heading = null)
|
||||
{
|
||||
public function __construct (array &$TorrentList, array &$CollageDataList, $EditType, $Heading = null) {
|
||||
global $UserID, $LoggedUser;
|
||||
|
||||
$this->set_heading($Heading);
|
||||
@ -86,11 +85,12 @@ public function __construct (array &$TorrentList, array &$CollageDataList, $Edit
|
||||
$this->CollageDataList = $CollageDataList;
|
||||
|
||||
$this->HasTorrents = !empty($TorrentList);
|
||||
if(!$this->HasTorrents) $this->no_torrents();
|
||||
if (!$this->HasTorrents) {
|
||||
$this->no_torrents();
|
||||
}
|
||||
}
|
||||
|
||||
private function no_torrents ()
|
||||
{
|
||||
private function no_torrents () {
|
||||
?>
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
@ -106,8 +106,7 @@ private function no_torrents ()
|
||||
/**
|
||||
* Renders a complete page and table
|
||||
*/
|
||||
public function render_all ()
|
||||
{
|
||||
public function render_all () {
|
||||
$this->header();
|
||||
$this->body();
|
||||
$this->footer();
|
||||
@ -117,8 +116,7 @@ public function render_all ()
|
||||
* Renders a comptele page/table header: div#thin, h2, scripts, notes,
|
||||
* form, table, etc.
|
||||
*/
|
||||
public function header ()
|
||||
{
|
||||
public function header () {
|
||||
if ($this->HasTorrents) :
|
||||
?>
|
||||
|
||||
@ -149,13 +147,13 @@ public function header ()
|
||||
<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 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:5%"><span>Bookmarked</span></th>
|
||||
<th style="width:1%" id="check_all"><span>Remove</span></th>
|
||||
<th style="width: 5%"><span>Bookmarked</span></th>
|
||||
<th style="width: 1%" id="check_all"><span>Remove</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -166,8 +164,7 @@ public function header ()
|
||||
/**
|
||||
* Closes header code
|
||||
*/
|
||||
public function footer ()
|
||||
{
|
||||
public function footer () {
|
||||
if ($this->HasTorrents) :
|
||||
?>
|
||||
|
||||
@ -192,8 +189,7 @@ public function footer ()
|
||||
* Formats data for use in row
|
||||
*
|
||||
*/
|
||||
public function body ()
|
||||
{
|
||||
public function body () {
|
||||
if ($this->HasTorrents)
|
||||
foreach ($this->TorrentList as $GroupID => $Group) {
|
||||
$Artists = array();
|
||||
@ -221,8 +217,7 @@ public function body ()
|
||||
* @param string $DisplayName
|
||||
* @param string $TorrentLink
|
||||
*/
|
||||
public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink, $DateAdded)
|
||||
{
|
||||
public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink, $DateAdded) {
|
||||
$CSS = $this->NumGroups % 2 === 0 ? 'rowa' : 'rowb';
|
||||
?>
|
||||
|
||||
@ -248,8 +243,7 @@ public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink, $D
|
||||
* @param string $VanityHouse
|
||||
* @return string $DisplayName
|
||||
*/
|
||||
static public function display_name (array &$ExtendedArtists, array &$Artists, $VanityHouse)
|
||||
{
|
||||
static public function display_name (array &$ExtendedArtists, array &$Artists, $VanityHouse) {
|
||||
$DisplayName = '';
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4])
|
||||
|| !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
@ -265,8 +259,7 @@ static public function display_name (array &$ExtendedArtists, array &$Artists, $
|
||||
/**
|
||||
* Renders buttons used at the top and bottom of the table
|
||||
*/
|
||||
public function buttons ()
|
||||
{
|
||||
public function buttons () {
|
||||
?>
|
||||
<div class="drag_drop_save">
|
||||
<input type="submit" name="update" value="Update Ranking" title="Save your rank." class="save_sortable_collage" />
|
||||
@ -279,8 +272,7 @@ public function buttons ()
|
||||
/**
|
||||
* @param string $EditType
|
||||
*/
|
||||
public function set_edit_type ($EditType)
|
||||
{
|
||||
public function set_edit_type ($EditType) {
|
||||
$this->EditType = $EditType;
|
||||
}
|
||||
|
||||
@ -288,8 +280,7 @@ public function set_edit_type ($EditType)
|
||||
* Set's the current page's heading
|
||||
* @param string $Heading
|
||||
*/
|
||||
public function set_heading ($Heading)
|
||||
{
|
||||
public function set_heading ($Heading) {
|
||||
$this->Heading = $Heading;
|
||||
}
|
||||
}
|
@ -126,8 +126,8 @@ function db_string($String,$DisableWildcards=false) {
|
||||
|
||||
function db_array($Array, $DontEscape = array(), $Quote = false) {
|
||||
foreach ($Array as $Key => $Val) {
|
||||
if(!in_array($Key, $DontEscape)) {
|
||||
if($Quote) {
|
||||
if (!in_array($Key, $DontEscape)) {
|
||||
if ($Quote) {
|
||||
$Array[$Key] = '\''.db_string(trim($Val)).'\'';
|
||||
} else {
|
||||
$Array[$Key] = db_string(trim($Val));
|
||||
@ -175,7 +175,7 @@ function halt($Msg) {
|
||||
$Debug->analysis('!dev DB Error',$DBError,3600*24);
|
||||
if (DEBUG_MODE || check_perms('site_debug') || isset($argv[1])) {
|
||||
echo '<pre>'.display_str($DBError).'</pre>';
|
||||
if(DEBUG_MODE || check_perms('site_debug')) {
|
||||
if (DEBUG_MODE || check_perms('site_debug')) {
|
||||
print_r($this->Queries);
|
||||
}
|
||||
die();
|
||||
@ -185,7 +185,7 @@ function halt($Msg) {
|
||||
}
|
||||
|
||||
function connect() {
|
||||
if(!$this->LinkID) {
|
||||
if (!$this->LinkID) {
|
||||
$this->LinkID = mysqli_connect($this->Server, $this->User, $this->Pass, $this->Database, $this->Port, $this->Socket); // defined in config.php
|
||||
if (!$this->LinkID) {
|
||||
$this->Errno = mysqli_connect_errno();
|
||||
@ -200,9 +200,9 @@ function query($Query,$AutoHandle=1) {
|
||||
$QueryStartTime=microtime(true);
|
||||
$this->connect();
|
||||
//In the event of a mysql deadlock, we sleep allowing mysql time to unlock then attempt again for a maximum of 5 tries
|
||||
for($i=1; $i<6; $i++) {
|
||||
for($i = 1; $i < 6; $i++) {
|
||||
$this->QueryID = mysqli_query($this->LinkID,$Query);
|
||||
if(!in_array(mysqli_errno($this->LinkID), array(1213, 1205))) {
|
||||
if (!in_array(mysqli_errno($this->LinkID), array(1213, 1205))) {
|
||||
break;
|
||||
}
|
||||
$Debug->analysis('Non-Fatal Deadlock:',$Query,3600*24);
|
||||
@ -243,18 +243,18 @@ function query_unb($Query) {
|
||||
}
|
||||
|
||||
function inserted_id() {
|
||||
if($this->LinkID) {
|
||||
if ($this->LinkID) {
|
||||
return mysqli_insert_id($this->LinkID);
|
||||
}
|
||||
}
|
||||
|
||||
function next_record($Type=MYSQLI_BOTH, $Escape = true) { // $Escape can be true, false, or an array of keys to not escape
|
||||
if($this->LinkID) {
|
||||
if ($this->LinkID) {
|
||||
$this->Record = mysqli_fetch_array($this->QueryID,$Type);
|
||||
$this->Row++;
|
||||
if (!is_array($this->Record)) {
|
||||
$this->QueryID = FALSE;
|
||||
} elseif($Escape !== FALSE){
|
||||
$this->QueryID = false;
|
||||
} elseif ($Escape !== false) {
|
||||
$this->Record = Misc::display_array($this->Record, $Escape);
|
||||
}
|
||||
return $this->Record;
|
||||
@ -262,11 +262,11 @@ function next_record($Type=MYSQLI_BOTH, $Escape = true) { // $Escape can be true
|
||||
}
|
||||
|
||||
function close() {
|
||||
if($this->LinkID) {
|
||||
if(!mysqli_close($this->LinkID)) {
|
||||
if ($this->LinkID) {
|
||||
if (!mysqli_close($this->LinkID)) {
|
||||
$this->halt('Cannot close connection or connection did not open.');
|
||||
}
|
||||
$this->LinkID = FALSE;
|
||||
$this->LinkID = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ function record_count() {
|
||||
}
|
||||
|
||||
function affected_rows() {
|
||||
if($this->LinkID) {
|
||||
if ($this->LinkID) {
|
||||
return mysqli_affected_rows($this->LinkID);
|
||||
}
|
||||
}
|
||||
@ -301,11 +301,11 @@ function escape_str($Str) {
|
||||
// Otherwise, use an integer
|
||||
function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) {
|
||||
$Return = array();
|
||||
while($Row = mysqli_fetch_array($this->QueryID,$Type)){
|
||||
if($Escape!==FALSE) {
|
||||
while ($Row = mysqli_fetch_array($this->QueryID,$Type)) {
|
||||
if ($Escape !== false) {
|
||||
$Row = Misc::display_array($Row, $Escape);
|
||||
}
|
||||
if($Key !== false) {
|
||||
if ($Key !== false) {
|
||||
$Return[$Row[$Key]] = $Row;
|
||||
} else {
|
||||
$Return[]=$Row;
|
||||
|
@ -472,14 +472,14 @@ public static function regenerate_filelist($TorrentID) {
|
||||
JOIN torrents AS t ON t.ID=tf.TorrentID
|
||||
JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
||||
WHERE tf.TorrentID = ".$TorrentID);
|
||||
if($DB->record_count() > 0) {
|
||||
if ($DB->record_count() > 0) {
|
||||
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
|
||||
if (Misc::is_new_torrent($Contents)) {
|
||||
$Tor = new BencodeTorrent($Contents);
|
||||
$FilePath = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : "";
|
||||
$FilePath = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : '';
|
||||
} else {
|
||||
$Tor = new TORRENT(unserialize(base64_decode($Contents)), true);
|
||||
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
|
||||
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : '';
|
||||
}
|
||||
list($TotalSize, $FileList) = $Tor->file_list();
|
||||
foreach($FileList as $File) {
|
||||
@ -753,17 +753,32 @@ public static function has_snatched($TorrentID, $AllUsers = false) {
|
||||
public static function edition_string(array $Torrent, array $Group) {
|
||||
if ($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
|
||||
$EditionName = $Torrent['RemasterYear'];
|
||||
$AddExtra = " - ";
|
||||
if ($Torrent['RemasterRecordLabel']) { $EditionName .= $AddExtra . display_str($Torrent['RemasterRecordLabel']); $AddExtra = ' / '; }
|
||||
if ($Torrent['RemasterCatalogueNumber']) { $EditionName .= $AddExtra . display_str($Torrent['RemasterCatalogueNumber']); $AddExtra = ' / '; }
|
||||
if ($Torrent['RemasterTitle']) { $EditionName .= $AddExtra . display_str($Torrent['RemasterTitle']); $AddExtra = ' / '; }
|
||||
$AddExtra = ' - ';
|
||||
if ($Torrent['RemasterRecordLabel']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterRecordLabel']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrent['RemasterCatalogueNumber']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterCatalogueNumber']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrent['RemasterTitle']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterTitle']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
$EditionName .= $AddExtra . display_str($Torrent['Media']);
|
||||
} else {
|
||||
$AddExtra = " / ";
|
||||
if(!$Torrent['Remastered']) {
|
||||
if (!$Torrent['Remastered']) {
|
||||
$EditionName = "Original Release";
|
||||
if ($Group['RecordLabel']) { $EditionName .= $AddExtra . $Group['RecordLabel']; $AddExtra = ' / '; }
|
||||
if ($Group['CatalogueNumber']) { $EditionName .= $AddExtra . $Group['CatalogueNumber']; $AddExtra = ' / '; }
|
||||
if ($Group['RecordLabel']) {
|
||||
$EditionName .= $AddExtra . $Group['RecordLabel'];
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Group['CatalogueNumber']) {
|
||||
$EditionName .= $AddExtra . $Group['CatalogueNumber'];
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
} else {
|
||||
$EditionName = "Unknown Release(s)";
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public function browser(&$UserAgentString) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($this->mobile($UserAgentString)) {
|
||||
if ($this->mobile($UserAgentString)) {
|
||||
$Return .= ' Mobile';
|
||||
}
|
||||
return $Return;
|
||||
|
@ -9,92 +9,163 @@ class VALIDATE {
|
||||
var $Fields=array();
|
||||
|
||||
function SetFields($FieldName,$Required,$FieldType,$ErrorMessage,$Options=array()) {
|
||||
$this->Fields[$FieldName]['Type']=strtolower($FieldType);
|
||||
$this->Fields[$FieldName]['Required']=$Required;
|
||||
$this->Fields[$FieldName]['ErrorMessage']=$ErrorMessage;
|
||||
if(!empty($Options['maxlength'])) {
|
||||
$this->Fields[$FieldName]['MaxLength']=$Options['maxlength'];
|
||||
$this->Fields[$FieldName]['Type'] = strtolower($FieldType);
|
||||
$this->Fields[$FieldName]['Required'] = $Required;
|
||||
$this->Fields[$FieldName]['ErrorMessage'] = $ErrorMessage;
|
||||
if (!empty($Options['maxlength'])) {
|
||||
$this->Fields[$FieldName]['MaxLength'] = $Options['maxlength'];
|
||||
}
|
||||
if(!empty($Options['minlength'])) {
|
||||
$this->Fields[$FieldName]['MinLength']=$Options['minlength'];
|
||||
if (!empty($Options['minlength'])) {
|
||||
$this->Fields[$FieldName]['MinLength'] = $Options['minlength'];
|
||||
}
|
||||
if(!empty($Options['comparefield'])) {
|
||||
$this->Fields[$FieldName]['CompareField']=$Options['comparefield'];
|
||||
if (!empty($Options['comparefield'])) {
|
||||
$this->Fields[$FieldName]['CompareField'] = $Options['comparefield'];
|
||||
}
|
||||
if(!empty($Options['allowperiod'])) {
|
||||
$this->Fields[$FieldName]['AllowPeriod']=$Options['allowperiod'];
|
||||
if (!empty($Options['allowperiod'])) {
|
||||
$this->Fields[$FieldName]['AllowPeriod'] = $Options['allowperiod'];
|
||||
}
|
||||
if(!empty($Options['allowcomma'])) {
|
||||
$this->Fields[$FieldName]['AllowComma']=$Options['allowcomma'];
|
||||
if (!empty($Options['allowcomma'])) {
|
||||
$this->Fields[$FieldName]['AllowComma'] = $Options['allowcomma'];
|
||||
}
|
||||
if(!empty($Options['inarray'])) {
|
||||
$this->Fields[$FieldName]['InArray']=$Options['inarray'];
|
||||
if (!empty($Options['inarray'])) {
|
||||
$this->Fields[$FieldName]['InArray'] = $Options['inarray'];
|
||||
}
|
||||
if(!empty($Options['regex'])) {
|
||||
$this->Fields[$FieldName]['Regex']=$Options['regex'];
|
||||
if (!empty($Options['regex'])) {
|
||||
$this->Fields[$FieldName]['Regex'] = $Options['regex'];
|
||||
}
|
||||
}
|
||||
|
||||
function ValidateForm($ValidateArray) {
|
||||
reset($this->Fields);
|
||||
foreach ($this->Fields as $FieldKey => $Field) {
|
||||
$ValidateVar=$ValidateArray[$FieldKey];
|
||||
$ValidateVar = $ValidateArray[$FieldKey];
|
||||
|
||||
if($ValidateVar!="" || !empty($Field['Required']) || $Field['Type']=="date") {
|
||||
if($Field['Type']=="string") {
|
||||
if(isset($Field['MaxLength'])) { $MaxLength=$Field['MaxLength']; } else { $MaxLength=255; }
|
||||
if(isset($Field['MinLength'])) { $MinLength=$Field['MinLength']; } else { $MinLength=1; }
|
||||
if ($ValidateVar != '' || !empty($Field['Required']) || $Field['Type'] == 'date') {
|
||||
if ($Field['Type'] == 'string') {
|
||||
if (isset($Field['MaxLength'])) {
|
||||
$MaxLength = $Field['MaxLength'];
|
||||
} else {
|
||||
$MaxLength = 255;
|
||||
}
|
||||
if (isset($Field['MinLength'])) {
|
||||
$MinLength = $Field['MinLength'];
|
||||
} else {
|
||||
$MinLength = 1;
|
||||
}
|
||||
|
||||
if(strlen($ValidateVar)>$MaxLength) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)<$MinLength) { return $Field['ErrorMessage']; }
|
||||
if (strlen($ValidateVar) > $MaxLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) < $MinLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="number") {
|
||||
if(isset($Field['MaxLength'])) { $MaxLength=$Field['MaxLength']; } else { $MaxLength=''; }
|
||||
if(isset($Field['MinLength'])) { $MinLength=$Field['MinLength']; } else { $MinLength=0; }
|
||||
} elseif ($Field['Type'] == 'number') {
|
||||
if (isset($Field['MaxLength'])) {
|
||||
$MaxLength = $Field['MaxLength'];
|
||||
} else {
|
||||
$MaxLength = '';
|
||||
}
|
||||
if (isset($Field['MinLength'])) {
|
||||
$MinLength = $Field['MinLength'];
|
||||
} else {
|
||||
$MinLength = 0;
|
||||
}
|
||||
|
||||
$Match='0-9';
|
||||
if(isset($Field['AllowPeriod'])) { $Match.='.'; }
|
||||
if(isset($Field['AllowComma'])) { $Match.=','; }
|
||||
$Match = '0-9';
|
||||
if (isset($Field['AllowPeriod'])) {
|
||||
$Match.='.';
|
||||
}
|
||||
if (isset($Field['AllowComma'])) {
|
||||
$Match.=',';
|
||||
}
|
||||
|
||||
if(preg_match('/[^'.$Match.']/', $ValidateVar) || strlen($ValidateVar)<1) { return $Field['ErrorMessage']; }
|
||||
elseif($MaxLength!="" && $ValidateVar>$MaxLength) { return $Field['ErrorMessage']."!!"; }
|
||||
elseif($ValidateVar<$MinLength) { return $Field['ErrorMessage']."$MinLength"; }
|
||||
if (preg_match('/[^'.$Match.']/', $ValidateVar) || strlen($ValidateVar) < 1) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif ($MaxLength != '' && $ValidateVar > $MaxLength) {
|
||||
return $Field['ErrorMessage'].'!!';
|
||||
} elseif ($ValidateVar < $MinLength) {
|
||||
return $Field['ErrorMessage']."$MinLength";
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="email") {
|
||||
if(isset($Field['MaxLength'])) { $MaxLength=$Field['MaxLength']; } else { $MaxLength=255; }
|
||||
if(isset($Field['MinLength'])) { $MinLength=$Field['MinLength']; } else { $MinLength=6; }
|
||||
} elseif ($Field['Type'] == 'email') {
|
||||
if (isset($Field['MaxLength'])) {
|
||||
$MaxLength = $Field['MaxLength'];
|
||||
} else {
|
||||
$MaxLength = 255;
|
||||
}
|
||||
if (isset($Field['MinLength'])) {
|
||||
$MinLength = $Field['MinLength'];
|
||||
} else {
|
||||
$MinLength = 6;
|
||||
}
|
||||
|
||||
if(!preg_match("/^".EMAIL_REGEX."$/i", $ValidateVar)) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)>$MaxLength) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)<$MinLength) { return $Field['ErrorMessage']; }
|
||||
if (!preg_match("/^".EMAIL_REGEX."$/i", $ValidateVar)) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) > $MaxLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) < $MinLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="link") {
|
||||
if(isset($Field['MaxLength'])) { $MaxLength=$Field['MaxLength']; } else { $MaxLength=255; }
|
||||
if(isset($Field['MinLength'])) { $MinLength=$Field['MinLength']; } else { $MinLength=10; }
|
||||
} elseif ($Field['Type'] == 'link') {
|
||||
if (isset($Field['MaxLength'])) {
|
||||
$MaxLength = $Field['MaxLength'];
|
||||
} else {
|
||||
$MaxLength = 255;
|
||||
}
|
||||
if (isset($Field['MinLength'])) {
|
||||
$MinLength = $Field['MinLength'];
|
||||
} else {
|
||||
$MinLength = 10;
|
||||
}
|
||||
|
||||
if(!preg_match('/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i', $ValidateVar)) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)>$MaxLength) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)<$MinLength) { return $Field['ErrorMessage']; }
|
||||
if (!preg_match('/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i', $ValidateVar)) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) > $MaxLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) < $MinLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="username") {
|
||||
if(isset($Field['MaxLength'])) { $MaxLength=$Field['MaxLength']; } else { $MaxLength=20; }
|
||||
if(isset($Field['MinLength'])) { $MinLength=$Field['MinLength']; } else { $MinLength=1; }
|
||||
} elseif ($Field['Type'] == 'username') {
|
||||
if (isset($Field['MaxLength'])) {
|
||||
$MaxLength = $Field['MaxLength'];
|
||||
} else {
|
||||
$MaxLength = 20;
|
||||
}
|
||||
if (isset($Field['MinLength'])) {
|
||||
$MinLength = $Field['MinLength'];
|
||||
} else {
|
||||
$MinLength = 1;
|
||||
}
|
||||
|
||||
if(preg_match('/[^a-z0-9_\-?]/i', $ValidateVar)) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)>$MaxLength) { return $Field['ErrorMessage']; }
|
||||
elseif(strlen($ValidateVar)<$MinLength) { return $Field['ErrorMessage']; }
|
||||
if (preg_match('/[^a-z0-9_\-?]/i', $ValidateVar)) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) > $MaxLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
} elseif (strlen($ValidateVar) < $MinLength) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="checkbox") {
|
||||
if(!isset($ValidateArray[$FieldKey])) { return $Field['ErrorMessage']; }
|
||||
} elseif ($Field['Type'] == 'checkbox') {
|
||||
if (!isset($ValidateArray[$FieldKey])) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="compare") {
|
||||
if($ValidateArray[$Field['CompareField']]!=$ValidateVar) { return $Field['ErrorMessage']; }
|
||||
} elseif ($Field['Type'] == 'compare') {
|
||||
if ($ValidateArray[$Field['CompareField']]!=$ValidateVar) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="inarray") {
|
||||
if(array_search($ValidateVar, $Field['InArray'])===false) { return $Field['ErrorMessage']; }
|
||||
} elseif ($Field['Type'] == 'inarray') {
|
||||
if (array_search($ValidateVar, $Field['InArray']) === false) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="regex") {
|
||||
if(!preg_match($Field['Regex'], $ValidateVar)) { return $Field['ErrorMessage']; }
|
||||
} elseif ($Field['Type'] == 'regex') {
|
||||
if (!preg_match($Field['Regex'], $ValidateVar)) {
|
||||
return $Field['ErrorMessage'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} // while
|
||||
@ -108,52 +179,90 @@ function GenerateJS($FormID) {
|
||||
|
||||
reset($this->Fields);
|
||||
foreach ($this->Fields as $FieldKey => $Field) {
|
||||
if($Field['Type']=="string") {
|
||||
$ValItem=' if($(\'#'.$FieldKey.'\').raw().value==""';
|
||||
if(!empty($Field['MaxLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength']; } else { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255'; }
|
||||
if(!empty($Field['MinLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength']; }
|
||||
if ($Field['Type'] == 'string') {
|
||||
$ValItem=' if ($(\'#'.$FieldKey.'\').raw().value==""';
|
||||
if (!empty($Field['MaxLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength'];
|
||||
} else {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255';
|
||||
}
|
||||
if (!empty($Field['MinLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength'];
|
||||
}
|
||||
$ValItem.=') { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="number") {
|
||||
} elseif ($Field['Type'] == 'number') {
|
||||
$Match='0-9';
|
||||
if(!empty($Field['AllowPeriod'])) { $Match.='.'; }
|
||||
if(!empty($Field['AllowComma'])) { $Match.=','; }
|
||||
if (!empty($Field['AllowPeriod'])) {
|
||||
$Match.='.';
|
||||
}
|
||||
if (!empty($Field['AllowComma'])) {
|
||||
$Match.=',';
|
||||
}
|
||||
|
||||
$ValItem=' if($(\'#'.$FieldKey.'\').raw().value.match(/[^'.$Match.']/) || $(\'#'.$FieldKey.'\').raw().value.length<1';
|
||||
if(!empty($Field['MaxLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value/1>'.$Field['MaxLength']; }
|
||||
if(!empty($Field['MinLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value/1<'.$Field['MinLength']; }
|
||||
$ValItem=' if ($(\'#'.$FieldKey.'\').raw().value.match(/[^'.$Match.']/) || $(\'#'.$FieldKey.'\').raw().value.length<1';
|
||||
if (!empty($Field['MaxLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value/1>'.$Field['MaxLength'];
|
||||
}
|
||||
if (!empty($Field['MinLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value/1<'.$Field['MinLength'];
|
||||
}
|
||||
$ValItem.=') { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="email") {
|
||||
$ValItem=' if(!validEmail($(\'#'.$FieldKey.'\').raw().value)';
|
||||
if(!empty($Field['MaxLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength']; } else { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255'; }
|
||||
if(!empty($Field['MinLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength']; } else { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<6'; }
|
||||
} elseif ($Field['Type'] == 'email') {
|
||||
$ValItem=' if (!validEmail($(\'#'.$FieldKey.'\').raw().value)';
|
||||
if (!empty($Field['MaxLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength'];
|
||||
} else {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255';
|
||||
}
|
||||
if (!empty($Field['MinLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength'];
|
||||
} else {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<6';
|
||||
}
|
||||
$ValItem.=') { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="link") {
|
||||
$ValItem=' if(!validLink($(\'#'.$FieldKey.'\').raw().value)';
|
||||
if(!empty($Field['MaxLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength']; } else { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255'; }
|
||||
if(!empty($Field['MinLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength']; } else { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<10'; }
|
||||
} elseif ($Field['Type'] == 'link') {
|
||||
$ValItem=' if (!validLink($(\'#'.$FieldKey.'\').raw().value)';
|
||||
if (!empty($Field['MaxLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength'];
|
||||
} else {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>255';
|
||||
}
|
||||
if (!empty($Field['MinLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength'];
|
||||
} else {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<10';
|
||||
}
|
||||
$ValItem.=') { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="username") {
|
||||
$ValItem=' if($(\'#'.$FieldKey.'\').raw().value.match(/[^a-zA-Z0-9_\-]/)';
|
||||
if(!empty($Field['MaxLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength']; }
|
||||
if(!empty($Field['MinLength'])) { $ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength']; }
|
||||
} elseif ($Field['Type'] == 'username') {
|
||||
$ValItem = ' if ($(\'#'.$FieldKey.'\').raw().value.match(/[^a-zA-Z0-9_\-]/)';
|
||||
if (!empty($Field['MaxLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length>'.$Field['MaxLength'];
|
||||
}
|
||||
if (!empty($Field['MinLength'])) {
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'\').raw().value.length<'.$Field['MinLength'];
|
||||
}
|
||||
$ValItem.=') { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="regex") {
|
||||
$ValItem=' if(!$(\'#'.$FieldKey.'\').raw().value.match('.$Field['Regex'].')) { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
} elseif ($Field['Type'] == 'regex') {
|
||||
$ValItem=' if (!$(\'#'.$FieldKey.'\').raw().value.match('.$Field['Regex'].')) { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="date") {
|
||||
$DisplayError=$FieldKey."month";
|
||||
if(isset($Field['MinLength']) && $Field['MinLength']==3) { $Day='$(\'#'.$FieldKey.'day\').raw().value'; $DisplayError.=",".$FieldKey."day"; } else { $Day="1"; }
|
||||
} elseif ($Field['Type'] == 'date') {
|
||||
$DisplayError = $FieldKey.'month';
|
||||
if (isset($Field['MinLength']) && $Field['MinLength'] == 3) {
|
||||
$Day = '$(\'#'.$FieldKey.'day\').raw().value'; $DisplayError.=",".$FieldKey."day";
|
||||
} else {
|
||||
$Day = '1';
|
||||
}
|
||||
$DisplayError.=",".$FieldKey."year";
|
||||
$ValItemHold=' if(!validDate($(\'#'.$FieldKey.'month\').raw().value+\'/\'+'.$Day.'+\'/\'+$(\'#'.$FieldKey.'year\').raw().value)) { return showError(\''.$DisplayError.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
$ValItemHold=' if (!validDate($(\'#'.$FieldKey.'month\').raw().value+\'/\'+'.$Day.'+\'/\'+$(\'#'.$FieldKey.'year\').raw().value)) { return showError(\''.$DisplayError.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
if(empty($Field['Required'])) {
|
||||
$ValItem=' if($(\'#'.$FieldKey.'month\').raw().value!=""';
|
||||
if(isset($Field['MinLength']) && $Field['MinLength']==3) { $ValItem.=' || $(\'#'.$FieldKey.'day\').raw().value!=""'; }
|
||||
if (empty($Field['Required'])) {
|
||||
$ValItem=' if ($(\'#'.$FieldKey.'month\').raw().value!=""';
|
||||
if (isset($Field['MinLength']) && $Field['MinLength'] == 3) { $ValItem.=' || $(\'#'.$FieldKey.'day\').raw().value!=""'; }
|
||||
$ValItem.=' || $(\'#'.$FieldKey.'year\').raw().value!="") {'."\r\n";
|
||||
$ValItem.=$ValItemHold;
|
||||
$ValItem.=" }\r\n";
|
||||
@ -161,15 +270,15 @@ function GenerateJS($FormID) {
|
||||
$ValItem.=$ValItemHold;
|
||||
}
|
||||
|
||||
} elseif($Field['Type']=="checkbox") {
|
||||
$ValItem=' if(!$(\'#'.$FieldKey.'\').checked) { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
} elseif ($Field['Type'] == 'checkbox') {
|
||||
$ValItem=' if (!$(\'#'.$FieldKey.'\').checked) { return showError(\''.$FieldKey.'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
|
||||
} elseif($Field['Type']=="compare") {
|
||||
$ValItem=' if($(\'#'.$FieldKey.'\').raw().value!=$(\'#'.$Field['CompareField'].'\').raw().value) { return showError(\''.$FieldKey.','.$Field['CompareField'].'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
} elseif ($Field['Type'] == 'compare') {
|
||||
$ValItem=' if ($(\'#'.$FieldKey.'\').raw().value!=$(\'#'.$Field['CompareField'].'\').raw().value) { return showError(\''.$FieldKey.','.$Field['CompareField'].'\',\''.$Field['ErrorMessage'].'\'); }'."\r\n";
|
||||
}
|
||||
|
||||
if(empty($Field['Required']) && $Field['Type']!="date") {
|
||||
$ReturnJS.=' if($(\'#'.$FieldKey.'\').raw().value!="") {'."\r\n ";
|
||||
if (empty($Field['Required']) && $Field['Type'] != 'date') {
|
||||
$ReturnJS.=' if ($(\'#'.$FieldKey.'\').raw().value!="") {'."\r\n ";
|
||||
$ReturnJS.=$ValItem;
|
||||
$ReturnJS.=" }\r\n";
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ public static function get_user_votes($UserID) {
|
||||
}
|
||||
|
||||
$UserVotes = $Cache->get_value('voted_albums_'.$UserID);
|
||||
if ($UserVotes === FALSE) {
|
||||
if ($UserVotes === false) {
|
||||
$DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$UserID);
|
||||
$UserVotes = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
||||
$Cache->cache_value('voted_albums_'.$UserID, $UserVotes);
|
||||
@ -54,7 +54,7 @@ public static function get_group_votes($GroupID) {
|
||||
global $DB, $Cache;
|
||||
|
||||
$GroupVotes = $Cache->get_value('votes_'.$GroupID);
|
||||
if ($GroupVotes === FALSE) {
|
||||
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);
|
||||
@ -204,7 +204,7 @@ public static function get_rank_all($GroupID) {
|
||||
}
|
||||
|
||||
$Rankings = $Cache->get_value('voting_ranks_overall');
|
||||
if ($Rankings === FALSE) {
|
||||
if ($Rankings === false) {
|
||||
$Rankings = array();
|
||||
$i = 0;
|
||||
$DB->query("SELECT GroupID FROM torrents_votes ORDER BY Score DESC LIMIT 100");
|
||||
@ -235,7 +235,7 @@ public static function get_rank_year($GroupID, $Year) {
|
||||
}
|
||||
|
||||
$Rankings = $Cache->get_value('voting_ranks_year_'.$Year);
|
||||
if ($Rankings === FALSE) {
|
||||
if ($Rankings === false) {
|
||||
$Rankings = array();
|
||||
$i = 0;
|
||||
$DB->query("SELECT GroupID
|
||||
@ -274,7 +274,7 @@ public static function get_rank_decade($GroupID, $Year) {
|
||||
$Year = $Year - ($Year % 10);
|
||||
|
||||
$Rankings = $Cache->get_value('voting_ranks_decade_'.$Year);
|
||||
if ($Rankings === FALSE) {
|
||||
if ($Rankings === false) {
|
||||
$Rankings = array();
|
||||
$i = 0;
|
||||
$DB->query("SELECT GroupID
|
||||
|
@ -79,8 +79,10 @@
|
||||
/*
|
||||
//Handles timestamps
|
||||
function dostime($TimeStamp = 0) {
|
||||
if(!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
|
||||
if($TimeStamp == '0000-00-00 00:00:00') { return 'Never'; }
|
||||
if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
|
||||
if ($TimeStamp == '0000-00-00 00:00:00') {
|
||||
return 'Never';
|
||||
}
|
||||
$TimeStamp = strtotime($TimeStamp);
|
||||
}
|
||||
$Date = ($TimeStamp == 0) ? getdate() : getdate($TimeStamp);
|
||||
|
@ -30,10 +30,10 @@ function is_number($Str) {
|
||||
* @return string escaped string.
|
||||
*/
|
||||
function display_str($Str) {
|
||||
if ($Str === NULL || $Str === FALSE || is_array($Str)) {
|
||||
if ($Str === NULL || $Str === false || is_array($Str)) {
|
||||
return '';
|
||||
}
|
||||
if ($Str!='' && !is_number($Str)) {
|
||||
if ($Str != '' && !is_number($Str)) {
|
||||
$Str = Format::make_utf8($Str);
|
||||
$Str = mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
|
||||
$Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&",$Str);
|
||||
|
@ -20,11 +20,11 @@
|
||||
$Load = sys_getloadavg();
|
||||
?>
|
||||
<p>Site and design © <?=date("Y")?> <?=SITE_NAME?></p>
|
||||
<? if(!empty($LastActive)) { ?>
|
||||
<? if (!empty($LastActive)) { ?>
|
||||
<p><a href="user.php?action=sessions" title="Manage sessions">Last activity <?=time_diff($LastActive['LastUpdate'])?> from <?=$LastActive['IP']?>.</a></p>
|
||||
<? } ?>
|
||||
<p>
|
||||
<strong>Time:</strong> <?=number_format(((microtime(true)-$ScriptStartTime)*1000),5)?> ms
|
||||
<strong>Time:</strong> <?=number_format(((microtime(true) - $ScriptStartTime) * 1000),5)?> ms
|
||||
<strong>Used:</strong> <?=Format::get_size(memory_get_usage(true))?>
|
||||
<strong>Load:</strong> <?=number_format($Load[0],2).' '.number_format($Load[1],2).' '.number_format($Load[2],2)?>
|
||||
<strong>Date:</strong> <?=date('M d Y, H:i')?>
|
||||
|
@ -26,11 +26,21 @@
|
||||
global $LoggedUser, $HeavyInfo, $UserSubscriptions, $ThreadInfo,
|
||||
$ForumsDoublePost;
|
||||
|
||||
if ($LoggedUser['DisablePosting']) return;
|
||||
if (!isset($TextareaCols)) $TextareaCols = 70;
|
||||
if (!isset($TextareaRows)) $TextareaRows = 8;
|
||||
if (!isset($InputAction)) $InputAction = 'reply';
|
||||
if (!isset($InputTitle)) $InputTitle = 'Post comment';
|
||||
if ($LoggedUser['DisablePosting']) {
|
||||
return;
|
||||
}
|
||||
if (!isset($TextareaCols)) {
|
||||
$TextareaCols = 70;
|
||||
}
|
||||
if (!isset($TextareaRows)) {
|
||||
$TextareaRows = 8;
|
||||
}
|
||||
if (!isset($InputAction)) {
|
||||
$InputAction = 'reply';
|
||||
}
|
||||
if (!isset($InputTitle)) {
|
||||
$InputTitle = 'Post comment';
|
||||
}
|
||||
|
||||
// TODO: Remove inline styles
|
||||
|
||||
@ -52,18 +62,18 @@
|
||||
<div class="box pad">
|
||||
<table class="forum_post box vertical_margin hidden preview_wrap" id="preview_wrap_<?=$ReplyText->getID()?>">
|
||||
<colgroup>
|
||||
<? if(Users::has_avatars_enabled()) { ?>
|
||||
<? if (Users::has_avatars_enabled()) { ?>
|
||||
<col class="col_avatar" />
|
||||
<? } ?>
|
||||
<col class="col_post_body" />
|
||||
</colgroup>
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
|
||||
<div style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
<div style="float: left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
|
||||
</div>
|
||||
<div style="float:right;">
|
||||
[<a href="#quickreplypreview">Report</a>]
|
||||
<div style="float: right;">
|
||||
<a href="#quickreplypreview" class="brackets">Report</a>
|
||||
|
||||
<a href="#">↑</a>
|
||||
</div>
|
||||
@ -76,13 +86,13 @@
|
||||
</td>
|
||||
<? } ?>
|
||||
<td class="body" valign="top">
|
||||
<div id="contentpreview" style="text-align:left;">
|
||||
<div id="contentpreview" style="text-align: left;">
|
||||
<div id="preview_<?=$ReplyText->getID()?>"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class="send_form center" name="reply" id="quickpostform" action="" method="post"<? if(!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled=true;" <? } ?>>
|
||||
<form class="send_form center" name="reply" id="quickpostform" action="" method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled=true;" <? } ?>>
|
||||
<input type="hidden" name="action" value="<?=$InputAction?>" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
|
||||
@ -98,7 +108,7 @@
|
||||
// This might use some more abstraction
|
||||
if ($ForumID) { ?>
|
||||
<? if (!in_array($InputID, $UserSubscriptions)) { ?>
|
||||
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> tabindex="2" />
|
||||
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" />
|
||||
<label for="subscribebox">Subscribe</label>
|
||||
<?
|
||||
}
|
||||
@ -109,11 +119,12 @@
|
||||
?>
|
||||
<input id="mergebox" type="checkbox" name="merge" tabindex="2" />
|
||||
<label for="mergebox">Merge</label>
|
||||
<? } ?>
|
||||
<? if (!$LoggedUser['DisableAutoSave']) { ?>
|
||||
<? }
|
||||
if (!$LoggedUser['DisableAutoSave']) { ?>
|
||||
<script type="application/javascript">var storedTempTextarea = new StoreText('quickpost', 'quickpostform', <?=$InputID?>);</script>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? }
|
||||
}
|
||||
?>
|
||||
<input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" />
|
||||
<input type="submit" value="Post reply" id="submit_button" tabindex="1" />
|
||||
</div>
|
||||
|
95
image.php
95
image.php
@ -7,17 +7,19 @@
|
||||
/********************************************************/
|
||||
error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);
|
||||
|
||||
if(isset($_SERVER['http_if_modified_since'])) {
|
||||
if (isset($_SERVER['http_if_modified_since'])) {
|
||||
header("Status: 304 Not Modified");
|
||||
die();
|
||||
}
|
||||
|
||||
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time()+3600*24*120)); //120 days
|
||||
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time() + 3600 * 24 * 120)); //120 days
|
||||
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time()));
|
||||
|
||||
require('classes/config.php'); //The config contains all site wide configuration information as well as memcached rules
|
||||
|
||||
if (!extension_loaded('gd')) { error('nogd'); }
|
||||
if (!extension_loaded('gd')) {
|
||||
error('nogd');
|
||||
}
|
||||
|
||||
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
|
||||
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class
|
||||
@ -26,9 +28,11 @@
|
||||
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
|
||||
$Enc = NEW CRYPT; //Load the encryption class
|
||||
|
||||
if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); }
|
||||
if(isset($LoginCookie)) {
|
||||
list($SessionID, $UserID)=explode("|~|",$Enc->decrypt($LoginCookie));
|
||||
if (isset($_COOKIE['session'])) {
|
||||
$LoginCookie=$Enc->decrypt($_COOKIE['session']);
|
||||
}
|
||||
if (isset($LoginCookie)) {
|
||||
list($SessionID, $UserID) = explode("|~|",$Enc->decrypt($LoginCookie));
|
||||
$UserID = (int)$UserID;
|
||||
$UserInfo = $Cache->get_value('user_info_'.$UserID);
|
||||
$Permissions = $Cache->get_value('perm_'.$UserInfo['PermissionID']);
|
||||
@ -46,9 +50,11 @@ function error($Type) {
|
||||
|
||||
function invisible($Image) {
|
||||
$Count = imagecolorstotal($Image);
|
||||
if ($Count == 0) { return false; }
|
||||
if ($Count == 0) {
|
||||
return false;
|
||||
}
|
||||
$TotalAlpha = 0;
|
||||
for ($i=0; $i<$Count; ++$i) {
|
||||
for ($i = 0; $i < $Count; ++$i) {
|
||||
$Color = imagecolorsforindex($Image,$i);
|
||||
$TotalAlpha += $Color['alpha'];
|
||||
}
|
||||
@ -58,7 +64,9 @@ function invisible($Image) {
|
||||
|
||||
function is_number($Str) {
|
||||
$Return = true;
|
||||
if ($Str < 0) { $Return = false; }
|
||||
if ($Str < 0) {
|
||||
$Return = false;
|
||||
}
|
||||
// We're converting input to a int, then string and comparing to original
|
||||
$Return = ($Str == strval(intval($Str)) ? true : false);
|
||||
return $Return;
|
||||
@ -69,19 +77,19 @@ function verysmall($Image) {
|
||||
}
|
||||
|
||||
function image_type($Data) {
|
||||
if(!strncmp($Data,'GIF',3)) {
|
||||
if (!strncmp($Data,'GIF',3)) {
|
||||
return 'gif';
|
||||
}
|
||||
if(!strncmp($Data,pack('H*','89504E47'),4)) {
|
||||
if (!strncmp($Data,pack('H*','89504E47'),4)) {
|
||||
return 'png';
|
||||
}
|
||||
if(!strncmp($Data,pack('H*','FFD8'),2)) {
|
||||
if (!strncmp($Data,pack('H*','FFD8'),2)) {
|
||||
return 'jpeg';
|
||||
}
|
||||
if(!strncmp($Data,'BM',2)) {
|
||||
if (!strncmp($Data,'BM',2)) {
|
||||
return 'bmp';
|
||||
}
|
||||
if(!strncmp($Data,'II',2) || !strncmp($Data,'MM',2)) {
|
||||
if (!strncmp($Data,'II',2) || !strncmp($Data,'MM',2)) {
|
||||
return 'tiff';
|
||||
}
|
||||
}
|
||||
@ -89,25 +97,25 @@ function image_type($Data) {
|
||||
function image_height($Type, $Data) {
|
||||
$Length = strlen($Data);
|
||||
global $URL, $_GET;
|
||||
switch($Type) {
|
||||
switch ($Type) {
|
||||
case 'jpeg':
|
||||
// See http://www.obrador.com/essentialjpeg/headerinfo.htm
|
||||
$i = 4;
|
||||
$Data = (substr($Data, $i));
|
||||
$Block = unpack('nLength', $Data);
|
||||
$Data = substr($Data, $Block['Length']);
|
||||
$i+=$Block['Length'];
|
||||
$i += $Block['Length'];
|
||||
$Str []= "Started 4, + ".$Block['Length'];
|
||||
while($Data!='') { // iterate through the blocks until we find the start of frame marker (FFC0)
|
||||
while ($Data != '') { // iterate through the blocks until we find the start of frame marker (FFC0)
|
||||
$Block = unpack('CBlock/CType/nLength', $Data); // Get info about the block
|
||||
if($Block['Block'] != '255') { break; } // We should be at the start of a new block
|
||||
if($Block['Type'] != '192') { // C0
|
||||
$Data = substr($Data, $Block['Length']+2); // Next block
|
||||
$Str []= "Started ".$i.", + ".($Block['Length']+2);
|
||||
$i+=($Block['Length']+2);
|
||||
if ($Block['Block'] != '255') { break; } // We should be at the start of a new block
|
||||
if ($Block['Type'] != '192') { // C0
|
||||
$Data = substr($Data, $Block['Length'] + 2); // Next block
|
||||
$Str []= "Started ".$i.", + ".($Block['Length'] + 2);
|
||||
$i += ($Block['Length'] + 2);
|
||||
} else { // We're at the FFC0 block
|
||||
$Data = substr($Data, 5); // Skip FF C0 Length(2) precision(1)
|
||||
$i+=5;
|
||||
$i += 5;
|
||||
$Height = unpack('nHeight', $Data);
|
||||
return $Height['Height'];
|
||||
}
|
||||
@ -129,12 +137,12 @@ function image_height($Type, $Data) {
|
||||
|
||||
function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
|
||||
global $DB, $Cache;
|
||||
if($ToID==0) {
|
||||
if ($ToID == 0) {
|
||||
// Don't allow users to send messages to the system
|
||||
return;
|
||||
}
|
||||
if($ConvID=='') {
|
||||
$DB->query("INSERT INTO pm_conversations(Subject) VALUES ('".$Subject."')");
|
||||
if ($ConvID == '') {
|
||||
$DB->query("INSERT INTO pm_conversations(Subject) VALUES ('$Subject')");
|
||||
$ConvID = $DB->inserted_id();
|
||||
$DB->query("INSERT INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) VALUES
|
||||
@ -181,36 +189,45 @@ function send_irc($Raw) {
|
||||
}
|
||||
|
||||
function display_str($Str) {
|
||||
if ($Str === NULL || $Str === FALSE || is_array($Str)) {
|
||||
if ($Str === NULL || $Str === false || is_array($Str)) {
|
||||
return '';
|
||||
}
|
||||
if ($Str!='' && !is_number($Str)) {
|
||||
$Str=make_utf8($Str);
|
||||
$Str=mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
|
||||
$Str=preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&",$Str);
|
||||
if ($Str != '' && !is_number($Str)) {
|
||||
$Str = make_utf8($Str);
|
||||
$Str = mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
|
||||
$Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&",$Str);
|
||||
|
||||
$Replace = array(
|
||||
"'",'"',"<",">",
|
||||
'€','‚','ƒ','„','…','†','‡','ˆ','‰','Š','‹','Œ','Ž','‘','’','“','”','•','–','—','˜','™','š','›','œ','ž','Ÿ'
|
||||
);
|
||||
|
||||
$With=array(
|
||||
$With = array(
|
||||
''','"','<','>',
|
||||
'€','‚','ƒ','„','…','†','‡','ˆ','‰','Š','‹','Œ','Ž','‘','’','“','”','•','–','—','˜','™','š','›','œ','ž','Ÿ'
|
||||
);
|
||||
|
||||
$Str=str_replace($Replace,$With,$Str);
|
||||
$Str = str_replace($Replace,$With,$Str);
|
||||
}
|
||||
return $Str;
|
||||
}
|
||||
|
||||
function make_utf8($Str) {
|
||||
if ($Str!="") {
|
||||
if (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; }
|
||||
else { return @mb_convert_encoding($Str,"UTF-8",$Encoding); }
|
||||
if ($Str != '') {
|
||||
if (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;
|
||||
} else {
|
||||
return @mb_convert_encoding($Str,'UTF-8',$Encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,14 +9,14 @@
|
||||
|
||||
//We have to iterate here because if one is empty it breaks the query
|
||||
$TopicIDs = array();
|
||||
foreach($Forums as $Forum) {
|
||||
foreach ($Forums as $Forum) {
|
||||
if (!empty($Forum['LastPostTopicID'])) {
|
||||
$TopicIDs[]=$Forum['LastPostTopicID'];
|
||||
$TopicIDs[] = $Forum['LastPostTopicID'];
|
||||
}
|
||||
}
|
||||
|
||||
//Now if we have IDs' we run the query
|
||||
if(!empty($TopicIDs)) {
|
||||
if (!empty($TopicIDs)) {
|
||||
$DB->query("SELECT
|
||||
l.TopicID,
|
||||
l.PostID,
|
||||
@ -39,12 +39,12 @@
|
||||
$JsonForums = array();
|
||||
foreach ($Forums as $Forum) {
|
||||
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
|
||||
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) {
|
||||
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
|
||||
continue;
|
||||
}
|
||||
$ForumDescription = display_str($ForumDescription);
|
||||
|
||||
if($CategoryID!=$LastCategoryID) {
|
||||
if ($CategoryID != $LastCategoryID) {
|
||||
if (!empty($JsonForums) && !empty($JsonCategory)) {
|
||||
$JsonCategory['forums'] = $JsonForums;
|
||||
$JsonCategories[] = $JsonCategory;
|
||||
@ -57,7 +57,7 @@
|
||||
$JsonForums = array();
|
||||
}
|
||||
|
||||
if((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
|
||||
if ((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
|
||||
$Read = 'unread';
|
||||
} else {
|
||||
$Read = 'read';
|
||||
|
@ -17,14 +17,13 @@
|
||||
$Text = new TEXT;
|
||||
|
||||
// Check for lame SQL injection attempts
|
||||
if(!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
|
||||
if(isset($_GET['topicid']) && is_number($_GET['topicid'])) {
|
||||
if (!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
|
||||
if (isset($_GET['topicid']) && is_number($_GET['topicid'])) {
|
||||
$ThreadID = $_GET['topicid'];
|
||||
}
|
||||
elseif(isset($_GET['postid']) && is_number($_GET['postid'])) {
|
||||
} elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
|
||||
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
|
||||
list($ThreadID) = $DB->next_record();
|
||||
if($ThreadID) {
|
||||
if ($ThreadID) {
|
||||
header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]");
|
||||
die();
|
||||
} else {
|
||||
@ -41,8 +40,7 @@
|
||||
|
||||
if (isset($_GET['pp'])) {
|
||||
$PerPage = $_GET['pp'];
|
||||
}
|
||||
else if (isset($LoggedUser['PostsPerPage'])) {
|
||||
} elseif (isset($LoggedUser['PostsPerPage'])) {
|
||||
$PerPage = $LoggedUser['PostsPerPage'];
|
||||
} else {
|
||||
$PerPage = POSTS_PER_PAGE;
|
||||
@ -55,16 +53,16 @@
|
||||
$ForumID = $ThreadInfo['ForumID'];
|
||||
|
||||
// Make sure they're allowed to look at the page
|
||||
if(!check_forumperm($ForumID)) {
|
||||
if (!check_forumperm($ForumID)) {
|
||||
print json_encode(array('status' => 'failure'));
|
||||
die();
|
||||
}
|
||||
|
||||
//Post links utilize the catalogue & key params to prevent issues with custom posts per page
|
||||
if($ThreadInfo['Posts'] > $PerPage) {
|
||||
if(isset($_GET['post']) && is_number($_GET['post'])) {
|
||||
if ($ThreadInfo['Posts'] > $PerPage) {
|
||||
if (isset($_GET['post']) && is_number($_GET['post'])) {
|
||||
$PostNum = $_GET['post'];
|
||||
} elseif(isset($_GET['postid']) && is_number($_GET['postid'])) {
|
||||
} elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
|
||||
$DB->query("SELECT COUNT(ID) FROM forums_posts WHERE TopicID = $ThreadID AND ID <= $_GET[postid]");
|
||||
list($PostNum) = $DB->next_record();
|
||||
} else {
|
||||
@ -74,13 +72,13 @@
|
||||
$PostNum = 1;
|
||||
}
|
||||
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
||||
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
||||
if (($Page - 1) * $PerPage > $ThreadInfo['Posts']) {
|
||||
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
||||
}
|
||||
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
||||
|
||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||
if(!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
||||
if (!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
||||
$DB->query("SELECT
|
||||
p.ID,
|
||||
p.AuthorID,
|
||||
@ -102,14 +100,14 @@
|
||||
$LastPost = end($Thread);
|
||||
$LastPost = $LastPost['ID'];
|
||||
reset($Thread);
|
||||
if($ThreadInfo['Posts'] <= $PerPage*$Page && $ThreadInfo['StickyPostID'] > $LastPost) {
|
||||
if ($ThreadInfo['Posts'] <= $PerPage * $Page && $ThreadInfo['StickyPostID'] > $LastPost) {
|
||||
$LastPost = $ThreadInfo['StickyPostID'];
|
||||
}
|
||||
//Handle last read
|
||||
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
|
||||
$DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'");
|
||||
list($LastRead) = $DB->next_record();
|
||||
if($LastRead < $LastPost) {
|
||||
if ($LastRead < $LastPost) {
|
||||
$DB->query("INSERT INTO forums_last_read_topics
|
||||
(UserID, TopicID, PostID) VALUES
|
||||
('$LoggedUser[ID]', '".$ThreadID ."', '".db_string($LastPost)."')
|
||||
@ -119,17 +117,17 @@
|
||||
}
|
||||
|
||||
//Handle subscriptions
|
||||
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
}
|
||||
|
||||
if(empty($UserSubscriptions)) {
|
||||
if (empty($UserSubscriptions)) {
|
||||
$UserSubscriptions = array();
|
||||
}
|
||||
|
||||
if(in_array($ThreadID, $UserSubscriptions)) {
|
||||
if (in_array($ThreadID, $UserSubscriptions)) {
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
|
||||
@ -148,7 +146,7 @@
|
||||
$Votes[$Key] = $Value;
|
||||
}
|
||||
|
||||
foreach(array_keys($Answers) as $i) {
|
||||
foreach (array_keys($Answers) as $i) {
|
||||
if (!isset($Votes[$i])) {
|
||||
$Votes[$i] = 0;
|
||||
}
|
||||
@ -171,7 +169,7 @@
|
||||
if (!empty($UserResponse) && $UserResponse != 0) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
} else {
|
||||
if(!empty($UserResponse) && $RevealVoters) {
|
||||
if (!empty($UserResponse) && $RevealVoters) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
}
|
||||
}
|
||||
@ -208,11 +206,11 @@
|
||||
}
|
||||
|
||||
//Sqeeze in stickypost
|
||||
if($ThreadInfo['StickyPostID']) {
|
||||
if($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
|
||||
if ($ThreadInfo['StickyPostID']) {
|
||||
if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
|
||||
array_unshift($Thread, $ThreadInfo['StickyPost']);
|
||||
}
|
||||
if($ThreadInfo['StickyPostID'] != $Thread[count($Thread)-1]['ID']) {
|
||||
if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread)-1]['ID']) {
|
||||
$Thread[] = $ThreadInfo['StickyPost'];
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
// Subscriptions
|
||||
$NewSubscriptions = $Cache->get_value('subscriptions_user_new_' . $LoggedUser['ID']);
|
||||
if ($NewSubscriptions === FALSE) {
|
||||
if ($NewSubscriptions === false) {
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
|
@ -58,7 +58,7 @@
|
||||
// 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, true);
|
||||
if ($VotePairs !== FALSE) {
|
||||
if ($VotePairs !== false) {
|
||||
foreach ($UserVotes as $Vote) {
|
||||
if ($Vote['GroupID'] == $GroupID) {
|
||||
continue;
|
||||
@ -91,7 +91,7 @@
|
||||
}
|
||||
// Again, if the cache key is not set, move along
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$VGID, true);
|
||||
if ($VotePairs !== FALSE) {
|
||||
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])) {
|
||||
@ -131,15 +131,15 @@
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
|
||||
$DB->query("UPDATE torrents_votes SET Total = GREATEST(0, Total - 1),
|
||||
Score = IFNULL(binomial_ci(GREATEST(0,Ups".($Type=='Up'?'-1':'')."),GREATEST(0, Total)),0)".
|
||||
($Type=='Up'?', Ups = GREATEST(0, Ups - 1)':'')."
|
||||
Score = IFNULL(binomial_ci(GREATEST(0,Ups".($Type == 'Up' ? '-1' : '')."),GREATEST(0, Total)),0)".
|
||||
($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, true);
|
||||
if ($VotePairs !== FALSE) {
|
||||
if ($VotePairs !== false) {
|
||||
foreach ($UserVotes as $Vote) {
|
||||
if (isset($VotePairs[$Vote['GroupID']])) {
|
||||
if ($VotePairs[$Vote['GroupID']]['Total'] == 0) {
|
||||
@ -172,7 +172,7 @@
|
||||
}
|
||||
// Again, if the cache key is not set, move along
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$VGID, true);
|
||||
if ($VotePairs !== FALSE) {
|
||||
if ($VotePairs !== false) {
|
||||
if (isset($VotePairs[$GroupID])) {
|
||||
if ($VotePairs[$GroupID]['Total'] == 0) {
|
||||
// Something is screwy
|
||||
|
@ -4,15 +4,15 @@
|
||||
User post history page
|
||||
*/
|
||||
|
||||
function error_out($reason = "") {
|
||||
function error_out($reason = '') {
|
||||
$error = array('status' => 'failure');
|
||||
if ($reason != "")
|
||||
if ($reason != '')
|
||||
$error['reason'] = $reason;
|
||||
print $error;
|
||||
die();
|
||||
}
|
||||
|
||||
if(!empty($LoggedUser['DisableForums'])) {
|
||||
if (!empty($LoggedUser['DisableForums'])) {
|
||||
error_out("You do not have access to the forums!");
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ function error_out($reason = "") {
|
||||
|
||||
|
||||
$UserID = empty($_GET['userid']) ? $LoggedUser['ID'] : $_GET['userid'];
|
||||
if(!is_number($UserID)){
|
||||
if (!is_number($UserID)) {
|
||||
error_out("User does not exist!");
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ function error_out($reason = "") {
|
||||
|
||||
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||
|
||||
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === FALSE) {
|
||||
if (($UserInfo = $Cache->get_value('user_info_'.$UserID)) === false) {
|
||||
$DB->query("SELECT
|
||||
m.Username,
|
||||
m.Enabled,
|
||||
@ -46,7 +46,7 @@ function error_out($reason = "") {
|
||||
JOIN users_info AS i ON i.UserID = m.ID
|
||||
WHERE m.ID = $UserID");
|
||||
|
||||
if($DB->record_count() == 0){ // If user doesn't exist
|
||||
if ($DB->record_count() == 0){ // If user doesn't exist
|
||||
error_out("User does not exist!");
|
||||
}
|
||||
list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record();
|
||||
@ -54,24 +54,24 @@ function error_out($reason = "") {
|
||||
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
|
||||
}
|
||||
|
||||
if(check_perms('site_proxy_images') && !empty($Avatar)) {
|
||||
if (check_perms('site_proxy_images') && !empty($Avatar)) {
|
||||
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Avatar);
|
||||
}
|
||||
|
||||
if($LoggedUser['CustomForums']) {
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
}
|
||||
$ViewingOwn = ($UserID == $LoggedUser['ID']);
|
||||
$ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']));
|
||||
$ShowGrouped = ($ViewingOwn && (!isset($_GET['group']) || !!$_GET['group']));
|
||||
if($ShowGrouped) {
|
||||
if ($ShowGrouped) {
|
||||
$sql = 'SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
MAX(p.ID) AS ID
|
||||
FROM forums_posts AS p
|
||||
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID';
|
||||
if($ShowUnread) {
|
||||
if ($ShowUnread) {
|
||||
$sql.='
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.TopicID = t.ID AND l.UserID = '.$LoggedUser['ID'];
|
||||
}
|
||||
@ -79,17 +79,17 @@ function error_out($reason = "") {
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
|
||||
if(!empty($RestrictedForums)) {
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if(!empty($PermittedForums)) {
|
||||
if (!empty($PermittedForums)) {
|
||||
$sql.='
|
||||
OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if($ShowUnread) {
|
||||
if ($ShowUnread) {
|
||||
$sql .= '
|
||||
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\')
|
||||
AND (l.PostID<t.LastPostID OR l.PostID IS NULL))';
|
||||
@ -101,7 +101,7 @@ function error_out($reason = "") {
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
|
||||
if($Results > $PerPage*($Page-1)) {
|
||||
if ($Results > $PerPage * ($Page - 1)) {
|
||||
$DB->set_query_id($PostIDs);
|
||||
$PostIDs = $DB->collect('ID');
|
||||
$sql = 'SELECT
|
||||
@ -131,7 +131,7 @@ function error_out($reason = "") {
|
||||
} else {
|
||||
$sql = 'SELECT
|
||||
SQL_CALC_FOUND_ROWS';
|
||||
if($ShowGrouped) {
|
||||
if ($ShowGrouped) {
|
||||
$sql.=' * FROM (SELECT';
|
||||
}
|
||||
$sql .= '
|
||||
@ -144,7 +144,7 @@ function error_out($reason = "") {
|
||||
p.TopicID,
|
||||
t.Title,
|
||||
t.LastPostID,';
|
||||
if($UserID == $LoggedUser['ID']) {
|
||||
if ($UserID == $LoggedUser['ID']) {
|
||||
$sql .= '
|
||||
l.PostID AS LastRead,';
|
||||
}
|
||||
@ -161,12 +161,12 @@ function error_out($reason = "") {
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
|
||||
|
||||
if(!empty($RestrictedForums)) {
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
}
|
||||
|
||||
if($ShowUnread) {
|
||||
if ($ShowUnread) {
|
||||
$sql.='
|
||||
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
|
||||
}
|
||||
@ -174,7 +174,7 @@ function error_out($reason = "") {
|
||||
$sql .= '
|
||||
ORDER BY p.ID DESC';
|
||||
|
||||
if($ShowGrouped) {
|
||||
if ($ShowGrouped) {
|
||||
$sql.='
|
||||
) AS sub
|
||||
GROUP BY TopicID ORDER BY ID DESC';
|
||||
@ -190,7 +190,7 @@ function error_out($reason = "") {
|
||||
}
|
||||
|
||||
$JsonResults = array();
|
||||
while(list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()){
|
||||
while (list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()) {
|
||||
$JsonResults[] = array(
|
||||
'postId' => (int) $PostID,
|
||||
'topicId' => (int) $TopicID,
|
||||
|
@ -1,26 +1,30 @@
|
||||
<?
|
||||
authorize();
|
||||
if(!check_perms('site_torrents_notify')) { error(403); }
|
||||
if (!check_perms('site_torrents_notify')) {
|
||||
error(403);
|
||||
}
|
||||
$ArtistID = $_GET['artistid'];
|
||||
if(!is_number($ArtistID)) { error(0); }
|
||||
if (!is_number($ArtistID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$DB->query("SELECT GROUP_CONCAT(Name SEPARATOR '|') FROM artists_alias WHERE ArtistID = '$ArtistID' AND Redirect = 0 GROUP BY ArtistID");
|
||||
list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
|
||||
|
||||
$Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID']);
|
||||
if(empty($Notify)) {
|
||||
if (empty($Notify)) {
|
||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE Label='Artist notifications' AND UserID='$LoggedUser[ID]' ORDER BY ID LIMIT 1");
|
||||
} else {
|
||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE ID='$Notify[ID]'");
|
||||
}
|
||||
if(empty($Notify) && $DB->record_count() == 0) {
|
||||
if (empty($Notify) && $DB->record_count() == 0) {
|
||||
$DB->query("INSERT INTO users_notify_filters (UserID, Label, Artists) VALUES ('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
|
||||
$FilterID = $DB->inserted_id();
|
||||
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
||||
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
||||
} else {
|
||||
list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, FALSE);
|
||||
if(stripos($ArtistNames,$ArtistAliases) === FALSE) {
|
||||
if (stripos($ArtistNames,$ArtistAliases) === false) {
|
||||
$ArtistNames.=$ArtistAliases.'|';
|
||||
$DB->query("UPDATE users_notify_filters SET Artists='".db_string($ArtistNames)."' WHERE ID='$ID'");
|
||||
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
||||
|
@ -1,22 +1,26 @@
|
||||
<?
|
||||
authorize();
|
||||
if(!check_perms('site_torrents_notify')) { error(403); }
|
||||
if (!check_perms('site_torrents_notify')) {
|
||||
error(403);
|
||||
}
|
||||
$ArtistID = $_GET['artistid'];
|
||||
if(!is_number($ArtistID)) { error(0); }
|
||||
if (!is_number($ArtistID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if(($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE Label='Artist notifications' AND UserID='$LoggedUser[ID]' ORDER BY ID LIMIT 1");
|
||||
} else {
|
||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE ID='$Notify[ID]'");
|
||||
}
|
||||
list($ID,$Artists) = $DB->next_record(MYSQLI_NUM, FALSE);
|
||||
$DB->query("SELECT Name FROM artists_alias WHERE ArtistID = '$ArtistID' AND Redirect=0");
|
||||
while(list($Alias) = $DB->next_record(MYSQLI_NUM, FALSE)) {
|
||||
while(stripos($Artists, '|'.$Alias.'|') !== FALSE) {
|
||||
while (list($Alias) = $DB->next_record(MYSQLI_NUM, FALSE)) {
|
||||
while (stripos($Artists, '|'.$Alias.'|') !== false) {
|
||||
$Artists = str_ireplace('|'.$Alias.'|', '|', $Artists);
|
||||
}
|
||||
}
|
||||
if($Artists == '|') {
|
||||
if ($Artists == '|') {
|
||||
$DB->query("DELETE FROM users_notify_filters WHERE ID=$ID");
|
||||
} else {
|
||||
$DB->query("UPDATE users_notify_filters SET Artists='".db_string($Artists)."' WHERE ID='$ID'");
|
||||
|
@ -65,12 +65,12 @@
|
||||
<span style="float: right">
|
||||
<?
|
||||
if (check_perms('site_torrents_notify')) {
|
||||
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
|
||||
$Notify = $DB->next_record(MYSQLI_ASSOC);
|
||||
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
|
||||
}
|
||||
if (stripos($Notify['Artists'], '|'.$Name.'|') === FALSE) {
|
||||
if (stripos($Notify['Artists'], '|'.$Name.'|') === false) {
|
||||
?>
|
||||
<a href="artist.php?action=notify&artistid=<?=$ArtistID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
|
||||
<?
|
||||
|
@ -21,14 +21,14 @@ function compare($X, $Y){
|
||||
|
||||
$Data = $Cache->get_value('collage_'.$CollageID);
|
||||
|
||||
if($Data) {
|
||||
if ($Data) {
|
||||
if (!is_array($Data)) {
|
||||
$Data = unserialize($Data);
|
||||
}
|
||||
list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)) = each($Data);
|
||||
} else {
|
||||
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
|
||||
if($DB->record_count() > 0) {
|
||||
if ($DB->record_count() > 0) {
|
||||
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
|
||||
$TorrentList='';
|
||||
$CollageList='';
|
||||
@ -37,29 +37,29 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
|
||||
if($Deleted == '1') {
|
||||
if ($Deleted == '1') {
|
||||
header('Location: log.php?search=Collage+'.$CollageID);
|
||||
die();
|
||||
}
|
||||
|
||||
if($CollageCategoryID == 0 && !check_perms('site_collages_delete')) {
|
||||
if(!check_perms('site_collages_personal') || $CreatorID != $LoggedUser['ID']) {
|
||||
if ($CollageCategoryID == 0 && !check_perms('site_collages_delete')) {
|
||||
if (!check_perms('site_collages_personal') || $CreatorID != $LoggedUser['ID']) {
|
||||
$PreventAdditions = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Handle subscriptions
|
||||
if(($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if (($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT CollageID FROM users_collage_subs WHERE UserID = '$LoggedUser[ID]'");
|
||||
$CollageSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'],$CollageSubscriptions,0);
|
||||
}
|
||||
|
||||
if(empty($CollageSubscriptions)) {
|
||||
if (empty($CollageSubscriptions)) {
|
||||
$CollageSubscriptions = array();
|
||||
}
|
||||
|
||||
if(in_array($CollageID, $CollageSubscriptions)) {
|
||||
if (in_array($CollageID, $CollageSubscriptions)) {
|
||||
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
$DB->query("UPDATE users_collage_subs SET LastVisit=NOW() WHERE UserID = ".$LoggedUser['ID']." AND CollageID=$CollageID");
|
||||
@ -79,7 +79,7 @@ function compare($X, $Y){
|
||||
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||
if(count($GroupIDs)>0) {
|
||||
if (count($GroupIDs) > 0) {
|
||||
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||
$TorrentList = $TorrentList['matches'];
|
||||
} else {
|
||||
@ -107,27 +107,28 @@ function compare($X, $Y){
|
||||
// Handle stats and stuff
|
||||
$Number++;
|
||||
$NumGroups++;
|
||||
if($UserID == $LoggedUser['ID']) {
|
||||
if ($UserID == $LoggedUser['ID']) {
|
||||
$NumGroupsByUser++;
|
||||
}
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
$CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]);
|
||||
} else{
|
||||
} else {
|
||||
$CountArtists = $GroupArtists;
|
||||
}
|
||||
|
||||
if ($CountArtists) {
|
||||
foreach($CountArtists as $Artist) {
|
||||
if (!isset($TopArtists[$Artist['id']]))
|
||||
foreach ($CountArtists as $Artist) {
|
||||
if (!isset($TopArtists[$Artist['id']])) {
|
||||
$TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
|
||||
else
|
||||
} else {
|
||||
$TopArtists[$Artist['id']]['count']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($Username) {
|
||||
if(!isset($Users[$UserID])) {
|
||||
if ($Username) {
|
||||
if (!isset($Users[$UserID])) {
|
||||
$Users[$UserID] = array('name'=>$Username, 'count'=>1);
|
||||
} else {
|
||||
$Users[$UserID]['count']++;
|
||||
@ -140,18 +141,18 @@ function compare($X, $Y){
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName .= Artists::display_artists($ExtendedArtists);
|
||||
} elseif(count($GroupArtists)>0) {
|
||||
} elseif (count($GroupArtists) > 0) {
|
||||
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
|
||||
}
|
||||
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
|
||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
|
||||
if ($GroupYear > 0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if ($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
|
||||
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
|
||||
// Start an output buffer, so we can store this output in $TorrentTable
|
||||
ob_start();
|
||||
|
||||
if(count($Torrents)>1 || $GroupCategoryID==1) {
|
||||
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
|
||||
// Grouped torrents
|
||||
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
|
||||
?>
|
||||
@ -186,7 +187,7 @@ function compare($X, $Y){
|
||||
}
|
||||
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
$EditionID++;
|
||||
?>
|
||||
@ -273,16 +274,18 @@ function compare($X, $Y){
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
|
||||
} elseif(count($GroupArtists)>0) {
|
||||
} elseif (count($GroupArtists) > 0) {
|
||||
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
|
||||
}
|
||||
$DisplayName .= $GroupName;
|
||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName = $DisplayName. ' ['. $GroupYear .']';
|
||||
}
|
||||
?>
|
||||
<li class="image_group_<?=$GroupID?>">
|
||||
<a href="torrents.php?id=<?=$GroupID?>">
|
||||
<? if($WikiImage) {
|
||||
if(check_perms('site_proxy_images')) {
|
||||
<? if ($WikiImage) {
|
||||
if (check_perms('site_proxy_images')) {
|
||||
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
|
||||
}
|
||||
?>
|
||||
@ -306,13 +309,13 @@ function compare($X, $Y){
|
||||
|
||||
// Pad it out
|
||||
if ($NumGroups > $CollageCovers) {
|
||||
for ($i = $NumGroups + 1; $i <= ceil($NumGroups/$CollageCovers)*$CollageCovers; $i++) {
|
||||
for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
|
||||
$Collage[] = '<li></li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($i=0; $i < $NumGroups/$CollageCovers; $i++) {
|
||||
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
|
||||
$Groups = array_slice($Collage, $i*$CollageCovers, $CollageCovers);
|
||||
$CollagePage = '';
|
||||
foreach ($Groups as $Group) {
|
||||
@ -332,7 +335,7 @@ function compare($X, $Y){
|
||||
<a href="collages.php?action=new" class="brackets">New collage</a>
|
||||
<? } ?>
|
||||
<br /><br />
|
||||
<? if(check_perms('site_collages_subscribe')) { ?>
|
||||
<? if (check_perms('site_collages_subscribe')) { ?>
|
||||
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
|
||||
<? }
|
||||
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
|
||||
@ -340,7 +343,7 @@ function compare($X, $Y){
|
||||
<? } else { ?>
|
||||
<span class="brackets">Locked</span>
|
||||
<? }
|
||||
if(Bookmarks::has_bookmarked('collage', $CollageID)) {
|
||||
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
|
||||
?>
|
||||
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a>
|
||||
<? } else { ?>
|
||||
@ -370,8 +373,8 @@ function compare($X, $Y){
|
||||
<div class="pad"><?=$Text->full_format($Description)?></div>
|
||||
</div>
|
||||
<?
|
||||
if(check_perms('zip_downloader')){
|
||||
if(isset($LoggedUser['Collector'])) {
|
||||
if (check_perms('zip_downloader')){
|
||||
if (isset($LoggedUser['Collector'])) {
|
||||
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
|
||||
$ZIPList = explode(':',$ZIPList);
|
||||
} else {
|
||||
@ -404,16 +407,16 @@ function compare($X, $Y){
|
||||
foreach ($ZIPOptions as $Option) {
|
||||
list($GroupID,$OptionID,$OptName) = $Option;
|
||||
|
||||
if($GroupID!=$LastGroupID) {
|
||||
if ($GroupID!=$LastGroupID) {
|
||||
$LastGroupID=$GroupID;
|
||||
if($OpenGroup) { ?>
|
||||
if ($OpenGroup) { ?>
|
||||
</optgroup>
|
||||
<? } ?>
|
||||
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
|
||||
<? $OpenGroup = true;
|
||||
}
|
||||
?>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if(in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
@ -421,9 +424,9 @@ function compare($X, $Y){
|
||||
</select>
|
||||
<button type="button" onclick="add_selection()">+</button>
|
||||
<select name="preference" style="width:210px">
|
||||
<option value="0"<? if($ZIPPrefs==0){ echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if($ZIPPrefs==1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if($ZIPPrefs==2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
<option value="0"<? if ($ZIPPrefs == 0){ echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if ($ZIPPrefs == 1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if ($ZIPPrefs == 2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
</select>
|
||||
<input type="submit" style="width:210px" value="Download" />
|
||||
</form>
|
||||
@ -434,7 +437,7 @@ function compare($X, $Y){
|
||||
<div class="head"><strong>Stats</strong></div>
|
||||
<ul class="stats nobullet">
|
||||
<li>Torrents: <?=number_format($NumGroups)?></li>
|
||||
<? if(!empty($TopArtists)) { ?>
|
||||
<? if (!empty($TopArtists)) { ?>
|
||||
<li>Artists: <?=number_format(count($TopArtists))?></li>
|
||||
<? } ?>
|
||||
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
|
||||
@ -450,7 +453,7 @@ function compare($X, $Y){
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<? if(!empty($TopArtists)) { ?>
|
||||
<? if (!empty($TopArtists)) { ?>
|
||||
<div class="box box_artists">
|
||||
<div class="head"><strong>Top artists</strong></div>
|
||||
<div class="pad">
|
||||
@ -460,7 +463,9 @@ function compare($X, $Y){
|
||||
$i = 0;
|
||||
foreach ($TopArtists as $ID => $Artist) {
|
||||
$i++;
|
||||
if($i>10) { break; }
|
||||
if ($i > 10) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
|
||||
<?
|
||||
@ -479,17 +484,18 @@ function compare($X, $Y){
|
||||
$i = 0;
|
||||
foreach ($Users as $ID => $User) {
|
||||
$i++;
|
||||
if($i>5) { break; }
|
||||
if ($i > 5) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<li><?=Users::format_username($ID, false, false, false)?> (<?=number_format($User['count'])?>)</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<? if(check_perms('site_collages_manage') && !$PreventAdditions) { ?>
|
||||
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
|
||||
<div class="box box_addtorrent">
|
||||
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add'?'Individual add':'Batch add'); return false;" class="brackets">Batch add</a></span></div>
|
||||
<div class="pad add_torrent_container">
|
||||
@ -518,7 +524,7 @@ function compare($X, $Y){
|
||||
<? } ?>
|
||||
<h3>Comments</h3>
|
||||
<?
|
||||
if(empty($CommentList)) {
|
||||
if (empty($CommentList)) {
|
||||
$DB->query("SELECT
|
||||
cc.ID,
|
||||
cc.Body,
|
||||
@ -549,7 +555,7 @@ function compare($X, $Y){
|
||||
<a href="collages.php?action=comments&collageid=<?=$CollageID?>" class="brackets">View all comments</a>
|
||||
</div>
|
||||
<?
|
||||
if(!$LoggedUser['DisablePosting']) {
|
||||
if (!$LoggedUser['DisablePosting']) {
|
||||
?>
|
||||
<div class="box box_addcomment">
|
||||
<div class="head"><strong>Add comment</strong></div>
|
||||
@ -570,13 +576,13 @@ function compare($X, $Y){
|
||||
</div>
|
||||
<div class="main_column">
|
||||
<?
|
||||
if($CollageCovers != 0) { ?>
|
||||
if ($CollageCovers != 0) { ?>
|
||||
<div id="coverart" class="box">
|
||||
<div class="head" id="coverhead"><strong>Cover art</strong></div>
|
||||
<ul class="collage_images" id="collage_page0">
|
||||
<?
|
||||
$Page1 = array_slice($Collage, 0, $CollageCovers);
|
||||
foreach($Page1 as $Group) {
|
||||
foreach ($Page1 as $Group) {
|
||||
echo $Group;
|
||||
}?>
|
||||
</ul>
|
||||
@ -585,12 +591,12 @@ function compare($X, $Y){
|
||||
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
|
||||
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><< First</a> | </span>
|
||||
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">< Prev</a> | </span>
|
||||
<? for ($i=0; $i < $NumGroups/$CollageCovers; $i++) { ?>
|
||||
<span id="pagelink<?=$i?>" class="<?=(($i>4)?'hidden':'')?><?=(($i==0)?'selected':'')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=$CollageCovers*$i+1?>-<?=min($NumGroups,$CollageCovers*($i+1))?></a><?=($i != ceil($NumGroups/$CollageCovers)-1)?' | ':''?></span>
|
||||
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
|
||||
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></a><?=($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : ''?></span>
|
||||
<? } ?>
|
||||
<span id="nextbar" class="<?=($NumGroups/$CollageCovers > 5)?'hidden':''?>"> | </span>
|
||||
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
|
||||
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">Next ></a></span>
|
||||
<span id="lastpage" class="<?=ceil($NumGroups/$CollageCovers)==2?'invisible':''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups/$CollageCovers)-1?>, this); return false;">Last >></a></span>
|
||||
<span id="lastpage" class="<?=ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : ''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">Last >></a></span>
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
collageShow.init(<?=json_encode($CollagePages)?>);
|
||||
|
@ -43,16 +43,16 @@
|
||||
$PermittedForums = array_keys($LoggedUser['PermittedForums']);
|
||||
foreach ($Forums as $Forum) {
|
||||
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
|
||||
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) {
|
||||
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead > $LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
|
||||
continue;
|
||||
}
|
||||
$Row = ($Row == 'a') ? 'b' : 'a';
|
||||
$ForumDescription = display_str($ForumDescription);
|
||||
|
||||
if($CategoryID!=$LastCategoryID) {
|
||||
if ($CategoryID != $LastCategoryID) {
|
||||
$Row = 'b';
|
||||
$LastCategoryID=$CategoryID;
|
||||
if($OpenTable) { ?>
|
||||
$LastCategoryID = $CategoryID;
|
||||
if ($OpenTable) { ?>
|
||||
</table>
|
||||
<? } ?>
|
||||
<h3><?=$ForumCats[$CategoryID]?></h3>
|
||||
@ -68,7 +68,7 @@
|
||||
$OpenTable = true;
|
||||
}
|
||||
|
||||
if((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
|
||||
if ((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
|
||||
$Read = 'unread';
|
||||
} else {
|
||||
$Read = 'read';
|
||||
@ -87,11 +87,11 @@
|
||||
</td>
|
||||
<? if ($NumPosts == 0) { ?>
|
||||
<td colspan="3">
|
||||
There are no topics here<?=($MinCreate<=$LoggedUser['Class']) ? ', <a href="forums.php?action=new&forumid='.$ForumID.'">'.'create one'.'</a>' : ''?>.
|
||||
There are no topics here<?=($MinCreate <= $LoggedUser['Class']) ? ', <a href="forums.php?action=new&forumid='.$ForumID.'">'.'create one'.'</a>' : ''?>.
|
||||
</td>
|
||||
<? } else { ?>
|
||||
<td>
|
||||
<span style="float:left;" class="last_topic">
|
||||
<span style="float: left;" class="last_topic">
|
||||
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>" title="<?=display_str($LastTopic)?>"><?=display_str(Format::cut_string($LastTopic, 50, 1))?></a>
|
||||
</span>
|
||||
<? if (!empty($LastRead[$LastTopicID])) { ?>
|
||||
@ -99,7 +99,7 @@
|
||||
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>&page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a>
|
||||
</span>
|
||||
<? } ?>
|
||||
<span style="float:right;" class="last_poster">by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?></span>
|
||||
<span style="float: right;" class="last_poster">by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?></span>
|
||||
</td>
|
||||
<td><?=number_format($NumTopics)?></td>
|
||||
<td><?=number_format($NumPosts)?></td>
|
||||
|
@ -99,7 +99,7 @@
|
||||
}
|
||||
}
|
||||
$Thread = Format::catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
||||
if($_GET['updatelastread'] != '0') {
|
||||
if ($_GET['updatelastread'] != '0') {
|
||||
$LastPost = end($Thread);
|
||||
$LastPost = $LastPost['ID'];
|
||||
reset($Thread);
|
||||
@ -124,17 +124,17 @@
|
||||
}
|
||||
|
||||
//Handle subscriptions
|
||||
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
}
|
||||
|
||||
if(empty($UserSubscriptions)) {
|
||||
if (empty($UserSubscriptions)) {
|
||||
$UserSubscriptions = array();
|
||||
}
|
||||
|
||||
if(in_array($ThreadID, $UserSubscriptions)) {
|
||||
if (in_array($ThreadID, $UserSubscriptions)) {
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Many forums (Tutorials, The Library, etc.) have their own set of rules. Make sure you read and take note of these rules before you attempt to post in one of these forums.
|
||||
</li>
|
||||
<li>
|
||||
Don't use all capital letters, excessive !!! (exclamation marks) or ??? (question marks), it seems like you're shouting!
|
||||
Don't use all capital letters, excessive !!! (exclamation marks) or ??? (question marks). It seems like you're shouting!
|
||||
</li>
|
||||
<li>
|
||||
No lame referral schemes. This includes freeipods.com, freepsps.com, or any other similar scheme in which the poster gets personal gain from users clicking a link.
|
||||
@ -24,22 +24,22 @@
|
||||
No asking for money for any reason whatsoever. We don't know or care about your friend who lost everything, or dying relative who wants to enjoy their last few moments alive by being given lots of money.
|
||||
</li>
|
||||
<li>
|
||||
No advertising your uploads.
|
||||
Do not inappropriately advertise your uploads. In special cases, it is acceptable to mention new uploads in an approved thread (e.g. <a href="forums.php?action=viewthread&threadid=133982">New Users — We'll Snatch Your First 100% FLAC</a>), but be sure to carefully read the thread's rules before posting. It is also acceptable to discuss releases you have uploaded when conversing about the music itself. Blatant attempts to advertise your uploads outside of the appropriate forums or threads may result in a warning or the loss of forum privileges.
|
||||
</li>
|
||||
<li>
|
||||
No posting music requests in forums, there's a request link on the top bar, please use that instead.
|
||||
No posting music requests in forums. There's a request link at the top of the page; please use that instead.
|
||||
</li>
|
||||
<li>
|
||||
No flaming, be pleasant and polite. Don't use offensive language, and don't be confrontational for the sake of confrontation.
|
||||
No flaming; be pleasant and polite. Don't use offensive language, and don't be confrontational for the sake of confrontation.
|
||||
</li>
|
||||
<li>
|
||||
Don't point out or attack other members' share ratios. A higher ratio does not make you better than someone else.
|
||||
</li>
|
||||
<li>
|
||||
Try not to ask stupid questions. A stupid question is one that you could have found the answer to yourself with a little research, or one that you're asking in the wrong place. If you do the basic research suggested (i.e., read the rules/wiki) or search the forums and don't find the answer to your question, then go ahead and ask. Staff/FLS are not here to hand-feed you the answers you could have found on your own with a little bit of effort.
|
||||
Try not to ask stupid questions. A stupid question is one that you could have found the answer to yourself with a little research, or one that you're asking in the wrong place. If you do the basic research suggested (i.e., read the rules/wiki) or search the forums and don't find the answer to your question, then go ahead and ask. Staff and First Line Support (FLS) are not here to hand-feed you the answers you could have found on your own with a little bit of effort.
|
||||
</li>
|
||||
<li>
|
||||
Be sure you read all the stickies.
|
||||
Be sure you read all the sticky threads in a forum before you post.
|
||||
</li>
|
||||
<li>
|
||||
Use descriptive and specific subject lines. This helps others decide whether your particular words of wisdom relate to a topic they care about.
|
||||
@ -75,10 +75,10 @@
|
||||
Be cautious when posting mature content on the forums. All mature imagery must abide by <a href="wiki.php?action=article&id=1063">the rules found here</a>. Gratuitously sexual or violent content which falls outside of the allowable categories will result in a warning or worse.
|
||||
</li>
|
||||
<li>
|
||||
Mature content in posts must be properly tagged. The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where “description” is a mandatory description of the post contents. Misleading or inadequate descriptions will be penalized.
|
||||
Mature content in posts must be properly tagged. The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post contents. Misleading or inadequate descriptions will be penalized.
|
||||
</li>
|
||||
<li>
|
||||
Threads created for the exclusive purpose of posting mature imagery will be trashed. Mature content (including graphic album art) should be contextually relevant to the thread and/or forum you’re posting in. Mature content is only allowed in: The Lounge, The Lounge +1, The Library, Music, Power Users, Elite, Torrent Masters, VIPs, Comics, Contests & Designs, The Laboratory. If you are in doubt about a post’s appropriateness, send a <a href="staffpm.php">Staff PM to the Forum Moderators</a> and wait for a reply before proceeding.
|
||||
Threads created for the exclusive purpose of posting mature imagery will be trashed. Mature content (including graphic album art) should be contextually relevant to the thread and/or forum you're posting in. Mature content is only allowed in: The Lounge, The Lounge +1, The Library, Music, Power Users, Elite, Torrent Masters, VIPs, Comics, Contests & Designs, The Laboratory. If you are in doubt about a post's appropriateness, send a <a href="staffpm.php">Staff PM to the Forum Moderators</a> and wait for a reply before proceeding.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -2,10 +2,10 @@
|
||||
function get_fls() {
|
||||
global $Cache, $DB;
|
||||
static $FLS;
|
||||
if(is_array($FLS)) {
|
||||
if (is_array($FLS)) {
|
||||
return $FLS;
|
||||
}
|
||||
if(($FLS = $Cache->get_value('fls')) === false) {
|
||||
if (($FLS = $Cache->get_value('fls')) === false) {
|
||||
$DB->query("SELECT
|
||||
m.ID,
|
||||
p.Level,
|
||||
@ -27,10 +27,10 @@ function get_fls() {
|
||||
function get_forum_staff() {
|
||||
global $Cache, $DB;
|
||||
static $ForumStaff;
|
||||
if(is_array($ForumStaff)) {
|
||||
if (is_array($ForumStaff)) {
|
||||
return $ForumStaff;
|
||||
}
|
||||
if(($ForumStaff = $Cache->get_value('forum_staff')) === false) {
|
||||
if (($ForumStaff = $Cache->get_value('forum_staff')) === false) {
|
||||
$DB->query("SELECT
|
||||
m.ID,
|
||||
p.Level,
|
||||
@ -53,10 +53,10 @@ function get_forum_staff() {
|
||||
function get_staff() {
|
||||
global $Cache, $DB;
|
||||
static $Staff;
|
||||
if(is_array($Staff)) {
|
||||
if (is_array($Staff)) {
|
||||
return $Staff;
|
||||
}
|
||||
if(($Staff = $Cache->get_value('staff')) === false) {
|
||||
if (($Staff = $Cache->get_value('staff')) === false) {
|
||||
$DB->query("SELECT
|
||||
m.ID,
|
||||
p.Level,
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="header">
|
||||
<h2><?=SITE_NAME?> Staff</h2>
|
||||
</div>
|
||||
<div class="box pad" style="padding:0px 10px 10px 10px;">
|
||||
<div class="box pad" style="padding: 0px 10px 10px 10px;">
|
||||
<br />
|
||||
<h3>Contact Staff</h3>
|
||||
<div id="below_box">
|
||||
@ -26,22 +26,27 @@
|
||||
<p><strong>These users are not official staff members</strong> - they're users who have volunteered their time to help people in need. Please treat them with respect and read <a href="wiki.php?action=article&id=260">this</a> before contacting them.</p>
|
||||
<table class="staff" width="100%">
|
||||
<tr class="colhead">
|
||||
<td style="width:130px;">Username</td>
|
||||
<td style="width:130px;">Last seen</td>
|
||||
<td style="width: 130px;">Username</td>
|
||||
<td style="width: 130px;">Last seen</td>
|
||||
<td><strong>Support for</strong></td>
|
||||
</tr>
|
||||
<?
|
||||
$Row = 'a';
|
||||
foreach($FrontLineSupport as $Support) {
|
||||
foreach ($FrontLineSupport as $Support) {
|
||||
list($ID, $Class, $Username, $Paranoia, $LastAccess, $SupportFor) = $Support;
|
||||
$Row = ($Row == 'a') ? 'b' : 'a';
|
||||
?>
|
||||
<tr class="row<?=$Row?>">
|
||||
<td class="nobr">
|
||||
<?=Users::format_username($ID, false, false, false)?>
|
||||
<?=Users::format_username($ID, false, false, false) ?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?>
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
|
||||
echo time_diff($LastAccess);
|
||||
} else {
|
||||
echo 'Hidden by user';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<?=$SupportFor?>
|
||||
@ -50,28 +55,33 @@
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box pad" style="padding:0px 10px 10px 10px;">
|
||||
<div class="box pad" style="padding: 0px 10px 10px 10px;">
|
||||
<br />
|
||||
<h3>Forum Moderators</h3>
|
||||
<p>Forum Moderators are users who have been promoted to help moderate the forums. They can only help with forum-oriented questions.</p>
|
||||
<table class="staff" width="100%">
|
||||
<tr class="colhead">
|
||||
<td style="width:130px;">Username</td>
|
||||
<td style="width:130px;">Last seen</td>
|
||||
<td style="width: 130px;">Username</td>
|
||||
<td style="width: 130px;">Last seen</td>
|
||||
<td><strong>Remark</strong></td>
|
||||
</tr>
|
||||
<?
|
||||
$Row = 'a';
|
||||
foreach($ForumStaff as $Support) {
|
||||
foreach ($ForumStaff as $Support) {
|
||||
list($ID, $Class, $Username, $Paranoia, $LastAccess, $SupportFor) = $Support;
|
||||
$Row = ($Row == 'a') ? 'b' : 'a';
|
||||
?>
|
||||
<tr class="row<?=$Row?>">
|
||||
<td class="nobr">
|
||||
<?=Users::format_username($ID, false, false, false)?>
|
||||
<?=Users::format_username($ID, false, false, false) ?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?>
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
|
||||
echo time_diff($LastAccess);
|
||||
} else {
|
||||
echo 'Hidden by user';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<?=$SupportFor?>
|
||||
@ -81,15 +91,15 @@
|
||||
</table>
|
||||
</div>
|
||||
<br />
|
||||
<div class="box pad" style="padding:0px 10px 10px 10px;">
|
||||
<div class="box pad" style="padding: 0px 10px 10px 10px;">
|
||||
<?
|
||||
$CurClass = 0;
|
||||
$CloseTable = false;
|
||||
foreach ($Staff as $StaffMember) {
|
||||
list($ID, $Class, $ClassName, $Username, $Paranoia, $LastAccess, $Remark) = $StaffMember;
|
||||
if($Class!=$CurClass) { // Start new class of staff members
|
||||
if ($Class != $CurClass) { // Start new class of staff members
|
||||
$Row = 'a';
|
||||
if($CloseTable) {
|
||||
if ($CloseTable) {
|
||||
$CloseTable = false;
|
||||
echo "\t</table><br />";
|
||||
}
|
||||
@ -99,8 +109,8 @@
|
||||
?>
|
||||
<table class="staff" width="100%">
|
||||
<tr class="colhead">
|
||||
<td style="width:130px;">Username</td>
|
||||
<td style="width:130px;">Last seen</td>
|
||||
<td style="width: 130px;">Username</td>
|
||||
<td style="width: 130px;">Last seen</td>
|
||||
<td><strong>Remark</strong></td>
|
||||
</tr>
|
||||
<?
|
||||
@ -111,10 +121,15 @@
|
||||
?>
|
||||
<tr class="row<?=$Row?>">
|
||||
<td class="nobr">
|
||||
<?=Users::format_username($ID, false, false, false)?>
|
||||
<?=Users::format_username($ID, false, false, false) ?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by staff member'; }?>
|
||||
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
|
||||
echo time_diff($LastAccess);
|
||||
} else {
|
||||
echo 'Hidden by staff member';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="nobr">
|
||||
<?=$Remark?>
|
||||
|
@ -9,20 +9,20 @@
|
||||
|
||||
*****************************************************************/
|
||||
|
||||
if(isset($argv[1])) {
|
||||
if($argv[1] == "cli_sandbox") {
|
||||
if (isset($argv[1])) {
|
||||
if ($argv[1] == "cli_sandbox") {
|
||||
include("misc/cli_sandbox.php");
|
||||
die();
|
||||
}
|
||||
|
||||
$_REQUEST['action'] = $argv[1];
|
||||
} else {
|
||||
if(empty($_REQUEST['action']) || ($_REQUEST['action'] != "public_sandbox" && $_REQUEST['action'] != "ocelot")) {
|
||||
if (empty($_REQUEST['action']) || ($_REQUEST['action'] != "public_sandbox" && $_REQUEST['action'] != "ocelot")) {
|
||||
enforce_login();
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($_REQUEST['action'])) {
|
||||
if (!isset($_REQUEST['action'])) {
|
||||
include(SERVER_ROOT.'/sections/tools/tools.php');
|
||||
die();
|
||||
}
|
||||
@ -120,8 +120,10 @@
|
||||
break;
|
||||
|
||||
case 'takeeditnews':
|
||||
if(!check_perms('admin_manage_news')){ error(403); }
|
||||
if(is_number($_POST['newsid'])){
|
||||
if (!check_perms('admin_manage_news')) {
|
||||
error(403);
|
||||
}
|
||||
if (is_number($_POST['newsid'])){
|
||||
$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');
|
||||
@ -130,8 +132,10 @@
|
||||
break;
|
||||
|
||||
case 'deletenews':
|
||||
if(!check_perms('admin_manage_news')){ error(403); }
|
||||
if(is_number($_GET['id'])){
|
||||
if (!check_perms('admin_manage_news')) {
|
||||
error(403);
|
||||
}
|
||||
if (is_number($_GET['id'])){
|
||||
authorize();
|
||||
$DB->query("DELETE FROM news WHERE ID='".db_string($_GET['id'])."'");
|
||||
$Cache->delete_value('news');
|
||||
@ -139,7 +143,7 @@
|
||||
|
||||
// Deleting latest news
|
||||
$LatestNews = $Cache->get_value('news_latest_id');
|
||||
if ($LatestNews !== FALSE && $LatestNews == $_GET['id']) {
|
||||
if ($LatestNews !== false && $LatestNews == $_GET['id']) {
|
||||
$Cache->delete_value('news_latest_id');
|
||||
}
|
||||
}
|
||||
@ -147,7 +151,9 @@
|
||||
break;
|
||||
|
||||
case 'takenewnews':
|
||||
if(!check_perms('admin_manage_news')){ error(403); }
|
||||
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()."')");
|
||||
|
||||
@ -173,7 +179,9 @@
|
||||
include('managers/tag_aliases.php');
|
||||
break;
|
||||
case 'permissions':
|
||||
if (!check_perms('admin_manage_permissions')) { error(403); }
|
||||
if (!check_perms('admin_manage_permissions')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
$Val->SetFields('name',true,'string','You did not enter a valid name for this permission set.');
|
||||
@ -185,7 +193,7 @@
|
||||
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,p.PermittedForums,p.Values,p.DisplayStaff,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID WHERE p.ID='".db_string($_REQUEST['id'])."' GROUP BY p.ID");
|
||||
list($ID,$Name,$Level,$Secondary,$Forums,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(5));
|
||||
|
||||
if($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) {
|
||||
if ($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) {
|
||||
error(403);
|
||||
}
|
||||
$Values = unserialize($Values);
|
||||
@ -205,15 +213,17 @@
|
||||
|
||||
$Values=array();
|
||||
foreach ($_REQUEST as $Key => $Perms) {
|
||||
if (substr($Key,0,5)=="perm_") { $Values[substr($Key,5)]= (int)$Perms; }
|
||||
if (substr($Key,0,5) == 'perm_') {
|
||||
$Values[substr($Key,5)] = (int)$Perms;
|
||||
}
|
||||
}
|
||||
|
||||
$Name=$_REQUEST['name'];
|
||||
$Level=$_REQUEST['level'];
|
||||
$Secondary=empty($_REQUEST['secondary'])?0:1;
|
||||
$Name = $_REQUEST['name'];
|
||||
$Level = $_REQUEST['level'];
|
||||
$Secondary = empty($_REQUEST['secondary']) ? 0 : 1;
|
||||
$Forums = $_REQUEST['forums'];
|
||||
$DisplayStaff=$_REQUEST['displaystaff'];
|
||||
$Values['MaxCollages']=$_REQUEST['maxcollages'];
|
||||
$DisplayStaff = $_REQUEST['displaystaff'];
|
||||
$Values['MaxCollages'] = $_REQUEST['maxcollages'];
|
||||
|
||||
if (!$Err) {
|
||||
if (!is_numeric($_REQUEST['id'])) {
|
||||
@ -395,7 +405,7 @@
|
||||
break;
|
||||
|
||||
case 'mod_sandbox':
|
||||
if(check_perms('users_mod')) {
|
||||
if (check_perms('users_mod')) {
|
||||
include('misc/mod_sandbox.php');
|
||||
} else {
|
||||
error(403);
|
||||
|
@ -77,8 +77,8 @@
|
||||
</td>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<td>
|
||||
<input type="submit" name="save" value="Save Alias" />
|
||||
<input type="submit" name="delete" value="Delete Alias" />
|
||||
<input type="submit" name="save" value="Save alias" />
|
||||
<input type="submit" name="delete" value="Delete alias" />
|
||||
</td>
|
||||
<? } ?>
|
||||
</form>
|
||||
|
@ -7,7 +7,7 @@
|
||||
$AuthKey = $LoggedUser['AuthKey'];
|
||||
} else {
|
||||
$UserInfo = $Cache->get_value('user_'.$_REQUEST['torrent_pass']);
|
||||
if(!is_array($UserInfo)) {
|
||||
if (!is_array($UserInfo)) {
|
||||
$DB->query("SELECT
|
||||
ID,
|
||||
DownloadAlt
|
||||
@ -38,7 +38,7 @@
|
||||
/* uTorrent remote redownloads .torrent files every fifteen minutes
|
||||
to prevent this retardation from blowing bandwidth etc., let's block it
|
||||
if he's downloaded the .torrent file twice before */
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'BTWebClient') !== FALSE) {
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'BTWebClient') !== false) {
|
||||
$DB->query("SELECT 1 FROM users_downloads WHERE UserID=$UserID AND TorrentID=$TorrentID LIMIT 3");
|
||||
if ($DB->record_count() > 2) {
|
||||
error('You have already downloaded this .torrent three times. If you need to download it again, please do so from your browser, not through uTorrent remote.');
|
||||
@ -47,7 +47,7 @@
|
||||
}
|
||||
|
||||
$Info = $Cache->get_value('torrent_download_'.$TorrentID);
|
||||
if(!is_array($Info) || !array_key_exists('PlainArtists', $Info) || empty($Info[10])) {
|
||||
if (!is_array($Info) || !array_key_exists('PlainArtists', $Info) || empty($Info[10])) {
|
||||
$DB->query("SELECT
|
||||
t.Media,
|
||||
t.Format,
|
||||
@ -63,7 +63,7 @@
|
||||
FROM torrents AS t
|
||||
INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
||||
WHERE t.ID='".db_string($TorrentID)."'");
|
||||
if($DB->record_count() < 1) {
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
$Info = array($DB->next_record(MYSQLI_NUM, array(4,5,6,10)));
|
||||
@ -72,7 +72,7 @@
|
||||
$Info['PlainArtists'] = Artists::display_artists($Artists, false, true, false);
|
||||
$Cache->cache_value('torrent_download_'.$TorrentID, $Info, 0);
|
||||
}
|
||||
if(!is_array($Info[0])) {
|
||||
if (!is_array($Info[0])) {
|
||||
error(404);
|
||||
}
|
||||
list($Media,$Format,$Encoding,$Year,$GroupID,$Name,$Image, $CategoryID, $Size, $FreeTorrent, $InfoHash) = array_shift($Info); // used for generating the filename
|
||||
@ -129,16 +129,16 @@
|
||||
}
|
||||
|
||||
//Stupid Recent Snatches On User Page
|
||||
if($CategoryID == '1' && $Image != "") {
|
||||
if ($CategoryID == '1' && $Image != "") {
|
||||
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
|
||||
if(!empty($RecentSnatches)) {
|
||||
if (!empty($RecentSnatches)) {
|
||||
$Snatch = array('ID'=>$GroupID,'Name'=>$Name,'Artist'=>$Artists,'WikiImage'=>$Image);
|
||||
if(!in_array($Snatch, $RecentSnatches)) {
|
||||
if(count($RecentSnatches) == 5) {
|
||||
if (!in_array($Snatch, $RecentSnatches)) {
|
||||
if (count($RecentSnatches) == 5) {
|
||||
array_pop($RecentSnatches);
|
||||
}
|
||||
array_unshift($RecentSnatches, $Snatch);
|
||||
} elseif(!is_array($RecentSnatches)) {
|
||||
} elseif (!is_array($RecentSnatches)) {
|
||||
$RecentSnatches = array($Snatch);
|
||||
}
|
||||
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0);
|
||||
@ -155,7 +155,7 @@
|
||||
|
||||
if ($DownloadAlt) {
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
} else if (!$DownloadAlt || $Failed) {
|
||||
} elseif (!$DownloadAlt || $Failed) {
|
||||
header('Content-Type: application/x-bittorrent; charset=utf-8');
|
||||
}
|
||||
header('Content-disposition: attachment; filename="'.$FileName.'"');
|
||||
|
@ -149,7 +149,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
function is_valid_torrenthash($Str) {
|
||||
//6C19FF4C 6C1DD265 3B25832C 0F6228B2 52D743D5
|
||||
$Str = str_replace(' ', '', $Str);
|
||||
if(preg_match('/^[0-9a-fA-F]{40}$/', $Str))
|
||||
if (preg_match('/^[0-9a-fA-F]{40}$/', $Str))
|
||||
return $Str;
|
||||
return false;
|
||||
}
|
||||
@ -168,7 +168,7 @@ function get_group_requests($GroupID) {
|
||||
global $DB, $Cache;
|
||||
|
||||
$Requests = $Cache->get_value('requests_group_'.$GroupID);
|
||||
if ($Requests === FALSE) {
|
||||
if ($Requests === false) {
|
||||
$DB->query("SELECT ID FROM requests WHERE GroupID = $GroupID AND TimeFilled = '0000-00-00 00:00:00'");
|
||||
$Requests = $DB->collect('ID');
|
||||
$Cache->cache_value('requests_group_'.$GroupID, $Requests, 0);
|
||||
|
@ -85,7 +85,7 @@
|
||||
$Cache->delete_value('vote_pairs_'.$CacheGroupID);
|
||||
}
|
||||
// 4. Clear the new groups vote keys
|
||||
|
||||
$Cache->delete_value('votes_'.$NewGroupID);
|
||||
|
||||
$DB->query("UPDATE torrents SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("UPDATE wiki_torrents SET PageID='$NewGroupID' WHERE PageID='$GroupID'");
|
||||
|
@ -76,7 +76,7 @@ function unlink_user($UserID) {
|
||||
error(403);
|
||||
}
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
if ($UserInfo === FALSE) {
|
||||
if ($UserInfo === false) {
|
||||
return;
|
||||
}
|
||||
$AdminComment = sqltime()." - Linked accounts updated: [user]".$UserInfo['Username']."[/user] unlinked by ".$LoggedUser['Username'];
|
||||
@ -167,7 +167,7 @@ function user_dupes_table($UserID) {
|
||||
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" />
|
||||
<div class="box">
|
||||
<div class="head"><?=max($DupeCount - 1, 0)?> linked account<?=(($DupeCount == 2)?'':'s')?> <a href="#" onclick="$('.linkedaccounts').toggle(); return false;" class="brackets">View</a></div>
|
||||
<div class="head"><?=max($DupeCount - 1, 0)?> Linked account<?=(($DupeCount == 2)?'':'s')?> <a href="#" onclick="$('.linkedaccounts').toggle(); return false;" class="brackets">View</a></div>
|
||||
<table width="100%" class="layout hidden linkedaccounts">
|
||||
<?=$DupeCount?'<tr>':''?>
|
||||
<?
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?
|
||||
if(!check_perms('site_torrents_notify')){ error(403); }
|
||||
if (!check_perms('site_torrents_notify')) {
|
||||
error(403);
|
||||
}
|
||||
View::show_header('Manage notifications');
|
||||
?>
|
||||
<div class="thin">
|
||||
@ -16,7 +18,7 @@
|
||||
|
||||
$Notifications = $DB->to_array();
|
||||
|
||||
foreach($Notifications as $N) { //$N stands for Notifications
|
||||
foreach ($Notifications as $N) { //$N stands for Notifications
|
||||
$N['Artists'] = implode(', ', explode('|', substr($N['Artists'],1,-1)));
|
||||
$N['Tags'] = implode(', ', explode('|', substr($N['Tags'],1,-1)));
|
||||
$N['NotTags'] = implode(', ', explode('|', substr($N['NotTags'],1,-1)));
|
||||
@ -25,13 +27,13 @@
|
||||
$N['Formats'] = explode('|', substr($N['Formats'],1,-1));
|
||||
$N['Encodings'] = explode('|', substr($N['Encodings'],1,-1));
|
||||
$N['Media'] = explode('|', substr($N['Media'],1,-1));
|
||||
if($N['FromYear'] ==0) { $N['FromYear'] = ''; }
|
||||
if($N['ToYear'] ==0) { $N['ToYear'] = ''; }
|
||||
if ($N['FromYear'] == 0) { $N['FromYear'] = ''; }
|
||||
if ($N['ToYear'] == 0) { $N['ToYear'] = ''; }
|
||||
$i++;
|
||||
|
||||
if($i>$NumFilters && $NumFilters>0){ ?>
|
||||
if ($i > $NumFilters && $NumFilters > 0) { ?>
|
||||
<h3>Create a new notification filter</h3>
|
||||
<? } elseif($NumFilters>0) { ?>
|
||||
<? } elseif ($NumFilters>0) { ?>
|
||||
<h3>
|
||||
<a href="feeds.php?feed=torrents_notify_<?=$N['ID']?>_<?=$LoggedUser['torrent_pass']?>&user=<?=$LoggedUser['ID']?>&auth=<?=$LoggedUser['RSS_Auth']?>&passkey=<?=$LoggedUser['torrent_pass']?>&authkey=<?=$LoggedUser['AuthKey']?>&name=<?=urlencode($N['Label'])?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a>
|
||||
<?=display_str($N['Label'])?>
|
||||
@ -39,12 +41,12 @@
|
||||
<a href="#" onclick="$('#filter_<?=$N['ID']?>').toggle(); return false;" class="brackets">Show</a>
|
||||
</h3>
|
||||
<? } ?>
|
||||
<form class="<?=($i>$NumFilters)?'create_form':'edit_form'?>" name="notification" action="user.php" method="post">
|
||||
<form class="<?=($i > $NumFilters) ? 'create_form' : 'edit_form'?>" name="notification" action="user.php" method="post">
|
||||
<input type="hidden" name="formid" value="<?=$i?>" />
|
||||
<input type="hidden" name="action" value="notify_handle" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<table <?=($i<=$NumFilters)?'id="filter_'.$N['ID'].'" class="layout hidden"':'class="layout"'?>>
|
||||
<? if($i>$NumFilters){ ?>
|
||||
<table <?=($i <= $NumFilters) ? 'id="filter_'.$N['ID'].'" class="layout hidden"' : 'class="layout"'?>>
|
||||
<? if ($i > $NumFilters) { ?>
|
||||
<tr>
|
||||
<td class="label"><strong>Label</strong></td>
|
||||
<td>
|
||||
@ -65,7 +67,7 @@
|
||||
<td>
|
||||
<textarea name="artists<?=$i?>" style="width:100%" rows="5"><?=display_str($N['Artists'])?></textarea>
|
||||
<p class="min_padding">Comma-separated list — e.g. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p>
|
||||
<input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if($N['ExcludeVA']=="1") { echo ' checked="checked"';} ?> />
|
||||
<input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if ($N['ExcludeVA'] == '1') { echo ' checked="checked"';} ?> />
|
||||
<label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label>
|
||||
</td>
|
||||
</tr>
|
||||
@ -86,8 +88,8 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only these categories</strong></td>
|
||||
<td>
|
||||
<? foreach($Categories as $Category){ ?>
|
||||
<input type="checkbox" name="categories<?=$i?>[]" id="<?=$Category?>_<?=$N['ID']?>" value="<?=$Category?>"<? if(in_array($Category, $N['Categories'])) { echo ' checked="checked"';} ?> />
|
||||
<? foreach ($Categories as $Category) { ?>
|
||||
<input type="checkbox" name="categories<?=$i?>[]" id="<?=$Category?>_<?=$N['ID']?>" value="<?=$Category?>"<? if (in_array($Category, $N['Categories'])) { echo ' checked="checked"';} ?> />
|
||||
<label for="<?=$Category?>_<?=$N['ID']?>"><?=$Category?></label>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -95,8 +97,8 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only these types</strong></td>
|
||||
<td>
|
||||
<? foreach($ReleaseTypes as $ReleaseType){ ?>
|
||||
<input type="checkbox" name="releasetypes<?=$i?>[]" id="<?=$ReleaseType?>_<?=$N['ID']?>" value="<?=$ReleaseType?>"<? if(in_array($ReleaseType, $N['ReleaseTypes'])) { echo ' checked="checked"';} ?> />
|
||||
<? foreach ($ReleaseTypes as $ReleaseType) { ?>
|
||||
<input type="checkbox" name="releasetypes<?=$i?>[]" id="<?=$ReleaseType?>_<?=$N['ID']?>" value="<?=$ReleaseType?>"<? if (in_array($ReleaseType, $N['ReleaseTypes'])) { echo ' checked="checked"';} ?> />
|
||||
<label for="<?=$ReleaseType?>_<?=$N['ID']?>"><?=$ReleaseType?></label>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -104,8 +106,8 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only these formats</strong></td>
|
||||
<td>
|
||||
<? foreach($Formats as $Format){ ?>
|
||||
<input type="checkbox" name="formats<?=$i?>[]" id="<?=$Format?>_<?=$N['ID']?>" value="<?=$Format?>"<? if(in_array($Format, $N['Formats'])) { echo ' checked="checked"';} ?> />
|
||||
<? foreach ($Formats as $Format) { ?>
|
||||
<input type="checkbox" name="formats<?=$i?>[]" id="<?=$Format?>_<?=$N['ID']?>" value="<?=$Format?>"<? if (in_array($Format, $N['Formats'])) { echo ' checked="checked"';} ?> />
|
||||
<label for="<?=$Format?>_<?=$N['ID']?>"><?=$Format?></label>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -113,8 +115,8 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only these bitrates</strong></td>
|
||||
<td>
|
||||
<? foreach($Bitrates as $Bitrate){ ?>
|
||||
<input type="checkbox" name="bitrates<?=$i?>[]" id="<?=$Bitrate?>_<?=$N['ID']?>" value="<?=$Bitrate?>"<? if(in_array($Bitrate, $N['Encodings'])) { echo ' checked="checked"';} ?> />
|
||||
<? foreach ($Bitrates as $Bitrate) { ?>
|
||||
<input type="checkbox" name="bitrates<?=$i?>[]" id="<?=$Bitrate?>_<?=$N['ID']?>" value="<?=$Bitrate?>"<? if (in_array($Bitrate, $N['Encodings'])) { echo ' checked="checked"';} ?> />
|
||||
<label for="<?=$Bitrate?>_<?=$N['ID']?>"><?=$Bitrate?></label>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -122,8 +124,8 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only these media</strong></td>
|
||||
<td>
|
||||
<? foreach($Media as $Medium){ ?>
|
||||
<input type="checkbox" name="media<?=$i?>[]" id="<?=$Medium?>_<?=$N['ID']?>" value="<?=$Medium?>"<? if(in_array($Medium, $N['Media'])) { echo ' checked="checked"';} ?> />
|
||||
<? foreach ($Media as $Medium) { ?>
|
||||
<input type="checkbox" name="media<?=$i?>[]" id="<?=$Medium?>_<?=$N['ID']?>" value="<?=$Medium?>"<? if (in_array($Medium, $N['Media'])) { echo ' checked="checked"';} ?> />
|
||||
<label for="<?=$Medium?>_<?=$N['ID']?>"><?=$Medium?></label>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -139,7 +141,7 @@
|
||||
<tr>
|
||||
<td class="label"><strong>Only new releases</strong></td>
|
||||
<td>
|
||||
<input type="checkbox" name="newgroupsonly<?=$i?>" id="newgroupsonly_<?=$N['ID']?>"<? if($N['NewGroupsOnly']=="1") { echo ' checked="checked"';} ?> />
|
||||
<input type="checkbox" name="newgroupsonly<?=$i?>" id="newgroupsonly_<?=$N['ID']?>"<? if ($N['NewGroupsOnly'] == '1') { echo ' checked="checked"';} ?> />
|
||||
<label for="newgroupsonly_<?=$N['ID']?>">Only notify for new releases, not new formats</label>
|
||||
</td>
|
||||
</tr>
|
||||
@ -150,7 +152,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<? if($i==$NumFilters){ ?>
|
||||
<? if ($i == $NumFilters) { ?>
|
||||
<br /><br />
|
||||
<? }
|
||||
} ?>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?
|
||||
if(!check_perms('site_torrents_notify')){ error(403); }
|
||||
if (!check_perms('site_torrents_notify')) {
|
||||
error(403);
|
||||
}
|
||||
authorize();
|
||||
|
||||
$FormID = '';
|
||||
@ -15,114 +17,114 @@
|
||||
$ToYear = 0;
|
||||
$HasFilter = false;
|
||||
|
||||
if($_POST['formid'] && is_number($_POST['formid'])) {
|
||||
if ($_POST['formid'] && is_number($_POST['formid'])) {
|
||||
$FormID = $_POST['formid'];
|
||||
}
|
||||
|
||||
if($_POST['artists'.$FormID]){
|
||||
if ($_POST['artists'.$FormID]) {
|
||||
$Artists = explode(',', $_POST['artists'.$FormID]);
|
||||
$ParsedArtists = array();
|
||||
foreach($Artists as $Artist){
|
||||
if(trim($Artist) != "") {
|
||||
foreach ($Artists as $Artist) {
|
||||
if (trim($Artist) != "") {
|
||||
$ParsedArtists[] = db_string(trim($Artist));
|
||||
}
|
||||
}
|
||||
if(count($ParsedArtists) > 0) {
|
||||
if (count($ParsedArtists) > 0) {
|
||||
$ArtistList = '|'.implode("|", $ParsedArtists).'|';
|
||||
$HasFilter = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['excludeva'.$FormID]){
|
||||
if ($_POST['excludeva'.$FormID]) {
|
||||
$ExcludeVA = '1';
|
||||
$HasFilter = true;
|
||||
} else {
|
||||
$ExcludeVA = '0';
|
||||
}
|
||||
|
||||
if($_POST['newgroupsonly'.$FormID]){
|
||||
if ($_POST['newgroupsonly'.$FormID]) {
|
||||
$NewGroupsOnly = '1';
|
||||
$HasFilter = true;
|
||||
} else {
|
||||
$NewGroupsOnly = '0';
|
||||
}
|
||||
|
||||
if($_POST['tags'.$FormID]){
|
||||
if ($_POST['tags'.$FormID]) {
|
||||
$TagList = '|';
|
||||
$Tags = explode(',', $_POST['tags'.$FormID]);
|
||||
foreach($Tags as $Tag){
|
||||
foreach ($Tags as $Tag) {
|
||||
$TagList.=db_string(trim($Tag)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['nottags'.$FormID]){
|
||||
if ($_POST['nottags'.$FormID]) {
|
||||
$NotTagList = '|';
|
||||
$Tags = explode(',', $_POST['nottags'.$FormID]);
|
||||
foreach($Tags as $Tag){
|
||||
foreach ($Tags as $Tag) {
|
||||
$NotTagList.=db_string(trim($Tag)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['categories'.$FormID]){
|
||||
if ($_POST['categories'.$FormID]) {
|
||||
$CategoryList = '|';
|
||||
foreach($_POST['categories'.$FormID] as $Category){
|
||||
foreach ($_POST['categories'.$FormID] as $Category) {
|
||||
$CategoryList.=db_string(trim($Category)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['releasetypes'.$FormID]){
|
||||
if ($_POST['releasetypes'.$FormID]) {
|
||||
$ReleaseTypeList = '|';
|
||||
foreach($_POST['releasetypes'.$FormID] as $ReleaseType){
|
||||
foreach ($_POST['releasetypes'.$FormID] as $ReleaseType) {
|
||||
$ReleaseTypeList.=db_string(trim($ReleaseType)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['formats'.$FormID]){
|
||||
if ($_POST['formats'.$FormID]) {
|
||||
$FormatList = '|';
|
||||
foreach($_POST['formats'.$FormID] as $Format){
|
||||
foreach ($_POST['formats'.$FormID] as $Format) {
|
||||
$FormatList.=db_string(trim($Format)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
|
||||
if($_POST['bitrates'.$FormID]){
|
||||
if ($_POST['bitrates'.$FormID]) {
|
||||
$EncodingList = '|';
|
||||
foreach($_POST['bitrates'.$FormID] as $Bitrate){
|
||||
foreach ($_POST['bitrates'.$FormID] as $Bitrate) {
|
||||
$EncodingList.=db_string(trim($Bitrate)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['media'.$FormID]){
|
||||
if ($_POST['media'.$FormID]) {
|
||||
$MediaList = '|';
|
||||
foreach($_POST['media'.$FormID] as $Medium){
|
||||
foreach ($_POST['media'.$FormID] as $Medium) {
|
||||
$MediaList.=db_string(trim($Medium)).'|';
|
||||
}
|
||||
$HasFilter = true;
|
||||
}
|
||||
|
||||
if($_POST['fromyear'.$FormID] && is_number($_POST['fromyear'.$FormID])){
|
||||
if ($_POST['fromyear'.$FormID] && is_number($_POST['fromyear'.$FormID])) {
|
||||
$FromYear = trim($_POST['fromyear'.$FormID]);
|
||||
$HasFilter = true;
|
||||
if($_POST['toyear'.$FormID] && is_number($_POST['toyear'.$FormID])) {
|
||||
if ($_POST['toyear'.$FormID] && is_number($_POST['toyear'.$FormID])) {
|
||||
$ToYear = trim($_POST['toyear'.$FormID]);
|
||||
} else {
|
||||
$ToYear = date('Y')+3;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$HasFilter){
|
||||
if (!$HasFilter) {
|
||||
$Err = 'You must add at least one criterion to filter by';
|
||||
} elseif(!$_POST['label'.$FormID] && !$_POST['id'.$FormID]) {
|
||||
} elseif (!$_POST['label'.$FormID] && !$_POST['id'.$FormID]) {
|
||||
$Err = 'You must add a label for the filter set';
|
||||
}
|
||||
|
||||
if($Err){
|
||||
if ($Err) {
|
||||
error($Err);
|
||||
header('Location: user.php?action=notify');
|
||||
die();
|
||||
@ -132,7 +134,7 @@
|
||||
$TagList = str_replace('||','|',$TagList);
|
||||
$NotTagList = str_replace('||','|',$NotTagList);
|
||||
|
||||
if($_POST['id'.$FormID] && is_number($_POST['id'.$FormID])){
|
||||
if ($_POST['id'.$FormID] && is_number($_POST['id'.$FormID])) {
|
||||
$DB->query("UPDATE users_notify_filters SET
|
||||
Artists='$ArtistList',
|
||||
ExcludeVA='$ExcludeVA',
|
||||
@ -155,7 +157,7 @@
|
||||
}
|
||||
|
||||
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
||||
if(($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) !== FALSE && $Notify['ID'] == $_POST['id'.$FormID]) {
|
||||
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) !== false && $Notify['ID'] == $_POST['id'.$FormID]) {
|
||||
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
||||
}
|
||||
header('Location: user.php?action=notify');
|
||||
|
@ -23,33 +23,35 @@
|
||||
$Username = db_string($_POST['Username']);
|
||||
$Title = db_string($_POST['Title']);
|
||||
$AdminComment = db_string($_POST['AdminComment']);
|
||||
$Donor = (isset($_POST['Donor']))? 1 : 0;
|
||||
$Artist = (isset($_POST['Artist']))? 1 : 0;
|
||||
$SecondaryClasses = isset($_POST['secondary_classes'])?$_POST['secondary_classes']:array();
|
||||
$Donor = (isset($_POST['Donor'])) ? 1 : 0;
|
||||
$Artist = (isset($_POST['Artist'])) ? 1 : 0;
|
||||
$SecondaryClasses = isset($_POST['secondary_classes']) ? $_POST['secondary_classes'] : array();
|
||||
foreach ($SecondaryClasses as $i => $Val) {
|
||||
if(!is_number($Val)) { unset($SecondaryClasses[$i]); }
|
||||
if (!is_number($Val)) {
|
||||
unset($SecondaryClasses[$i]);
|
||||
}
|
||||
}
|
||||
$Visible = (isset($_POST['Visible']))? 1 : 0;
|
||||
$Visible = (isset($_POST['Visible'])) ? 1 : 0;
|
||||
$Invites = (int)$_POST['Invites'];
|
||||
$SupportFor = db_string($_POST['SupportFor']);
|
||||
$Pass = $_POST['ChangePassword'];
|
||||
$Warned = (isset($_POST['Warned']))? 1 : 0;
|
||||
$Warned = (isset($_POST['Warned'])) ? 1 : 0;
|
||||
$Logs095 = (int)$_POST['095logs'];
|
||||
if(isset($_POST['Uploaded']) && isset($_POST['Downloaded'])) {
|
||||
$Uploaded = ($_POST['Uploaded'] == "" ? 0 : $_POST['Uploaded']);
|
||||
if($Arithmetic = strpbrk($Uploaded, '+-')) {
|
||||
if (isset($_POST['Uploaded']) && isset($_POST['Downloaded'])) {
|
||||
$Uploaded = ($_POST['Uploaded'] == '' ? 0 : $_POST['Uploaded']);
|
||||
if ($Arithmetic = strpbrk($Uploaded, '+-')) {
|
||||
$Uploaded += max(-$Uploaded, Format::get_bytes($Arithmetic));
|
||||
}
|
||||
$Downloaded = ($_POST['Downloaded'] == "" ? 0 : $_POST['Downloaded']);
|
||||
if($Arithmetic = strpbrk($Downloaded, '+-')) {
|
||||
$Downloaded = ($_POST['Downloaded'] == '' ? 0 : $_POST['Downloaded']);
|
||||
if ($Arithmetic = strpbrk($Downloaded, '+-')) {
|
||||
$Downloaded += max(-$Downloaded, Format::get_bytes($Arithmetic));
|
||||
}
|
||||
if(!is_number($Uploaded) || !is_number($Downloaded)) {
|
||||
if (!is_number($Uploaded) || !is_number($Downloaded)) {
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$FLTokens = isset($_POST['FLTokens'])?$_POST['FLTokens'] : 0;
|
||||
if(!is_number($FLTokens)) {
|
||||
$FLTokens = isset($_POST['FLTokens']) ? $_POST['FLTokens'] : 0;
|
||||
if (!is_number($FLTokens)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
@ -58,26 +60,26 @@
|
||||
$ReduceWarning = (int)$_POST['ReduceWarning'];
|
||||
$WarnReason = $_POST['WarnReason'];
|
||||
$UserReason = $_POST['UserReason'];
|
||||
$DisableAvatar = (isset($_POST['DisableAvatar']))? 1 : 0;
|
||||
$DisableInvites = (isset($_POST['DisableInvites']))? 1 : 0;
|
||||
$DisablePosting = (isset($_POST['DisablePosting']))? 1 : 0;
|
||||
$DisableForums = (isset($_POST['DisableForums']))? 1 : 0;
|
||||
$DisableTagging = (isset($_POST['DisableTagging']))? 1 : 0;
|
||||
$DisableUpload = (isset($_POST['DisableUpload']))? 1 : 0;
|
||||
$DisableWiki = (isset($_POST['DisableWiki']))? 1 : 0;
|
||||
$DisablePM = (isset($_POST['DisablePM']))? 1 : 0;
|
||||
$DisableIRC = (isset($_POST['DisableIRC']))? 1 : 0;
|
||||
$DisableRequests = (isset($_POST['DisableRequests']))? 1 : 0;
|
||||
$DisableAvatar = (isset($_POST['DisableAvatar'])) ? 1 : 0;
|
||||
$DisableInvites = (isset($_POST['DisableInvites'])) ? 1 : 0;
|
||||
$DisablePosting = (isset($_POST['DisablePosting'])) ? 1 : 0;
|
||||
$DisableForums = (isset($_POST['DisableForums'])) ? 1 : 0;
|
||||
$DisableTagging = (isset($_POST['DisableTagging'])) ? 1 : 0;
|
||||
$DisableUpload = (isset($_POST['DisableUpload'])) ? 1 : 0;
|
||||
$DisableWiki = (isset($_POST['DisableWiki'])) ? 1 : 0;
|
||||
$DisablePM = (isset($_POST['DisablePM'])) ? 1 : 0;
|
||||
$DisableIRC = (isset($_POST['DisableIRC'])) ? 1 : 0;
|
||||
$DisableRequests = (isset($_POST['DisableRequests'])) ? 1 : 0;
|
||||
$DisableLeech = (isset($_POST['DisableLeech'])) ? 0 : 1;
|
||||
|
||||
$RestrictedForums = db_string(trim($_POST['RestrictedForums']));
|
||||
$PermittedForums = db_string(trim($_POST['PermittedForums']));
|
||||
$EnableUser = (int)$_POST['UserStatus'];
|
||||
$ResetRatioWatch = (isset($_POST['ResetRatioWatch']))? 1 : 0;
|
||||
$ResetPasskey = (isset($_POST['ResetPasskey']))? 1 : 0;
|
||||
$ResetAuthkey = (isset($_POST['ResetAuthkey']))? 1 : 0;
|
||||
$SendHackedMail = (isset($_POST['SendHackedMail']))? 1 : 0;
|
||||
if($SendHackedMail && !empty($_POST['HackedEmail'])) {
|
||||
$ResetRatioWatch = (isset($_POST['ResetRatioWatch'])) ? 1 : 0;
|
||||
$ResetPasskey = (isset($_POST['ResetPasskey'])) ? 1 : 0;
|
||||
$ResetAuthkey = (isset($_POST['ResetAuthkey'])) ? 1 : 0;
|
||||
$SendHackedMail = (isset($_POST['SendHackedMail'])) ? 1 : 0;
|
||||
if ($SendHackedMail && !empty($_POST['HackedEmail'])) {
|
||||
$HackedEmail = $_POST['HackedEmail'];
|
||||
} else {
|
||||
$SendHackedMail = false;
|
||||
@ -144,7 +146,7 @@
|
||||
}
|
||||
|
||||
//NOW that we know the class of the current user, we can see if one staff member is trying to hax0r us.
|
||||
if(!check_perms('users_mod', $Cur['Class'])) {
|
||||
if (!check_perms('users_mod', $Cur['Class'])) {
|
||||
//Son of a fucking bitch
|
||||
error(403);
|
||||
die();
|
||||
@ -155,7 +157,7 @@
|
||||
|
||||
// If we're deleting the user, we can ignore all the other crap
|
||||
|
||||
if ($_POST['UserStatus']=="delete" && check_perms('users_delete_users')) {
|
||||
if ($_POST['UserStatus'] == "delete" && check_perms('users_delete_users')) {
|
||||
Misc::write_log("User account ".$UserID." (".$Cur['Username'].") was deleted by ".$LoggedUser['Username']);
|
||||
$DB->query("DELETE FROM users_main WHERE id=".$UserID);
|
||||
$DB->query("DELETE FROM users_info WHERE UserID=".$UserID);
|
||||
@ -174,7 +176,7 @@
|
||||
|
||||
if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
|
||||
$DB->query("UPDATE users_info SET RatioWatchEnds='0000-00-00 00:00:00', RatioWatchDownload='0', RatioWatchTimes='0' WHERE UserID='$UserID'");
|
||||
$EditSummary[]='RatioWatch history reset';
|
||||
$EditSummary[] = 'RatioWatch history reset';
|
||||
}
|
||||
|
||||
if ($_POST['ResetIPHistory'] && check_perms('users_edit_reset_keys')) {
|
||||
@ -183,7 +185,7 @@
|
||||
$DB->query("UPDATE users_main SET IP='127.0.0.1' WHERE ID='$UserID'");
|
||||
$DB->query("UPDATE xbt_snatched SET IP = '' WHERE uid='$UserID'");
|
||||
$DB->query("UPDATE users_history_passwords SET ChangerIP = '' WHERE UserID = ".$UserID);
|
||||
$EditSummary[]='IP history cleared';
|
||||
$EditSummary[] = 'IP history cleared';
|
||||
}
|
||||
|
||||
if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
|
||||
@ -194,17 +196,17 @@
|
||||
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP) VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','".$Cur['IP']."')");
|
||||
}
|
||||
$DB->query("UPDATE users_main SET Email='$Username@".SITE_URL."' WHERE ID='$UserID'");
|
||||
$EditSummary[]='Email history cleared';
|
||||
$EditSummary[] = 'Email history cleared';
|
||||
}
|
||||
|
||||
if ($_POST['ResetSnatchList'] && check_perms('users_edit_reset_keys')) {
|
||||
$DB->query("DELETE FROM xbt_snatched WHERE uid='$UserID'");
|
||||
$EditSummary[]='Snatch List cleared';
|
||||
$EditSummary[] = 'Snatch list cleared';
|
||||
}
|
||||
|
||||
if ($_POST['ResetDownloadList'] && check_perms('users_edit_reset_keys')) {
|
||||
$DB->query("DELETE FROM users_downloads WHERE UserID='$UserID'");
|
||||
$EditSummary[]='Download List cleared';
|
||||
$EditSummary[] = 'Download list cleared';
|
||||
}
|
||||
|
||||
if (($_POST['ResetSession'] || $_POST['LogOut']) && check_perms('users_logout')) {
|
||||
@ -213,7 +215,7 @@
|
||||
$Cache->delete_value('user_stats_'.$UserID);
|
||||
$Cache->delete_value('enabled_'.$UserID);
|
||||
|
||||
if($_POST['LogOut']) {
|
||||
if ($_POST['LogOut']) {
|
||||
$DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID'");
|
||||
while(list($SessionID) = $DB->next_record()) {
|
||||
$Cache->delete_value('session_'.$UserID.'_'.$SessionID);
|
||||
@ -248,54 +250,54 @@
|
||||
|
||||
|
||||
// Start building SQL query and edit summary
|
||||
if ($Classes[$Class]['Level']!=$Cur['Class'] && (
|
||||
if ($Classes[$Class]['Level'] != $Cur['Class'] && (
|
||||
($Classes[$Class]['Level'] < $LoggedUser['Class'] && check_perms('users_promote_below', $Cur['Class']))
|
||||
|| ($Classes[$Class]['Level'] <= $LoggedUser['Class'] && check_perms('users_promote_to', $Cur['Class']-1)))) {
|
||||
$UpdateSet[]="PermissionID='$Class'";
|
||||
$EditSummary[]="class changed to ".Users::make_class_string($Class);
|
||||
$LightUpdates['PermissionID']=$Class;
|
||||
$UpdateSet[] = "PermissionID='$Class'";
|
||||
$EditSummary[] = "class changed to ".Users::make_class_string($Class);
|
||||
$LightUpdates['PermissionID'] = $Class;
|
||||
$DeleteKeys = true;
|
||||
|
||||
$DB->query("SELECT DISTINCT DisplayStaff FROM permissions WHERE ID = $Class OR ID = ".$ClassLevels[$Cur['Class']]['ID']);
|
||||
if($DB->record_count() == 2) {
|
||||
if($Classes[$Class]['Level'] < $Cur['Class']) {
|
||||
if ($DB->record_count() == 2) {
|
||||
if ($Classes[$Class]['Level'] < $Cur['Class']) {
|
||||
$SupportFor = '';
|
||||
}
|
||||
$ClearStaffIDCache = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($Username!=$Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class']-1)) {
|
||||
if ($Username != $Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class']-1)) {
|
||||
$DB->query("SELECT ID FROM users_main WHERE Username = '".$Username."'");
|
||||
if($DB->next_record() > 0) {
|
||||
if ($DB->next_record() > 0) {
|
||||
list($UsedUsernameID) = $DB->next_record();
|
||||
error("Username already in use by <a href='user.php?id=".$UsedUsernameID."'>".$Username."</a>");
|
||||
header("Location: user.php?id=".$UserID);
|
||||
die();
|
||||
} else {
|
||||
$UpdateSet[]="Username='".$Username."'";
|
||||
$EditSummary[]="username changed from ".$Cur['Username']." to ".$Username;
|
||||
$LightUpdates['Username']=$Username;
|
||||
$UpdateSet[] = "Username='".$Username."'";
|
||||
$EditSummary[] = "username changed from ".$Cur['Username']." to ".$Username;
|
||||
$LightUpdates['Username'] = $Username;
|
||||
}
|
||||
}
|
||||
|
||||
if ($Title!=db_string($Cur['Title']) && check_perms('users_edit_titles')) {
|
||||
if ($Title != db_string($Cur['Title']) && check_perms('users_edit_titles')) {
|
||||
// Using the unescaped value for the test to avoid confusion
|
||||
if (strlen($_POST['Title']) > 1024) {
|
||||
error("Custom titles can be at most 1024 characters.");
|
||||
header("Location: user.php?id=".$UserID);
|
||||
die();
|
||||
} else {
|
||||
$UpdateSet[]="Title='$Title'";
|
||||
$EditSummary[]="title changed to $Title";
|
||||
$LightUpdates['Title']=$_POST['Title'];
|
||||
$UpdateSet[] = "Title='$Title'";
|
||||
$EditSummary[] = "title changed to $Title";
|
||||
$LightUpdates['Title'] = $_POST['Title'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($Donor!=$Cur['Donor'] && check_perms('users_give_donor')) {
|
||||
$UpdateSet[]="Donor='$Donor'";
|
||||
$EditSummary[]="donor status changed";
|
||||
$LightUpdates['Donor']=$Donor;
|
||||
if ($Donor != $Cur['Donor'] && check_perms('users_give_donor')) {
|
||||
$UpdateSet[] = "Donor='$Donor'";
|
||||
$EditSummary[] = "donor status changed";
|
||||
$LightUpdates['Donor'] = $Donor;
|
||||
}
|
||||
|
||||
// Secondary classes
|
||||
@ -310,9 +312,9 @@
|
||||
$EditSummary[] = "Secondary classes dropped: ".implode(', ',$ClassChanges);
|
||||
$DB->query("DELETE FROM users_levels WHERE UserID = '$UserID' AND PermissionID IN (".implode(',',$DroppedClasses).")");
|
||||
if (count($SecondaryClasses) > 0) {
|
||||
$LightUpdates['ExtraClasses']= array_fill_keys($SecondaryClasses, 1);
|
||||
$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1);
|
||||
} else {
|
||||
$LightUpdates['ExtraClasses']= array();
|
||||
$LightUpdates['ExtraClasses'] = array();
|
||||
}
|
||||
$DeleteKeys = true;
|
||||
}
|
||||
@ -328,92 +330,98 @@
|
||||
|
||||
}
|
||||
$DB->query("INSERT INTO users_levels (UserID, PermissionID) VALUES ".implode(', ',$Values));
|
||||
//$LightUpdates['ExtraClasses']= array_fill_keys($SecondaryClasses, 1);
|
||||
//$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1);
|
||||
$DeleteKeys = true;
|
||||
}
|
||||
|
||||
if ($Visible!=$Cur['Visible'] && check_perms('users_make_invisible')) {
|
||||
$UpdateSet[]="Visible='$Visible'";
|
||||
$EditSummary[]="visibility changed";
|
||||
$LightUpdates['Visible']=$Visible;
|
||||
if ($Visible != $Cur['Visible'] && check_perms('users_make_invisible')) {
|
||||
$UpdateSet[] = "Visible='$Visible'";
|
||||
$EditSummary[] = "visibility changed";
|
||||
$LightUpdates['Visible'] = $Visible;
|
||||
}
|
||||
|
||||
if ($Uploaded!=$Cur['Uploaded'] && $Uploaded!=$_POST['OldUploaded'] && (check_perms('users_edit_ratio')
|
||||
if ($Uploaded != $Cur['Uploaded'] && $Uploaded != $_POST['OldUploaded'] && (check_perms('users_edit_ratio')
|
||||
|| (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[]="Uploaded='".$Uploaded."'";
|
||||
$EditSummary[]="uploaded changed from ".Format::get_size($Cur['Uploaded'])." to ".Format::get_size($Uploaded);
|
||||
$UpdateSet[] = "Uploaded='".$Uploaded."'";
|
||||
$EditSummary[] = "uploaded changed from ".Format::get_size($Cur['Uploaded'])." to ".Format::get_size($Uploaded);
|
||||
$Cache->delete_value('users_stats_'.$UserID);
|
||||
}
|
||||
|
||||
if ($Downloaded!=$Cur['Downloaded'] && $Downloaded!=$_POST['OldDownloaded'] && (check_perms('users_edit_ratio')
|
||||
if ($Downloaded != $Cur['Downloaded'] && $Downloaded != $_POST['OldDownloaded'] && (check_perms('users_edit_ratio')
|
||||
|| (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[]="Downloaded='".$Downloaded."'";
|
||||
$EditSummary[]="downloaded changed from ".Format::get_size($Cur['Downloaded'])." to ".Format::get_size($Downloaded);
|
||||
$UpdateSet[] = "Downloaded='".$Downloaded."'";
|
||||
$EditSummary[] = "downloaded changed from ".Format::get_size($Cur['Downloaded'])." to ".Format::get_size($Downloaded);
|
||||
$Cache->delete_value('users_stats_'.$UserID);
|
||||
}
|
||||
|
||||
if ($FLTokens!=$Cur['FLTokens'] && (check_perms('users_edit_ratio') || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[]="FLTokens=".$FLTokens;
|
||||
$EditSummary[]="Freeleech Tokens changed from ".$Cur['FLTokens']." to ".$FLTokens;
|
||||
if ($FLTokens != $Cur['FLTokens'] && (check_perms('users_edit_ratio') || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[] = "FLTokens=".$FLTokens;
|
||||
$EditSummary[] = "Freeleech Tokens changed from ".$Cur['FLTokens']." to ".$FLTokens;
|
||||
$HeavyUpdates['FLTokens'] = $FLTokens;
|
||||
}
|
||||
|
||||
if ($Invites!=$Cur['Invites'] && check_perms('users_edit_invites')) {
|
||||
$UpdateSet[]="invites='$Invites'";
|
||||
$EditSummary[]="number of invites changed to $Invites";
|
||||
if ($Invites != $Cur['Invites'] && check_perms('users_edit_invites')) {
|
||||
$UpdateSet[] = "invites='$Invites'";
|
||||
$EditSummary[] = "number of invites changed to $Invites";
|
||||
$HeavyUpdates['Invites'] = $Invites;
|
||||
}
|
||||
|
||||
if ($Warned == 1 && $Cur['Warned']=='0000-00-00 00:00:00' && check_perms('users_warn')) {
|
||||
if ($Warned == 1 && $Cur['Warned'] == '0000-00-00 00:00:00' && check_perms('users_warn')) {
|
||||
Misc::send_pm($UserID, 0, 'You have received a warning', "You have been [url=https://".SSL_SITE_URL."/wiki.php?action=article&id=218]warned for $WarnLength week(s)[/url] by [user]".$LoggedUser['Username']."[/user]. The reason given was: $WarnReason");
|
||||
$UpdateSet[]="Warned='".sqltime()."' + INTERVAL $WarnLength WEEK";
|
||||
$UpdateSet[] = "Warned='".sqltime()."' + INTERVAL $WarnLength WEEK";
|
||||
$Msg = "warned for $WarnLength week(s)";
|
||||
if ($WarnReason) { $Msg.=" for $WarnReason"; }
|
||||
$EditSummary[]= db_string($Msg);
|
||||
$LightUpdates['Warned']=time_plus(3600*24*7*$WarnLength);
|
||||
if ($WarnReason) {
|
||||
$Msg.=" for $WarnReason";
|
||||
}
|
||||
$EditSummary[] = db_string($Msg);
|
||||
$LightUpdates['Warned'] = time_plus(3600*24*7*$WarnLength);
|
||||
|
||||
} elseif ($Warned == 0 && $Cur['Warned']!='0000-00-00 00:00:00' && check_perms('users_warn')) {
|
||||
$UpdateSet[]="Warned='0000-00-00 00:00:00'";
|
||||
$EditSummary[]="warning removed";
|
||||
$LightUpdates['Warned']='0000-00-00 00:00:00';
|
||||
} elseif ($Warned == 0 && $Cur['Warned'] != '0000-00-00 00:00:00' && check_perms('users_warn')) {
|
||||
$UpdateSet[] = "Warned='0000-00-00 00:00:00'";
|
||||
$EditSummary[] = "warning removed";
|
||||
$LightUpdates['Warned'] = '0000-00-00 00:00:00';
|
||||
|
||||
} elseif ($Warned == 1 && $ExtendWarning!='---' && check_perms('users_warn')) {
|
||||
} elseif ($Warned == 1 && $ExtendWarning != '---' && check_perms('users_warn')) {
|
||||
|
||||
Misc::send_pm($UserID, 0, 'Your warning has been extended', "Your warning has been extended by $ExtendWarning week(s) by [user]".$LoggedUser['Username']."[/user]. The reason given was: $WarnReason");
|
||||
|
||||
$UpdateSet[]="Warned=Warned + INTERVAL $ExtendWarning WEEK";
|
||||
$UpdateSet[] = "Warned=Warned + INTERVAL $ExtendWarning WEEK";
|
||||
$DB->query("SELECT Warned + INTERVAL $ExtendWarning WEEK FROM users_info WHERE UserID='$UserID'");
|
||||
list($WarnedUntil) = $DB->next_record();
|
||||
$Msg = "warning extended by $ExtendWarning week(s) to $WarnedUntil";
|
||||
if ($WarnReason) { $Msg.=" for $WarnReason"; }
|
||||
$EditSummary[]= db_string($Msg);
|
||||
$LightUpdates['Warned']=$WarnedUntil;
|
||||
} elseif ($Warned == 1 && $ExtendWarning=='---' && $ReduceWarning!='---' && check_perms('users_warn')) {
|
||||
if ($WarnReason) {
|
||||
$Msg.=" for $WarnReason";
|
||||
}
|
||||
$EditSummary[] = db_string($Msg);
|
||||
$LightUpdates['Warned'] = $WarnedUntil;
|
||||
} elseif ($Warned == 1 && $ExtendWarning == '---' && $ReduceWarning != '---' && check_perms('users_warn')) {
|
||||
|
||||
Misc::send_pm($UserID, 0, 'Your warning has been reduced', "Your warning has been reduced by $ReduceWarning week(s) by [user]".$LoggedUser['Username']."[/user]. The reason given was: $WarnReason");
|
||||
|
||||
$UpdateSet[]="Warned=Warned - INTERVAL $ReduceWarning WEEK";
|
||||
$UpdateSet[] = "Warned=Warned - INTERVAL $ReduceWarning WEEK";
|
||||
$DB->query("SELECT Warned - INTERVAL $ReduceWarning WEEK FROM users_info WHERE UserID='$UserID'");
|
||||
list($WarnedUntil) = $DB->next_record();
|
||||
$Msg = "warning reduced by $ReduceWarning week(s) to $WarnedUntil";
|
||||
if ($WarnReason) { $Msg.=" for $WarnReason"; }
|
||||
$EditSummary[]= db_string($Msg);
|
||||
$LightUpdates['Warned']=$WarnedUntil;
|
||||
if ($WarnReason) {
|
||||
$Msg.=" for $WarnReason";
|
||||
}
|
||||
$EditSummary[] = db_string($Msg);
|
||||
$LightUpdates['Warned'] = $WarnedUntil;
|
||||
}
|
||||
|
||||
if ($SupportFor!=db_string($Cur['SupportFor']) && (check_perms('admin_manage_fls') || (check_perms('users_mod') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[]="SupportFor='$SupportFor'";
|
||||
$EditSummary[]="first-line support status changed to $SupportFor";
|
||||
if ($SupportFor != db_string($Cur['SupportFor']) && (check_perms('admin_manage_fls') || (check_perms('users_mod') && $UserID == $LoggedUser['ID']))) {
|
||||
$UpdateSet[] = "SupportFor='$SupportFor'";
|
||||
$EditSummary[] = "First-Line Support status changed to $SupportFor";
|
||||
}
|
||||
|
||||
if ($RestrictedForums != db_string($Cur['RestrictedForums']) && check_perms('users_mod')) {
|
||||
$UpdateSet[]="RestrictedForums='$RestrictedForums'";
|
||||
$EditSummary[]="restricted forum(s): $RestrictedForums";
|
||||
$UpdateSet[] = "RestrictedForums='$RestrictedForums'";
|
||||
$EditSummary[] = "restricted forum(s): $RestrictedForums";
|
||||
$DeleteKeys = true;
|
||||
}
|
||||
|
||||
if ($PermittedForums != db_string($Cur['PermittedForums']) && check_perms('users_mod')) {
|
||||
$ForumSet=explode(',',$PermittedForums);
|
||||
$ForumSet = explode(',',$PermittedForums);
|
||||
$ForumList = array();
|
||||
foreach ($ForumSet as $ForumID) {
|
||||
if ($Forums[$ForumID]['MinClassCreate'] <= $LoggedUser['EffectiveClass']) {
|
||||
@ -421,152 +429,151 @@
|
||||
}
|
||||
}
|
||||
$PermittedForums = implode(',',$ForumSet);
|
||||
$UpdateSet[]="PermittedForums='$PermittedForums'";
|
||||
$EditSummary[]="permitted forum(s): $PermittedForums";
|
||||
$UpdateSet[] = "PermittedForums='$PermittedForums'";
|
||||
$EditSummary[] = "permitted forum(s): $PermittedForums";
|
||||
$DeleteKeys = true;
|
||||
}
|
||||
|
||||
if ($DisableAvatar!=$Cur['DisableAvatar'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableAvatar='$DisableAvatar'";
|
||||
$EditSummary[]="avatar status changed";
|
||||
$HeavyUpdates['DisableAvatar']=$DisableAvatar;
|
||||
if ($DisableAvatar != $Cur['DisableAvatar'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableAvatar='$DisableAvatar'";
|
||||
$EditSummary[] = "avatar status changed";
|
||||
$HeavyUpdates['DisableAvatar'] = $DisableAvatar;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your avatar privileges have been disabled', "Your avatar privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableLeech!=$Cur['can_leech'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="can_leech='$DisableLeech'";
|
||||
$EditSummary[]="leeching status changed (".translateLeechStatus($Cur['can_leech'])." -> ".translateLeechStatus($DisableLeech).")";
|
||||
$HeavyUpdates['DisableLeech']=$DisableLeech;
|
||||
$HeavyUpdates['CanLeech']=$DisableLeech;
|
||||
if ($DisableLeech != $Cur['can_leech'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "can_leech='$DisableLeech'";
|
||||
$EditSummary[] = "leeching status changed (".translateLeechStatus($Cur['can_leech'])." -> ".translateLeechStatus($DisableLeech).")";
|
||||
$HeavyUpdates['DisableLeech'] = $DisableLeech;
|
||||
$HeavyUpdates['CanLeech'] = $DisableLeech;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your leeching privileges have been disabled', "Your leeching privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
Tracker::update_tracker('update_user', array('passkey' => $Cur['torrent_pass'], 'can_leech' => $DisableLeech));
|
||||
}
|
||||
|
||||
if ($DisableInvites!=$Cur['DisableInvites'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableInvites='$DisableInvites'";
|
||||
if ($DisableInvites != $Cur['DisableInvites'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableInvites='$DisableInvites'";
|
||||
if ($DisableInvites == 1) {
|
||||
//$UpdateSet[]="Invites='0'";
|
||||
//$UpdateSet[] = "Invites='0'";
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your invite privileges have been disabled', "Your invite privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
$EditSummary[]="invites status changed";
|
||||
$HeavyUpdates['DisableInvites']=$DisableInvites;
|
||||
$EditSummary[] = "invites status changed";
|
||||
$HeavyUpdates['DisableInvites'] = $DisableInvites;
|
||||
}
|
||||
|
||||
if ($DisablePosting!=$Cur['DisablePosting'] && check_perms('users_disable_posts')) {
|
||||
$UpdateSet[]="DisablePosting='$DisablePosting'";
|
||||
$EditSummary[]="posting status changed";
|
||||
$HeavyUpdates['DisablePosting']=$DisablePosting;
|
||||
if ($DisablePosting != $Cur['DisablePosting'] && check_perms('users_disable_posts')) {
|
||||
$UpdateSet[] = "DisablePosting='$DisablePosting'";
|
||||
$EditSummary[] = "posting status changed";
|
||||
$HeavyUpdates['DisablePosting'] = $DisablePosting;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your forum posting privileges have been disabled', "Your forum posting privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableForums!=$Cur['DisableForums'] && check_perms('users_disable_posts')) {
|
||||
$UpdateSet[]="DisableForums='$DisableForums'";
|
||||
$EditSummary[]="forums status changed";
|
||||
$HeavyUpdates['DisableForums']=$DisableForums;
|
||||
if ($DisableForums != $Cur['DisableForums'] && check_perms('users_disable_posts')) {
|
||||
$UpdateSet[] = "DisableForums='$DisableForums'";
|
||||
$EditSummary[] = "forums status changed";
|
||||
$HeavyUpdates['DisableForums'] = $DisableForums;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your forum privileges have been disabled', "Your forum privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableTagging!=$Cur['DisableTagging'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableTagging='$DisableTagging'";
|
||||
$EditSummary[]="tagging status changed";
|
||||
$HeavyUpdates['DisableTagging']=$DisableTagging;
|
||||
if ($DisableTagging != $Cur['DisableTagging'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableTagging='$DisableTagging'";
|
||||
$EditSummary[] = "tagging status changed";
|
||||
$HeavyUpdates['DisableTagging'] = $DisableTagging;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your tagging privileges have been disabled', "Your tagging privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableUpload!=$Cur['DisableUpload'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableUpload='$DisableUpload'";
|
||||
$EditSummary[]="upload status changed";
|
||||
$HeavyUpdates['DisableUpload']=$DisableUpload;
|
||||
if ($DisableUpload != $Cur['DisableUpload'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableUpload='$DisableUpload'";
|
||||
$EditSummary[] = "upload status changed";
|
||||
$HeavyUpdates['DisableUpload'] = $DisableUpload;
|
||||
if ($DisableUpload == 1) {
|
||||
Misc::send_pm($UserID, 0, 'Your upload privileges have been disabled', "Your upload privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableWiki!=$Cur['DisableWiki'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableWiki='$DisableWiki'";
|
||||
$EditSummary[]="wiki status changed";
|
||||
$HeavyUpdates['DisableWiki']=$DisableWiki;
|
||||
$HeavyUpdates['site_edit_wiki']=0;
|
||||
if ($DisableWiki != $Cur['DisableWiki'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableWiki='$DisableWiki'";
|
||||
$EditSummary[] = "wiki status changed";
|
||||
$HeavyUpdates['DisableWiki'] = $DisableWiki;
|
||||
$HeavyUpdates['site_edit_wiki'] = 0;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your site editing privileges have been disabled', "Your site editing privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($DisablePM!=$Cur['DisablePM'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisablePM='$DisablePM'";
|
||||
$EditSummary[]="PM status changed";
|
||||
$HeavyUpdates['DisablePM']=$DisablePM;
|
||||
if ($DisablePM != $Cur['DisablePM'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisablePM='$DisablePM'";
|
||||
$EditSummary[] = "PM status changed";
|
||||
$HeavyUpdates['DisablePM'] = $DisablePM;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your PM privileges have been disabled', "Your PM privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url].");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableIRC!=$Cur['DisableIRC'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableIRC='$DisableIRC'";
|
||||
$EditSummary[]="IRC status changed";
|
||||
$HeavyUpdates['DisableIRC']=$DisableIRC;
|
||||
if ($DisableIRC != $Cur['DisableIRC'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableIRC='$DisableIRC'";
|
||||
$EditSummary[] = "IRC status changed";
|
||||
$HeavyUpdates['DisableIRC'] = $DisableIRC;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your IRC privileges have been disabled', "Your IRC privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in #what.cd-disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
if ($DisableRequests!=$Cur['DisableRequests'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="DisableRequests='$DisableRequests'";
|
||||
$EditSummary[]="request status changed";
|
||||
$HeavyUpdates['DisableRequests']=$DisableRequests;
|
||||
if ($DisableRequests != $Cur['DisableRequests'] && check_perms('users_disable_any')) {
|
||||
$UpdateSet[] = "DisableRequests='$DisableRequests'";
|
||||
$EditSummary[] = "request status changed";
|
||||
$HeavyUpdates['DisableRequests'] = $DisableRequests;
|
||||
if (!empty($UserReason)) {
|
||||
Misc::send_pm($UserID, 0, 'Your request privileges have been disabled', "Your request privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in #what.cd-disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($EnableUser!=$Cur['Enabled'] && check_perms('users_disable_users')) {
|
||||
if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
|
||||
$EnableStr = 'account '.translateUserStatus($Cur['Enabled']).'->'.translateUserStatus($EnableUser);
|
||||
if($EnableUser == '2') {
|
||||
if ($EnableUser == '2') {
|
||||
Tools::disable_users($UserID, '', 1);
|
||||
} elseif($EnableUser == '1') {
|
||||
} elseif ($EnableUser == '1') {
|
||||
$Cache->increment('stats_user_count');
|
||||
Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass']));
|
||||
if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded']/$Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
|
||||
$UpdateSet[]="i.RatioWatchEnds='0000-00-00 00:00:00'";
|
||||
$UpdateSet[] = "i.RatioWatchEnds='0000-00-00 00:00:00'";
|
||||
$CanLeech = 1;
|
||||
$UpdateSet[]="m.can_leech='1'";
|
||||
$UpdateSet[]="i.RatioWatchDownload='0'";
|
||||
$UpdateSet[] = "m.can_leech='1'";
|
||||
$UpdateSet[] = "i.RatioWatchDownload='0'";
|
||||
} else {
|
||||
$EnableStr .= ' (Ratio: '.Format::get_ratio_html($Cur['Uploaded'], $Cur['Downloaded'], false).', RR: '.number_format($Cur['RequiredRatio'],2).')';
|
||||
if ($Cur['RatioWatchEnds'] != '0000-00-00 00:00:00') {
|
||||
$UpdateSet[]="i.RatioWatchEnds=NOW()";
|
||||
$UpdateSet[]="i.RatioWatchDownload=m.Downloaded";
|
||||
$UpdateSet[] = "i.RatioWatchEnds=NOW()";
|
||||
$UpdateSet[] = "i.RatioWatchDownload=m.Downloaded";
|
||||
$CanLeech = 0;
|
||||
}
|
||||
Tracker::update_tracker('update_user', array('passkey' => $Cur['torrent_pass'], 'can_leech' => '0'));
|
||||
}
|
||||
$UpdateSet[]="Enabled='1'";
|
||||
$UpdateSet[] = "Enabled='1'";
|
||||
$LightUpdates['Enabled'] = 1;
|
||||
}
|
||||
$EditSummary[]=$EnableStr;
|
||||
$EditSummary[] = $EnableStr;
|
||||
$Cache->replace_value('enabled_'.$UserID, $EnableUser, 0);
|
||||
}
|
||||
|
||||
if ($ResetPasskey == 1 && check_perms('users_edit_reset_keys')) {
|
||||
$Passkey = db_string(Users::make_secret());
|
||||
$UpdateSet[]="torrent_pass='$Passkey'";
|
||||
$EditSummary[]="passkey reset";
|
||||
$HeavyUpdates['torrent_pass']=$Passkey;
|
||||
$UpdateSet[] = "torrent_pass='$Passkey'";
|
||||
$EditSummary[] = "passkey reset";
|
||||
$HeavyUpdates['torrent_pass'] = $Passkey;
|
||||
$Cache->delete_value('user_'.$Cur['torrent_pass']);
|
||||
//MUST come after the case for updating can_leech.
|
||||
|
||||
@ -578,13 +585,13 @@
|
||||
|
||||
if ($ResetAuthkey == 1 && check_perms('users_edit_reset_keys')) {
|
||||
$Authkey = db_string(Users::make_secret());
|
||||
$UpdateSet[]="AuthKey='$Authkey'";
|
||||
$EditSummary[]="authkey reset";
|
||||
$HeavyUpdates['AuthKey']=$Authkey;
|
||||
$UpdateSet[] = "AuthKey='$Authkey'";
|
||||
$EditSummary[] = "authkey reset";
|
||||
$HeavyUpdates['AuthKey'] = $Authkey;
|
||||
}
|
||||
|
||||
if ($SendHackedMail && check_perms('users_disable_any')) {
|
||||
$EditSummary[]="hacked email sent to ".$HackedEmail;
|
||||
$EditSummary[] = "hacked email sent to ".$HackedEmail;
|
||||
Misc::send_email($HackedEmail, "Your ".SITE_NAME." account.","Your ".SITE_NAME." account appears to have been compromised. As a security measure we have disabled your account. To resolve this please visit us on IRC.
|
||||
|
||||
This is the information to connect to our server:
|
||||
@ -602,17 +609,17 @@
|
||||
if ($DB->record_count() > 0) {
|
||||
list($MergeID, $MergeUploaded, $MergeDownloaded) = $DB->next_record();
|
||||
$DB->query("UPDATE users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID SET um.Uploaded = 0, um.Downloaded = 0, ui.AdminComment = CONCAT('".sqltime()." - Stats merged into https://".SSL_SITE_URL."/user.php?id=".$UserID." (".$Cur['Username'].") by ".$LoggedUser['Username']."\n\n', ui.AdminComment) WHERE ID = ".$MergeID);
|
||||
$UpdateSet[]="Uploaded = Uploaded + '$MergeUploaded'";
|
||||
$UpdateSet[]="Downloaded = Downloaded + '$MergeDownloaded'";
|
||||
$EditSummary[]="stats merged from https://".SSL_SITE_URL."/user.php?id=".$MergeID." (".$MergeStatsFrom.")";
|
||||
$UpdateSet[] = "Uploaded = Uploaded + '$MergeUploaded'";
|
||||
$UpdateSet[] = "Downloaded = Downloaded + '$MergeDownloaded'";
|
||||
$EditSummary[] = "stats merged from https://".SSL_SITE_URL."/user.php?id=".$MergeID." (".$MergeStatsFrom.")";
|
||||
$Cache->delete_value('users_stats_'.$UserID);
|
||||
$Cache->delete_value('users_stats_'.$MergeID);
|
||||
}
|
||||
}
|
||||
|
||||
if ($Pass && check_perms('users_edit_password')) {
|
||||
$UpdateSet[]="PassHash='".db_string(Users::make_crypt_hash($Pass))."'";
|
||||
$EditSummary[]='password reset';
|
||||
$UpdateSet[] = "PassHash='".db_string(Users::make_crypt_hash($Pass))."'";
|
||||
$EditSummary[] = 'password reset';
|
||||
|
||||
$Cache->delete_value('user_info_'.$UserID);
|
||||
$Cache->delete_value('user_info_heavy_'.$UserID);
|
||||
@ -631,15 +638,15 @@
|
||||
}
|
||||
|
||||
if (empty($UpdateSet) && empty($EditSummary)) {
|
||||
if(!$Reason) {
|
||||
if (!$Reason) {
|
||||
if (str_replace("\r", '', $Cur['AdminComment']) != str_replace("\r", '', $AdminComment) && check_perms('users_disable_any')) {
|
||||
$UpdateSet[]="AdminComment='$AdminComment'";
|
||||
$UpdateSet[] = "AdminComment='$AdminComment'";
|
||||
} else {
|
||||
header("Location: user.php?id=$UserID");
|
||||
die();
|
||||
}
|
||||
} else {
|
||||
$EditSummary[]='notes added';
|
||||
$EditSummary[] = 'notes added';
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,17 +676,17 @@
|
||||
|
||||
|
||||
$Summary .= "\n\n".$AdminComment;
|
||||
} elseif (empty($UpdateSet) && empty($EditSummary) && $Cur['AdminComment']==$_POST['AdminComment']) {
|
||||
} elseif (empty($UpdateSet) && empty($EditSummary) && $Cur['AdminComment'] == $_POST['AdminComment']) {
|
||||
$Summary = sqltime().' - '.'Comment added by '.$LoggedUser['Username'].': '.$Reason."\n\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!empty($Summary)) {
|
||||
$UpdateSet[]="AdminComment='$Summary'";
|
||||
if (!empty($Summary)) {
|
||||
$UpdateSet[] = "AdminComment='$Summary'";
|
||||
} else {
|
||||
$UpdateSet[]="AdminComment='$AdminComment'";
|
||||
$UpdateSet[] = "AdminComment='$AdminComment'";
|
||||
}
|
||||
|
||||
// Update cache
|
||||
@ -695,7 +702,7 @@
|
||||
//die($sql);
|
||||
$DB->query($sql);
|
||||
|
||||
if(isset($ClearStaffIDCache)) {
|
||||
if (isset($ClearStaffIDCache)) {
|
||||
$Cache->delete_value('staff_ids');
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
error(404);
|
||||
|
||||
$UserID = $_GET['id'];
|
||||
if($UserID == $LoggedUser['ID']) {
|
||||
if ($UserID == $LoggedUser['ID']) {
|
||||
$OwnProfile = true;
|
||||
} else {
|
||||
$OwnProfile = false;
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
|
||||
if(check_perms('users_mod')) { // Person viewing is a staff member
|
||||
if (check_perms('users_mod')) { // Person viewing is a staff member
|
||||
$DB->query("SELECT
|
||||
m.Username,
|
||||
m.Email,
|
||||
@ -118,20 +118,20 @@
|
||||
|
||||
// Image proxy CTs
|
||||
$DisplayCustomTitle = $CustomTitle;
|
||||
if(check_perms('site_proxy_images') && !empty($CustomTitle)) {
|
||||
if (check_perms('site_proxy_images') && !empty($CustomTitle)) {
|
||||
$DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
|
||||
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Matches[2]).$Matches[3];
|
||||
}, $CustomTitle);
|
||||
}
|
||||
|
||||
$Paranoia = unserialize($Paranoia);
|
||||
if(!is_array($Paranoia)) {
|
||||
if (!is_array($Paranoia)) {
|
||||
$Paranoia = array();
|
||||
}
|
||||
$ParanoiaLevel = 0;
|
||||
foreach($Paranoia as $P) {
|
||||
foreach ($Paranoia as $P) {
|
||||
$ParanoiaLevel++;
|
||||
if(strpos($P, '+')) {
|
||||
if (strpos($P, '+')) {
|
||||
$ParanoiaLevel++;
|
||||
}
|
||||
}
|
||||
@ -159,16 +159,16 @@ function check_paranoia_here($Setting) {
|
||||
<? if (!$OwnProfile) { ?>
|
||||
<a href="inbox.php?action=compose&to=<?=$UserID?>" class="brackets">Send message</a>
|
||||
|
||||
<? if(check_perms("users_mod")) {
|
||||
<? if (check_perms("users_mod")) {
|
||||
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$UserID'");
|
||||
if($DB->record_count() > 0) { ?>
|
||||
if ($DB->record_count() > 0) { ?>
|
||||
<a
|
||||
href="user.php?action=take_push&push=1&userid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets"
|
||||
>Push user</a>
|
||||
<? }
|
||||
}
|
||||
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
|
||||
if($DB->record_count() == 0) { ?>
|
||||
if ($DB->record_count() == 0) { ?>
|
||||
<a href="friends.php?action=add&friendid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Add to friends</a>
|
||||
<? }?>
|
||||
<a href="reports.php?action=report&type=user&id=<?=$UserID?>" class="brackets">Report user</a>
|
||||
@ -209,7 +209,7 @@ function check_paranoia_here($Setting) {
|
||||
<div class="sidebar">
|
||||
<?
|
||||
if ($Avatar && Users::has_avatars_enabled()) {
|
||||
if(check_perms('site_proxy_images') && !empty($Avatar)) {
|
||||
if (check_perms('site_proxy_images') && !empty($Avatar)) {
|
||||
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&avatar='.$UserID.'&i='.urlencode($Avatar);
|
||||
}
|
||||
?>
|
||||
@ -265,7 +265,7 @@ function check_paranoia_here($Setting) {
|
||||
$RequestsVoted = $TotalSpent = 0;
|
||||
}
|
||||
|
||||
if(check_paranoia_here('uploads+')) {
|
||||
if (check_paranoia_here('uploads+')) {
|
||||
$DB->query("SELECT COUNT(ID) FROM torrents WHERE UserID='$UserID'");
|
||||
list($Uploads) = $DB->next_record();
|
||||
} else {
|
||||
@ -290,9 +290,9 @@ function check_paranoia_here($Setting) {
|
||||
$BountyRank = $Rank->get_rank('bounty', $TotalSpent);
|
||||
$ArtistsRank = $Rank->get_rank('artists', $ArtistsAdded);
|
||||
|
||||
if($Downloaded == 0) {
|
||||
if ($Downloaded == 0) {
|
||||
$Ratio = 1;
|
||||
} elseif($Uploaded == 0) {
|
||||
} elseif ($Uploaded == 0) {
|
||||
$Ratio = 0.5;
|
||||
} else {
|
||||
$Ratio = round($Uploaded/$Downloaded, 2);
|
||||
@ -388,7 +388,7 @@ function check_paranoia_here($Setting) {
|
||||
<li>
|
||||
<ul class="stats">
|
||||
<?
|
||||
foreach($UserInfo['ExtraClasses'] as $PermID => $Val) { ?>
|
||||
foreach ($UserInfo['ExtraClasses'] as $PermID => $Val) { ?>
|
||||
<li><?=$Classes[$PermID]['Name']?></li>
|
||||
<? }
|
||||
?>
|
||||
@ -397,13 +397,13 @@ function check_paranoia_here($Setting) {
|
||||
<?
|
||||
}
|
||||
// An easy way for people to measure the paranoia of a user, for e.g. contest eligibility
|
||||
if($ParanoiaLevel == 0) {
|
||||
if ($ParanoiaLevel == 0) {
|
||||
$ParanoiaLevelText = 'Off';
|
||||
} elseif($ParanoiaLevel == 1) {
|
||||
} elseif ($ParanoiaLevel == 1) {
|
||||
$ParanoiaLevelText = 'Very Low';
|
||||
} elseif($ParanoiaLevel <= 5) {
|
||||
} elseif ($ParanoiaLevel <= 5) {
|
||||
$ParanoiaLevelText = 'Low';
|
||||
} elseif($ParanoiaLevel <= 20) {
|
||||
} elseif ($ParanoiaLevel <= 20) {
|
||||
$ParanoiaLevelText = 'High';
|
||||
} else {
|
||||
$ParanoiaLevelText = 'Very high';
|
||||
@ -441,7 +441,7 @@ function check_paranoia_here($Setting) {
|
||||
<li>Invites: <?
|
||||
$DB->query("SELECT count(InviterID) FROM invites WHERE InviterID = '$UserID'");
|
||||
list($Pending) = $DB->next_record();
|
||||
if($DisableInvites) {
|
||||
if ($DisableInvites) {
|
||||
echo 'X';
|
||||
} else {
|
||||
echo number_format($Invites);
|
||||
@ -503,7 +503,7 @@ function check_paranoia_here($Setting) {
|
||||
<?
|
||||
if ($Snatched > 4 && check_paranoia_here('snatched')) {
|
||||
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
|
||||
if(!is_array($RecentSnatches)){
|
||||
if (!is_array($RecentSnatches)) {
|
||||
$DB->query("SELECT
|
||||
g.ID,
|
||||
g.Name,
|
||||
@ -520,7 +520,7 @@ function check_paranoia_here($Setting) {
|
||||
$RecentSnatches = $DB->to_array();
|
||||
|
||||
$Artists = Artists::get_artists($DB->collect('ID'));
|
||||
foreach($RecentSnatches as $Key => $SnatchInfo) {
|
||||
foreach ($RecentSnatches as $Key => $SnatchInfo) {
|
||||
$RecentSnatches[$Key]['Artist'] = Artists::display_artists($Artists[$SnatchInfo['ID']], false, true);
|
||||
}
|
||||
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0); //inf cache
|
||||
@ -532,7 +532,7 @@ function check_paranoia_here($Setting) {
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
foreach($RecentSnatches as $RS) { ?>
|
||||
foreach ($RecentSnatches as $RS) { ?>
|
||||
<td>
|
||||
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=ImageTools::thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
|
||||
</td>
|
||||
@ -542,10 +542,12 @@ function check_paranoia_here($Setting) {
|
||||
<?
|
||||
}
|
||||
|
||||
if(!isset($Uploads)) { $Uploads = 0; }
|
||||
if (!isset($Uploads)) {
|
||||
$Uploads = 0;
|
||||
}
|
||||
if ($Uploads > 4 && check_paranoia_here('uploads')) {
|
||||
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
|
||||
if(!is_array($RecentUploads)){
|
||||
if (!is_array($RecentUploads)) {
|
||||
$DB->query("SELECT
|
||||
g.ID,
|
||||
g.Name,
|
||||
@ -560,7 +562,7 @@ function check_paranoia_here($Setting) {
|
||||
LIMIT 5");
|
||||
$RecentUploads = $DB->to_array();
|
||||
$Artists = Artists::get_artists($DB->collect('ID'));
|
||||
foreach($RecentUploads as $Key => $UploadInfo) {
|
||||
foreach ($RecentUploads as $Key => $UploadInfo) {
|
||||
$RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
|
||||
}
|
||||
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0); //inf cache
|
||||
@ -571,7 +573,7 @@ function check_paranoia_here($Setting) {
|
||||
<td colspan="5">Recent uploads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<? foreach($RecentUploads as $RU) { ?>
|
||||
<? foreach ($RecentUploads as $RU) { ?>
|
||||
<td>
|
||||
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=ImageTools::thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
|
||||
</td>
|
||||
@ -607,7 +609,7 @@ function check_paranoia_here($Setting) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="images<?=$FirstCol ? '' : ' hidden'?>">
|
||||
<? foreach($Collage as $C) {
|
||||
<? foreach ($Collage as $C) {
|
||||
$Group = Torrents::get_groups(array($C['GroupID']));
|
||||
$Group = array_pop($Group['matches']);
|
||||
extract(Torrents::array_group($Group));
|
||||
@ -630,7 +632,7 @@ function check_paranoia_here($Setting) {
|
||||
|
||||
|
||||
// Linked accounts
|
||||
if(check_perms('users_mod')) {
|
||||
if (check_perms('users_mod')) {
|
||||
include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
|
||||
user_dupes_table($UserID);
|
||||
}
|
||||
@ -666,7 +668,7 @@ function check_paranoia_here($Setting) {
|
||||
GROUP BY r.ID
|
||||
ORDER BY Votes DESC");
|
||||
|
||||
if($DB->record_count() > 0) {
|
||||
if ($DB->record_count() > 0) {
|
||||
$Requests = $DB->to_array();
|
||||
?>
|
||||
<div class="box">
|
||||
@ -688,12 +690,12 @@ function check_paranoia_here($Setting) {
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach($Requests as $Request) {
|
||||
foreach ($Requests as $Request) {
|
||||
list($RequestID, $CategoryID, $Title, $Year, $TimeAdded, $Votes, $Bounty) = $Request;
|
||||
|
||||
$Request = Requests::get_requests(array($RequestID));
|
||||
$Request = $Request['matches'][$RequestID];
|
||||
if(empty($Request)) {
|
||||
if (empty($Request)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -702,11 +704,11 @@ function check_paranoia_here($Setting) {
|
||||
|
||||
$CategoryName = $Categories[$CategoryID - 1];
|
||||
|
||||
if($CategoryName == "Music") {
|
||||
if ($CategoryName == "Music") {
|
||||
$ArtistForm = get_request_artists($RequestID);
|
||||
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
||||
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||
} else if ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||
} else {
|
||||
$FullName ="<a href='requests.php?action=view&id=".$RequestID."'>".$Title."</a>";
|
||||
@ -716,22 +718,22 @@ function check_paranoia_here($Setting) {
|
||||
?>
|
||||
<tr class="row<?=$Row?>">
|
||||
<td>
|
||||
<?=$FullName?>
|
||||
<?=$FullName ?>
|
||||
<div class="tags">
|
||||
<?
|
||||
$Tags = $Request['Tags'];
|
||||
$TagList = array();
|
||||
foreach($Tags as $TagID => $TagName) {
|
||||
foreach ($Tags as $TagID => $TagName) {
|
||||
$TagList[] = "<a href='requests.php?tags=".$TagName."'>".display_str($TagName)."</a>";
|
||||
}
|
||||
$TagList = implode(', ', $TagList);
|
||||
?>
|
||||
<?=$TagList?>
|
||||
<?=$TagList ?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>
|
||||
<? if(check_perms('site_vote')){ ?>
|
||||
<? if (check_perms('site_vote')) { ?>
|
||||
<a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets">+</a>
|
||||
<? } ?>
|
||||
</td>
|
||||
@ -739,7 +741,7 @@ function check_paranoia_here($Setting) {
|
||||
<span id="bounty_<?=$RequestID?>"><?=Format::get_size($Bounty)?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?=time_diff($TimeAdded)?>
|
||||
<?=time_diff($TimeAdded) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
@ -777,14 +779,16 @@ function check_paranoia_here($Setting) {
|
||||
<td>Assigned to</td>
|
||||
<td>Resolved by</td>
|
||||
</tr>
|
||||
<? foreach($StaffPMs as $StaffPM) {
|
||||
<? foreach ($StaffPMs as $StaffPM) {
|
||||
list($ID, $Subject, $Status, $Level, $AssignedTo, $Date, $ResolverID) = $StaffPM;
|
||||
// Get assigned
|
||||
if ($AssignedToUser == '') {
|
||||
// Assigned to class
|
||||
$Assigned = ($Level == 0) ? "First Line Support" : $ClassLevels[$Level]['Name'];
|
||||
// No + on Sysops
|
||||
if ($Assigned != 'Sysop') { $Assigned .= "+"; }
|
||||
if ($Assigned != 'Sysop') {
|
||||
$Assigned .= "+";
|
||||
}
|
||||
|
||||
} else {
|
||||
// Assigned to user
|
||||
@ -814,10 +818,10 @@ function check_paranoia_here($Setting) {
|
||||
<?
|
||||
|
||||
// Displays a table of forum warnings viewable only to Forum Moderators
|
||||
if($LoggedUser['Class'] == 650 && check_perms('users_warn', $Class)) {
|
||||
if ($LoggedUser['Class'] == 650 && check_perms('users_warn', $Class)) {
|
||||
$DB->query("SELECT Comment FROM users_warnings_forums WHERE UserID = '$UserID'");
|
||||
list($ForumWarnings) = $DB->next_record();
|
||||
if($DB->record_count() > 0) {
|
||||
if ($DB->record_count() > 0) {
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="head">Forum warnings</div>
|
||||
@ -879,10 +883,20 @@ function check_paranoia_here($Setting) {
|
||||
<select name="Class">
|
||||
<?
|
||||
foreach ($ClassLevels as $CurClass) {
|
||||
if (check_perms('users_promote_below', $Class) && $CurClass['ID']>=$LoggedUser['EffectiveClass']) { break; }
|
||||
if ($CurClass['ID']>$LoggedUser['EffectiveClass']) { break; }
|
||||
if ($CurClass['Secondary']) { continue; }
|
||||
if ($Class===$CurClass['Level']) { $Selected=' selected="selected"'; } else { $Selected=""; }
|
||||
if (check_perms('users_promote_below', $Class) && $CurClass['ID'] >= $LoggedUser['EffectiveClass']) {
|
||||
break;
|
||||
}
|
||||
if ($CurClass['ID'] > $LoggedUser['EffectiveClass']) {
|
||||
break;
|
||||
}
|
||||
if ($CurClass['Secondary']) {
|
||||
continue;
|
||||
}
|
||||
if ($Class === $CurClass['Level']) {
|
||||
$Selected = ' selected="selected"';
|
||||
} else {
|
||||
$Selected = '';
|
||||
}
|
||||
?>
|
||||
<option value="<?=$CurClass['ID']?>"<?=$Selected?>><?=$CurClass['Name'].' ('.$CurClass['Level'].')'?></option>
|
||||
<? } ?>
|
||||
@ -915,7 +929,9 @@ function check_paranoia_here($Setting) {
|
||||
$i++;
|
||||
?>
|
||||
<input type="checkbox" id="perm_<?=$PermID?>" name="secondary_classes[]" value="<?=$PermID?>"<? if ($IsSet) { ?> checked="checked"<? } ?> /> <label for="perm_<?=$PermID?>" style="margin-right: 10px;"><?=$PermName?></label>
|
||||
<? if ($i % 5 == 0) { echo '<br />'; }
|
||||
<? if ($i % 5 == 0) {
|
||||
echo '<br />';
|
||||
}
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1109,7 +1125,7 @@ function check_paranoia_here($Setting) {
|
||||
<input type="checkbox" name="SendHackedMail" id="SendHackedMail" /> <label for="SendHackedMail">Send hacked account email</label> to
|
||||
<select name="HackedEmail">
|
||||
<?
|
||||
foreach($Emails as $Email) {
|
||||
foreach ($Emails as $Email) {
|
||||
list($Address, $IP) = $Email;
|
||||
?>
|
||||
<option value="<?=display_str($Address)?>"><?=display_str($Address)?> - <?=display_str($IP)?></option>
|
||||
@ -1159,7 +1175,7 @@ function check_paranoia_here($Setting) {
|
||||
|
||||
<? } ?>
|
||||
</table><br />
|
||||
<? if(check_perms('users_logout')) { ?>
|
||||
<? if (check_perms('users_logout')) { ?>
|
||||
<table class="layout">
|
||||
<tr class="colhead"><td colspan="2">Session</td></tr>
|
||||
<tr>
|
||||
|
@ -2,17 +2,17 @@
|
||||
// perform the back end of subscribing to collages
|
||||
authorize();
|
||||
|
||||
if(!is_number($_GET['collageid'])) {
|
||||
if (!is_number($_GET['collageid'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if(!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
|
||||
if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
|
||||
$DB->query('SELECT CollageID FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
}
|
||||
|
||||
if(($Key = array_search($_GET['collageid'],$UserSubscriptions)) !== FALSE) {
|
||||
if (($Key = array_search($_GET['collageid'],$UserSubscriptions)) !== false) {
|
||||
$DB->query('DELETE FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']).' AND CollageID = '.db_string($_GET['collageid']));
|
||||
unset($UserSubscriptions[$Key]);
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||
|
||||
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === FALSE) {
|
||||
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === false) {
|
||||
$DB->query("SELECT
|
||||
m.Username,
|
||||
m.Enabled,
|
||||
@ -202,7 +202,7 @@
|
||||
<div class="linkbox">
|
||||
<?
|
||||
if($ViewingOwn) {
|
||||
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) {
|
||||
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
|
@ -2,28 +2,28 @@
|
||||
// perform the back end of subscribing to topics
|
||||
authorize();
|
||||
|
||||
if(!empty($LoggedUser['DisableForums'])) {
|
||||
if (!empty($LoggedUser['DisableForums'])) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if(!is_number($_GET['topicid'])) {
|
||||
if (!is_number($_GET['topicid'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
require(SERVER_ROOT.'/sections/forums/index.php');
|
||||
$DB->query('SELECT ID FROM forums WHERE forums.ID = (SELECT ForumID FROM forums_topics WHERE ID = '.db_string($_GET['topicid']).')');
|
||||
list($ForumID) = $DB->next_record();
|
||||
if(!check_forumperm($ForumID)) {
|
||||
if (!check_forumperm($ForumID)) {
|
||||
die();
|
||||
}
|
||||
|
||||
if(!$UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) {
|
||||
if (!$UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) {
|
||||
$DB->query('SELECT TopicID FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
}
|
||||
|
||||
if(($Key = array_search($_GET['topicid'],$UserSubscriptions)) !== FALSE) {
|
||||
if (($Key = array_search($_GET['topicid'],$UserSubscriptions)) !== false) {
|
||||
$DB->query('DELETE FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']).' AND TopicID = '.db_string($_GET['topicid']));
|
||||
unset($UserSubscriptions[$Key]);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user