sync: 2022-12-17 12:23:37 +0000

This commit is contained in:
mosasauroidea-bot
2022-12-17 12:23:37 +00:00
parent 397bd7a904
commit a9a23196a3
191 changed files with 3080 additions and 3120 deletions
+2 -1
View File
@@ -19,5 +19,6 @@
"editor.wordWrapColumn": 120
},
"intelephense.format.braces": "k&r",
"formatFiles.excludedFolders": ["node_modules", ".vscode", ".git", "dist", ".chrome", "vendor"]
"formatFiles.excludedFolders": ["node_modules", ".vscode", ".git", "dist", ".chrome", "vendor"],
"editor.detectIndentation": false
}
+1
View File
@@ -35,6 +35,7 @@
- 多语言(英语,中文等)
- mdx/yaml 文件格式
- 使用云服务(Crowdin)进行翻译
- 支持双语内容
- 图床:本地或者 [Minio](https://github.com/minio/minio)
- 邮件发送:SMTP 或者 [Mailgun](https://www.mailgun.com/)
- 在免费和中性基础上,额外增加 25%,50%,75% 种子免费
+1
View File
@@ -35,6 +35,7 @@ GazellePW (GazellePosterWall) is a web framework geared towards private BitTorre
- Multiple Languages (English, Chinese etc)
- mdx/yaml file format
- Use service (Crowdin) to translate
- Support bilingual content
- Image host: Local or [Minio](https://github.com/minio/minio)
- Mail delivery type: SMTP or [Mailgun](https://www.mailgun.com/)
- Additional torrents off: 25%, 50%, 75%
+2 -2
View File
@@ -10,7 +10,7 @@ class Torrent extends AbstractAPI {
case 'torrent':
return $this->getTorrent();
default:
return $this->getTorrent();
return $this->getTorrent();
}
}
@@ -97,7 +97,7 @@ class Torrent extends AbstractAPI {
} else {
json_error('Missing group id and imdbid');
}
if (!$this->db->has_results()) {
json_error('Group not found');
}
-1
View File
@@ -9,7 +9,6 @@ ini_set('max_file_uploads', 100);
define('MAX_FILENAME_LENGTH', 255);
class Upload extends AbstractAPI {
public function run() {
return $this->uploadTorrent();
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle;
abstract class BaseObject extends Base {
protected $id;
/* used for handling updates */
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle;
class DB extends Base {
/**
* Skip foreign key checks
* @param $relax true if foreign key checks should be skipped
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle;
abstract class File extends Base {
/**
* Store a file on disk at the specified path.
*
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class Artist extends \Gazelle\Base {
public function createArtist($name) {
$this->db->prepared_query(
'
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class Blog extends \Gazelle\Base {
const CACHE_KEY = 'blogv2';
public function flushCache() {
-2
View File
@@ -25,8 +25,6 @@ class DonationCurrency {
const BTC = "BTC";
}
class Donation extends \Gazelle\Base {
private static $ForumDescriptions = array(
"I want only two houses, rather than seven... I feel like letting go of things",
"A billion here, a billion there, sooner or later it adds up to real money.",
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class IP extends \Gazelle\Base {
const CACHE_KEY = 'ip_bans_';
/**
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class Invite extends \Gazelle\Base {
protected $search;
/**
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class News extends \Gazelle\Base {
const CACHE_KEY = 'newsv2';
/**
-1
View File
@@ -5,7 +5,6 @@ namespace Gazelle\Manager;
use \Gazelle\Exception\PaymentFetchForexException;
class Payment extends \Gazelle\Base {
const LIST_KEY = 'payment_list';
const RENT_KEY = 'payment_monthly_rental';
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Manager;
class Privilege extends \Gazelle\Base {
protected $classList;
protected $privilege;
-1
View File
@@ -8,7 +8,6 @@ namespace Gazelle\Manager;
*/
class Thread extends \Gazelle\Base {
/**
*/
public function createThread($type) {
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle;
class Recovery {
static function email_check($raw) {
$raw = strtolower(trim($raw));
$parts = explode('@', $raw);
-1
View File
@@ -5,7 +5,6 @@ namespace Gazelle;
use \Gazelle\Util\Crypto;
class Session extends Base {
private $id;
public function __construct($id) {
-1
View File
@@ -5,7 +5,6 @@ namespace Gazelle;
use Gazelle\Util\Time;
class SiteInfo extends Base {
public function gitBranch() {
return trim(shell_exec('git rev-parse --abbrev-ref HEAD'));
}
-1
View File
@@ -6,7 +6,6 @@ use Permissions;
use Users;
class Staff extends Base {
/** @var array */
protected $user;
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Stats;
class Economic extends \Gazelle\Base {
protected $stats;
const CACHE_KEY = 'stats_economic';
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle;
class Stylesheet extends Base {
private $stylesheets;
public function __construct() {
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Top10;
class Tag extends \Gazelle\Base {
public function getTopUsedTags($limit) {
if (!$topUsedTags = $this->cache->get_value('topusedtag_' . $limit)) {
$topUsedTags = $this->db->prepared_query("
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Top10;
class Torrent extends \Gazelle\Base {
/** @var Array */
private $formats;
+59 -59
View File
@@ -5,66 +5,66 @@ namespace Gazelle\Torrent;
use Lang;
class Language {
private const Item = [
'english',
'japanese',
'korean',
'arabic',
'brazilian_port',
'bulgarian',
'croatian',
'czech',
'danish',
'dutch',
'estonian',
'finnish',
'french',
'german',
'greek',
'hebrew',
'hindi',
'hungarian',
'icelandic',
'indonesian',
'italian',
'latvian',
'lithuanian',
'norwegian',
'persian',
'polish',
'portuguese',
'romanian',
'russian',
'serbian',
'slovak',
'slovenian',
'spanish',
'swedish',
'thai',
'turkish',
'ukrainian',
'vietnamese',
'mandarin',
'cantonese',
'min_nan',
'japanese_sign_language',
'chinese',
'catalan',
];
private const Item = [
'english',
'japanese',
'korean',
'arabic',
'brazilian_port',
'bulgarian',
'croatian',
'czech',
'danish',
'dutch',
'estonian',
'finnish',
'french',
'german',
'greek',
'hebrew',
'hindi',
'hungarian',
'icelandic',
'indonesian',
'italian',
'latvian',
'lithuanian',
'norwegian',
'persian',
'polish',
'portuguese',
'romanian',
'russian',
'serbian',
'slovak',
'slovenian',
'spanish',
'swedish',
'thai',
'turkish',
'ukrainian',
'vietnamese',
'mandarin',
'cantonese',
'min_nan',
'japanese_sign_language',
'chinese',
'catalan',
];
public static function allItem() {
return self::Item;
}
public static function allItem() {
return self::Item;
}
public static function text($Item) {
return t('server.upload.' . str_replace(' ', '_', trim(strtolower($Item))), ['DefaultValue' => $Item]);
}
public static function text($Item) {
return t('server.upload.' . str_replace(' ', '_', trim(strtolower($Item))), ['DefaultValue' => $Item]);
}
public static function sphinxKey($Text) {
$key = Lang::get_key('server.upload', $Text);
if (!empty($key)) {
return Lang::getWithLang($key, Lang::EN);
}
return 'invalid';
}
public static function sphinxKey($Text) {
$key = Lang::get_key('server.upload', $Text);
if (!empty($key)) {
return Lang::getWithLang($key, Lang::EN);
}
return 'invalid';
}
}
+1 -1
View File
@@ -7,6 +7,6 @@ class MediaInfo {
$this->parse();
}
private function parse() {
}
}
+12 -10
View File
@@ -6,7 +6,6 @@ use Gazelle\Base;
use FEED, Text, Torrents, Lang, Tags;
class Notification extends Base {
private $feed;
public function __construct() {
parent::__construct();
@@ -15,23 +14,26 @@ class Notification extends Base {
private function buildBody($Properties) {
$Body = '';
if (empty($Properties['Body'])) {
$Body = $Properties['MainBody'];
} else if (empty($Properties["MainBody"])) {
$Body = $Properties['Body'];
if (empty($Properties['WikiBody'])) {
$Body = $Properties['MainWikiBody'];
} else if (empty($Properties["MainWikiBody"])) {
$Body = $Properties['WikiBody'];
} else {
$Body = $Properties['Body'] . "\n\n" . $Properties['MainBody'];
$Body = $Properties['WikiBody'] . "\n\n" . $Properties['MainWikiBody'];
}
return $Body;
}
private function buildTitle($Properties) {
$Title = Torrents::display_simple_group_name($Properties, null, false);
$Title = Torrents::display_simple_group_name($Properties['Group'], null, false);
if ($Properties['ReleaseType'] > 0) {
$Title .= ' [' . t('server.torrents.release_types')[$Properties['ReleaseType']] . ']';
}
$Details = '';
$Details .= trim($Properties['Codec']) . ' / ' . trim($Properties['Source']) . ' / ' . trim($Properties['Resolution']) . ' / ' . trim($Properties['Container']) . ' / ' . trim($Properties['Processing']);
$Details .= trim($Properties['Codec']) . ' / ' . trim($Properties['Source']) . ' / ' . trim($Properties['Resolution']) . ' / ' . trim($Properties['Container']);
if (!empty(trim($Properties['Processing'])) && trim($Properties['Processing']) != '---') {
$Details .= ' / ' . trim($Properties['Processing']);
}
if ($Properties['Scene'] == '1') {
$Details .= ' / Scene';
}
@@ -68,7 +70,7 @@ class Notification extends Base {
$Group = $Properties['Group'];
$Title = $this->buildTitle($Properties);
$Body = $this->buildBody($Properties);
$Body = $this->buildBody($Properties['Group']);
// For RSS
$Tags = explode(',', $Properties['TagList']);
@@ -246,7 +248,7 @@ class Notification extends Base {
return;
}
$Title = $this->buildTitle($Properties);
$Body = $this->buildBody($Properties);
$Body = $this->buildBody($Properties['Group']);
$GroupID = $Properties['GroupID'];
$TorrentID = $Properties['TorrentID'];
+277 -277
View File
@@ -6,288 +6,288 @@ namespace Gazelle\Torrent;
use Lang;
class Region {
private const mapping = [
'UK' => 'United Kingdom',
'USA' => 'United States',
'Russia' => 'Russian Federation',
];
private const mapping = [
'UK' => 'United Kingdom',
'USA' => 'United States',
'Russia' => 'Russian Federation',
];
private const keyMapping = [
'hong kong' => 'Hong Kong,China',
'taiwan' => 'Taiwan,China',
'macao' => 'Macao',
];
private const keyMapping = [
'hong kong' => 'Hong Kong,China',
'taiwan' => 'Taiwan,China',
'macao' => 'Macao',
];
private const postSphinxKey = [
'Hong Kong,China' => 'hong kong',
'Taiwan,China' => 'taiwan',
'Macao' => 'macao',
private const postSphinxKey = [
'Hong Kong,China' => 'hong kong',
'Taiwan,China' => 'taiwan',
'Macao' => 'macao',
];
private const Item = [
'afghanistan',
'aland_islands',
'albania',
'algeria',
'american_samoa',
'andorra',
'angola',
'anguilla',
'antigua_and_barbuda',
'argentina',
'armenia',
'aruba',
'australia',
'austria',
'azerbaijan',
'bangladesh',
'bahrain',
'bahamas',
'barbados',
'belarus',
'belgium',
'belize',
'benin',
'bermuda',
'bhutan',
'bolivia',
'bosnia_and_herzegovina',
'botswana',
'bouvet_island',
'brazil',
'brunei',
'bulgaria',
'burkina_faso',
'burundi',
'cambodia',
'cameroon',
'canada',
'cape_verde',
'central_african_republic',
'chad',
'chile',
'christmas_islands',
'cocos_(keeling)_islands',
'colombia',
'comoros',
'congo_(congo-kinshasa)',
'congo',
'cook_islands',
'costa_rica',
'cote_d\'ivoire',
'china',
'croatia',
'cuba',
'czech',
'cyprus',
'denmark',
'djibouti',
'dominica',
'ecuador',
'egypt',
'equatorial_guinea',
'eritrea',
'estonia',
'ethiopia',
'faroe_islands',
'fiji',
'finland',
'france',
'metropolitanfrance',
'french_guiana',
'french_polynesia',
'gabon',
'gambia',
'georgia',
'germany',
'ghana',
'gibraltar',
'greece',
'grenada',
'guadeloupe',
'guam',
'guatemala',
'guernsey',
'guinea-bissau',
'guinea',
'guyana',
'haiti',
'honduras',
'hungary',
'iceland',
'india',
'indonesia',
'iran',
'iraq',
'ireland',
'isle_of_man',
'israel',
'italy',
'jamaica',
'japan',
'jersey',
'jordan',
'kazakhstan',
'kenya',
'kiribati',
'south_korea',
'north_korea',
'kuwait',
'kyrgyzstan',
'laos',
'latvia',
'lebanon',
'lesotho',
'liberia',
'libya',
'liechtenstein',
'lithuania',
'luxembourg',
'macedonia',
'malawi',
'malaysia',
'madagascar',
'maldives',
'mali',
'malta',
'marshall_islands',
'martinique',
'mauritania',
'mauritius',
'mayotte',
'mexico',
'micronesia',
'moldova',
'monaco',
'mongolia',
'montenegro',
'montserrat',
'morocco',
'mozambique',
'myanmar',
'namibia',
'nauru',
'nepal',
'netherlands',
'new_caledonia',
'new_zealand',
'nicaragua',
'niger',
'nigeria',
'niue',
'norfolk_island',
'norway',
'oman',
'pakistan',
'palau',
'palestine',
'panama',
'papua_new_guinea',
'peru',
'philippines',
'pitcairn_islands',
'poland',
'portugal',
'puerto_rico',
'qatar',
'reunion',
'romania',
'rwanda',
'russia',
'saint_helena',
'saint_kitts-nevis',
'saint_lucia',
'saint_vincent_and_the_grenadines',
'el_salvador',
'samoa',
'san_marino',
'sao_tome_and_principe',
'saudi_arabia',
'senegal',
'seychelles',
'sierra_leone',
'singapore',
'serbia',
'slovakia',
'slovenia',
'solomon_islands',
'somalia',
'south_africa',
'spain',
'sri_lanka',
'sudan',
'suriname',
'swaziland',
'sweden',
'switzerland',
'syria',
'tajikistan',
'tanzania',
'thailand',
'trinidad_and_tobago',
'timor-leste',
'togo',
'tokelau',
'tonga',
'tunisia',
'turkey',
'turkmenistan',
'tuvalu',
'uganda',
'ukraine',
'united_arab_emirates',
'united_kingdom',
'united_states',
'uruguay',
'uzbekistan',
'vanuatu',
'vatican_city',
'venezuela',
'vietnam',
'wallis_and_futuna',
'western_sahara',
'yemen',
'yugoslavia',
'zambia',
'zimbabwe',
'taiwan',
'hong_kong',
'macao',
'soviet_union',
];
];
private const Item = [
'afghanistan',
'aland_islands',
'albania',
'algeria',
'american_samoa',
'andorra',
'angola',
'anguilla',
'antigua_and_barbuda',
'argentina',
'armenia',
'aruba',
'australia',
'austria',
'azerbaijan',
'bangladesh',
'bahrain',
'bahamas',
'barbados',
'belarus',
'belgium',
'belize',
'benin',
'bermuda',
'bhutan',
'bolivia',
'bosnia_and_herzegovina',
'botswana',
'bouvet_island',
'brazil',
'brunei',
'bulgaria',
'burkina_faso',
'burundi',
'cambodia',
'cameroon',
'canada',
'cape_verde',
'central_african_republic',
'chad',
'chile',
'christmas_islands',
'cocos_(keeling)_islands',
'colombia',
'comoros',
'congo_(congo-kinshasa)',
'congo',
'cook_islands',
'costa_rica',
'cote_d\'ivoire',
'china',
'croatia',
'cuba',
'czech',
'cyprus',
'denmark',
'djibouti',
'dominica',
'ecuador',
'egypt',
'equatorial_guinea',
'eritrea',
'estonia',
'ethiopia',
'faroe_islands',
'fiji',
'finland',
'france',
'metropolitanfrance',
'french_guiana',
'french_polynesia',
'gabon',
'gambia',
'georgia',
'germany',
'ghana',
'gibraltar',
'greece',
'grenada',
'guadeloupe',
'guam',
'guatemala',
'guernsey',
'guinea-bissau',
'guinea',
'guyana',
'haiti',
'honduras',
'hungary',
'iceland',
'india',
'indonesia',
'iran',
'iraq',
'ireland',
'isle_of_man',
'israel',
'italy',
'jamaica',
'japan',
'jersey',
'jordan',
'kazakhstan',
'kenya',
'kiribati',
'south_korea',
'north_korea',
'kuwait',
'kyrgyzstan',
'laos',
'latvia',
'lebanon',
'lesotho',
'liberia',
'libya',
'liechtenstein',
'lithuania',
'luxembourg',
'macedonia',
'malawi',
'malaysia',
'madagascar',
'maldives',
'mali',
'malta',
'marshall_islands',
'martinique',
'mauritania',
'mauritius',
'mayotte',
'mexico',
'micronesia',
'moldova',
'monaco',
'mongolia',
'montenegro',
'montserrat',
'morocco',
'mozambique',
'myanmar',
'namibia',
'nauru',
'nepal',
'netherlands',
'new_caledonia',
'new_zealand',
'nicaragua',
'niger',
'nigeria',
'niue',
'norfolk_island',
'norway',
'oman',
'pakistan',
'palau',
'palestine',
'panama',
'papua_new_guinea',
'peru',
'philippines',
'pitcairn_islands',
'poland',
'portugal',
'puerto_rico',
'qatar',
'reunion',
'romania',
'rwanda',
'russia',
'saint_helena',
'saint_kitts-nevis',
'saint_lucia',
'saint_vincent_and_the_grenadines',
'el_salvador',
'samoa',
'san_marino',
'sao_tome_and_principe',
'saudi_arabia',
'senegal',
'seychelles',
'sierra_leone',
'singapore',
'serbia',
'slovakia',
'slovenia',
'solomon_islands',
'somalia',
'south_africa',
'spain',
'sri_lanka',
'sudan',
'suriname',
'swaziland',
'sweden',
'switzerland',
'syria',
'tajikistan',
'tanzania',
'thailand',
'trinidad_and_tobago',
'timor-leste',
'togo',
'tokelau',
'tonga',
'tunisia',
'turkey',
'turkmenistan',
'tuvalu',
'uganda',
'ukraine',
'united_arab_emirates',
'united_kingdom',
'united_states',
'uruguay',
'uzbekistan',
'vanuatu',
'vatican_city',
'venezuela',
'vietnam',
'wallis_and_futuna',
'western_sahara',
'yemen',
'yugoslavia',
'zambia',
'zimbabwe',
'taiwan',
'hong_kong',
'macao',
'soviet_union',
];
public static function allItem($Type = null) {
return self::Item;
}
public static function allItem($Type = null) {
return self::Item;
}
private static function map($Region) {
if (array_key_exists($Region, self::mapping)) {
return self::mapping[$Region];
}
return $Region;
}
private static function map($Region) {
if (array_key_exists($Region, self::mapping)) {
return self::mapping[$Region];
}
return $Region;
}
private static function keyMap($Key) {
if (array_key_exists($Key, self::keyMapping)) {
return self::keyMapping[$Key];
}
return $Key;
}
private static function keyMap($Key) {
if (array_key_exists($Key, self::keyMapping)) {
return self::keyMapping[$Key];
}
return $Key;
}
public static function text($Item) {
$value = Region::map($Item);
return t('server.country.' . str_replace(' ', '_', trim(strtolower($value))), ['DefaultValue' => $Item]);
}
public static function sphinx_key($Text) {
$Text = Region::keyMap($Text);
$key = Lang::get_key('server.country', $Text);
if (!empty($key)) {
$Ret = Lang::getWithLang($key, Lang::EN);
if (array_key_exists($Ret, self::postSphinxKey)) {
return self::postSphinxKey[$Ret];
}
return $Ret;
}
return 'invalid';
}
public static function text($Item) {
$value = Region::map($Item);
return t('server.country.' . str_replace(' ', '_', trim(strtolower($value))), ['DefaultValue' => $Item]);
}
public static function sphinx_key($Text) {
$Text = Region::keyMap($Text);
$key = Lang::get_key('server.country', $Text);
if (!empty($key)) {
$Ret = Lang::getWithLang($key, Lang::EN);
if (array_key_exists($Ret, self::postSphinxKey)) {
return self::postSphinxKey[$Ret];
}
return $Ret;
}
return 'invalid';
}
}
+72 -72
View File
@@ -5,80 +5,80 @@ namespace Gazelle\Torrent;
use Lang;
class Subtitle {
const MainItem = 1;
const ExtraItem = 2;
const AllItem = 3;
private const Main = [
'chinese_simplified',
'chinese_traditional',
'english',
'japanese',
'korean'
];
public const NoSubtitleitem = 'no_subtitles';
private const Extra = [
'arabic',
'brazilian_port',
'bulgarian',
'croatian',
'czech',
'danish',
'dutch',
'estonian',
'finnish',
'french',
'german',
'greek',
'hebrew',
'hindi',
'hungarian',
'icelandic',
'indonesian',
'italian',
'latvian',
'lithuanian',
'norwegian',
'persian',
'polish',
'portuguese',
'romanian',
'russian',
'serbian',
'slovak',
'slovenian',
'spanish',
'swedish',
'thai',
'turkish',
'ukrainian',
'vietnamese'
];
const MainItem = 1;
const ExtraItem = 2;
const AllItem = 3;
private const Main = [
'chinese_simplified',
'chinese_traditional',
'english',
'japanese',
'korean'
];
public const NoSubtitleitem = 'no_subtitles';
private const Extra = [
'arabic',
'brazilian_port',
'bulgarian',
'croatian',
'czech',
'danish',
'dutch',
'estonian',
'finnish',
'french',
'german',
'greek',
'hebrew',
'hindi',
'hungarian',
'icelandic',
'indonesian',
'italian',
'latvian',
'lithuanian',
'norwegian',
'persian',
'polish',
'portuguese',
'romanian',
'russian',
'serbian',
'slovak',
'slovenian',
'spanish',
'swedish',
'thai',
'turkish',
'ukrainian',
'vietnamese'
];
public static function allItem($Type = null) {
switch ($Type) {
case self::MainItem:
return self::Main;
case self::ExtraItem:
return self::Extra;
case self::AllItem:
default:
return array_merge(self::Main, self::Extra);
}
}
public static function allItem($Type = null) {
switch ($Type) {
case self::MainItem:
return self::Main;
case self::ExtraItem:
return self::Extra;
case self::AllItem:
default:
return array_merge(self::Main, self::Extra);
}
}
public static function text($Item) {
return t("server.upload.$Item");
}
public static function text($Item) {
return t("server.upload.$Item");
}
public static function icon($Item) {
return icon("flag/$Item");
}
public static function icon($Item) {
return icon("flag/$Item");
}
public static function sphinxKey($Text) {
$key = Lang::get_key('server.upload', $Text);
if (!empty($key)) {
return str_ireplace('server.upload.', '', $key);
}
return 'invalid';
}
public static function sphinxKey($Text) {
$key = Lang::get_key('server.upload', $Text);
if (!empty($key)) {
return str_ireplace('server.upload.', '', $key);
}
return 'invalid';
}
}
File diff suppressed because it is too large Load Diff
+19 -10
View File
@@ -93,7 +93,6 @@ class Upload extends Base {
$this->validate->SetFields('maindesc', '1', 'string', 'Title must be between 2 and 200 characters.', ['maxlength' => 65535]);
$this->validate->SetFields('image', '1', 'link', 'Image link must be between 2 and 200 characters.');
$this->validate->SetFields('year', '1', 'number', 'year.');
$this->validate->SetFields('imdb', '1', 'regex', 'imdb id', ['regex' => '/' . IMDB_REGEX . '/']);
$this->validate->SetFields('releasetype', '1', 'inarray', 'release type', ['inarray' => $ReleaseTypes]);
} else {
$this->validate->SetFields('groupid', '1', 'number', 'group id');
@@ -105,6 +104,7 @@ class Upload extends Base {
if ($Err) {
throw new Exception\InvalidParamException($Err);
}
if (!is_array($Params['mediainfo'])) {
throw new Exception\InvalidParamException('mediainfo');
}
@@ -128,6 +128,11 @@ class Upload extends Base {
if ($MainArtistCount < 1) {
throw new Exception\InvalidParamException('main artist number');
}
if (!empty($Params['no_imdb_link'])) {
} else if (preg_match('/' . IMDB_REGEX . '/', $Params['imdb'])) {
} else {
throw new Exception\InvalidParamException('imdb id');
}
if (count($Params['artists']) != count($Params['importance']) || count($Params['artists']) != count($Params['artist_ids']) || count($Params['artists']) != count($Params['artists_sub'])) {
throw new Exception\InvalidParamException('artists info count');
}
@@ -155,6 +160,8 @@ class Upload extends Base {
if (!empty($Params['imdb'])) {
preg_match('/' . IMDB_REGEX . '/', $Params['imdb'], $IMDBMatch);
$properties['IMDBID'] = $IMDBMatch[1];
} else {
$properties['IMDBID'] = '';
}
$properties['Name'] = $Params['name'];
$properties['SubName'] = isset($Params['subname']) ? $Params['subname'] : '';
@@ -233,6 +240,7 @@ class Upload extends Base {
$ArtistSubName = $Params['artists_sub'];
for ($i = 0, $il = count($Artists); $i < $il; $i++) {
if (trim($Artists[$i]) != '') {
$ArtistForm[$Importance[$i]][] = array('Name' => $Artists[$i], 'IMDBID' => isset($ArtistIMDBIDs[$i]) ? $ArtistIMDBIDs[$i] : null, 'SubName' => $ArtistSubName[$i]);
@@ -253,7 +261,7 @@ class Upload extends Base {
$properties['FreeLeech'] = Torrents::FREE;
}
if ($properties['Diy'] || $this->properties['Buy']) {
if ($properties['Diy'] || $properties['Buy']) {
$properties['FreeLeech'] = Torrents::FREE;
}
@@ -387,7 +395,6 @@ class Upload extends Base {
$DoubanID = 'null';
$DoubanVote = 'null';
$IMDBVote = 'null';
$IMDBID = '';
$RTRating = '';
$IMDBRating = 'null';
$Runtime = '';
@@ -431,12 +438,14 @@ class Upload extends Base {
$this->db->begin_transaction();
try {
$IMDBID = $this->properties['IMDBID'];
$this->db->prepared_query("SELECT * FROM torrents_group WHERE IMDBID = ?", $IMDBID);
if ($this->db->record_count() > 0) {
$ExistedGroup = $this->db->next_record(MYSQLI_ASSOC, false);
$this->isNewGroup = false;
$this->properties['Group'] = $ExistedGroup;
$this->properties['GroupID'] = $ExistedGroup['ID'];
if ($IMDBID) {
$this->db->prepared_query("SELECT * FROM torrents_group WHERE IMDBID = ?", $IMDBID);
if ($this->db->record_count() > 0) {
$ExistedGroup = $this->db->next_record(MYSQLI_ASSOC, false);
$this->isNewGroup = false;
$this->properties['Group'] = $ExistedGroup;
$this->properties['GroupID'] = $ExistedGroup['ID'];
}
}
if ($this->isNewGroup) {
$ArtistForm = $this->properties['Artists'];
@@ -552,7 +561,7 @@ class Upload extends Base {
list($properties['ReleaseType']) = $this->db->next_record();
}
$this->db->prepared_query("SELECT * FROM torrents_group WHERE ID = ?", $GroupID);
$ExistedGroup = $this->db->next_record(MYSQLI_ASSOC);
$ExistedGroup = $this->db->next_record(MYSQLI_ASSOC, false);
$this->properties['Group'] = $ExistedGroup;
// Use this section to control freeleeches
$Checked = 0;
-1
View File
@@ -48,7 +48,6 @@ namespace Gazelle;
*/
class UserRank extends Base {
var $config;
var $rank;
var $score;
-1
View File
@@ -10,7 +10,6 @@ namespace Gazelle\UserRank;
*/
abstract class AbstractUserRank extends \Gazelle\Base {
abstract public function cacheKey(): string;
abstract public function selector(): string;
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class ArtistsAdded extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_artistsadded';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class BonusPoints extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_bonuspoint';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class BountySpent extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_bountyspent';
}
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class CollageContribution extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_collagecontrib';
}
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class CommentTorrent extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_commenttorrent';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class DataDownload extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_download';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class DataUpload extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_uploadd';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class ForumPosts extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_forumposts';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class ReleaseVotes extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_releasevites';
}
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class RequestsFilled extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_requestsfilled';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\UserRank\Dimension;
class Uploads extends \Gazelle\UserRank\AbstractUserRank {
public function cacheKey(): string {
return 'rank_data_uploads';
}
-1
View File
@@ -3,7 +3,6 @@
namespace Gazelle\Util;
class FileChecker {
protected $comicsExtensions = [
'cbr', 'cbz', 'gif', 'jpeg', 'jpg', 'pdf', 'png'
];
+5
View File
@@ -23,8 +23,13 @@
define('BORIS', 1);
require(__DIR__ . '/classes/classloader.php');
require_once(__DIR__ . '/classes/config.php');
require_once(__DIR__ . '/classes/const.php');
require_once(__DIR__ . '/classes/cache.class.php');
require_once(__DIR__ . '/classes/mysql.class.php');
require_once(__DIR__ . '/classes/debug.class.php');
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/classes/paranoia.class.php');
require_once(__DIR__ . '/classes/time.class.php');
-1
View File
@@ -1,7 +1,6 @@
<?php
class NMA_API {
/**
* @const LIB_ERROR_TYPE can be exception or error
*/
-1
View File
@@ -3,7 +3,6 @@
use Gazelle\Util\Time;
class Artists {
const Director = 1;
const Writter = 2;
const Producer = 3;
-1
View File
@@ -1,7 +1,6 @@
<?
class AutoEnable {
// Constants for database values
const APPROVED = 1;
const DENIED = 2;
+1 -2
View File
@@ -1,8 +1,7 @@
<?php
class BitcoinRpc {
public static function __callStatic($Method, $Args) {
if (CONFIG['BITCOIN_RPC_URL'])) {
if (CONFIG['BITCOIN_RPC_URL']) {
return false;
}
$MessageID = mt_rand();
-1
View File
@@ -1,6 +1,5 @@
<?php
class Bookmarks {
/**
* Check if can bookmark
*
+4 -4
View File
@@ -30,8 +30,8 @@ class CommentsView {
$UserInfo = Users::user_info($AuthorID);
$Header = '<strong>' . Users::format_username($AuthorID, true, true, true, true, false, false, false, true) . '</strong> ' . $Header;
?>
<div class="TableContainer">
<table class="TableForumPost Table <?= (!Users::has_avatars_enabled() ? ' noavatar' : '') . ($Unread ? ' forum_unread' : '') ?>" id="post<?= $PostID ?>">
<div class="TableContainer" id="post<?= $PostID ?>">
<table class="TableForumPost Table <?= (!Users::has_avatars_enabled() ? ' noavatar' : '') . ($Unread ? ' forum_unread' : '') ?>">
<tr class="Table-rowHeader">
<td class="Table-cell" colspan="<?= (Users::has_avatars_enabled() ? 2 : 1) ?>">
<div class="TableForumPostHeader">
@@ -44,10 +44,10 @@ class CommentsView {
<? if ($Tools) { ?>
<a href="#quickpost" onclick="Quote('<?= $PostID ?>','<?= $UserInfo['Username'] ?>', true);" class="brackets"><?= t('server.forums.quote') ?></a>
<? if ($AuthorID == G::$LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?>
- <a onclick="globalapp.editForm('<?= $PostID ?>');" class="brackets"><?= t('server.common.edit') ?></a>
- <a href="#" onclick="globalapp.editForm('<?= $PostID ?>');" class="brackets"><?= t('server.common.edit') ?></a>
<? } ?>
<? if (check_perms('site_moderate_forums')) { ?>
- <a onclick="Delete('<?= $PostID ?>');" class="brackets"><?= t('server.common.delete') ?></a>
- <a href="#" onclick="Delete('<?= $PostID ?>');" class="brackets"><?= t('server.common.delete') ?></a>
<? } ?>
- <a href="reports.php?action=report&amp;type=comment&amp;id=<?= $PostID ?>" class="brackets"><?= t('server.forums.report') ?></a>
<? if (check_perms('users_warn') && $AuthorID != G::$LoggedUser['ID'] && G::$LoggedUser['Class'] >= $UserInfo['Class']) { ?>
+139 -139
View File
@@ -2,28 +2,28 @@
//Captcha fonts should be located in /classes/fonts
$CaptchaFonts = array(
'ARIBLK.TTF',
'IMPACT.TTF',
'TREBUC.TTF',
'TREBUCBD.TTF',
'TREBUCBI.TTF',
'TREBUCIT.TTF',
'VERDANA.TTF',
'VERDANAB.TTF',
'VERDANAI.TTF',
'VERDANAZ.TTF'
'ARIBLK.TTF',
'IMPACT.TTF',
'TREBUC.TTF',
'TREBUCBD.TTF',
'TREBUCBI.TTF',
'TREBUCIT.TTF',
'VERDANA.TTF',
'VERDANAB.TTF',
'VERDANAI.TTF',
'VERDANAZ.TTF'
);
//Captcha images should be located in /captcha
$CaptchaBGs = array(
'captcha1.png',
'captcha2.png',
'captcha3.png',
'captcha4.png',
'captcha5.png',
'captcha6.png',
'captcha7.png',
'captcha8.png',
'captcha9.png'
'captcha1.png',
'captcha2.png',
'captcha3.png',
'captcha4.png',
'captcha5.png',
'captcha6.png',
'captcha7.png',
'captcha8.png',
'captcha9.png'
);
$Codecs = array('DivX', 'XviD', 'x264', 'H.264', 'x265', 'H.265', 'Other');
@@ -55,140 +55,140 @@ $ReleaseTypes = [1, 2, 5, 6];
// Ratio requirements, in descending order
// Columns: Download amount, required ratio, grace period
$RatioRequirements = array(
array(50 * 1024 * 1024 * 1024, 0.60, date('Y-m-d H:i:s')),
array(40 * 1024 * 1024 * 1024, 0.50, date('Y-m-d H:i:s')),
array(30 * 1024 * 1024 * 1024, 0.40, date('Y-m-d H:i:s')),
array(20 * 1024 * 1024 * 1024, 0.30, date('Y-m-d H:i:s')),
array(10 * 1024 * 1024 * 1024, 0.20, date('Y-m-d H:i:s')),
array(5 * 1024 * 1024 * 1024, 0.15, date('Y-m-d H:i:s', time() - (60 * 60 * 24 * 14)))
array(50 * 1024 * 1024 * 1024, 0.60, date('Y-m-d H:i:s')),
array(40 * 1024 * 1024 * 1024, 0.50, date('Y-m-d H:i:s')),
array(30 * 1024 * 1024 * 1024, 0.40, date('Y-m-d H:i:s')),
array(20 * 1024 * 1024 * 1024, 0.30, date('Y-m-d H:i:s')),
array(10 * 1024 * 1024 * 1024, 0.20, date('Y-m-d H:i:s')),
array(5 * 1024 * 1024 * 1024, 0.15, date('Y-m-d H:i:s', time() - (60 * 60 * 24 * 14)))
);
// Special characters, and what they should be converted to
// Used for torrent searching
$SpecialChars = array(
'&' => 'and'
'&' => 'and'
);
$UserDemoteCriteria = [
[
'From' => CONFIG['USER_CLASS']['GURU'],
'To' => CONFIG['USER_CLASS']['ELITE_TM'],
'MinUploads' => 1000,
],
[
'From' => CONFIG['USER_CLASS']['ELITE_TM'],
'To' => CONFIG['USER_CLASS']['POWER_TM'],
'MinUploads' => 500,
],
[
'From' => CONFIG['USER_CLASS']['GURU'],
'To' => CONFIG['USER_CLASS']['ELITE_TM'],
'MinUploads' => 1000,
],
[
'From' => CONFIG['USER_CLASS']['ELITE_TM'],
'To' => CONFIG['USER_CLASS']['POWER_TM'],
'MinUploads' => 500,
],
[
'From' => CONFIG['USER_CLASS']['POWER_TM'],
'To' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'MinUploads' => 250,
],
[
'From' => CONFIG['USER_CLASS']['POWER_TM'],
'To' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'MinUploads' => 250,
],
[
'From' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'To' => CONFIG['USER_CLASS']['ELITE'],
'MinUploads' => 100,
],
[
'From' => CONFIG['USER_CLASS']['ELITE'],
'To' => CONFIG['USER_CLASS']['POWER'],
'MinUploads' => 25,
],
[
'From' => CONFIG['USER_CLASS']['POWER'],
'To' => CONFIG['USER_CLASS']['MEMBER'],
'MinRatio' => 0.95,
'MinUploads' => 1,
],
[
'From' => CONFIG['USER_CLASS']['MEMBER'],
'To' => CONFIG['USER_CLASS']['USER'],
'MinRatio' => 0.65,
],
[
'From' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'To' => CONFIG['USER_CLASS']['ELITE'],
'MinUploads' => 100,
],
[
'From' => CONFIG['USER_CLASS']['ELITE'],
'To' => CONFIG['USER_CLASS']['POWER'],
'MinUploads' => 25,
],
[
'From' => CONFIG['USER_CLASS']['POWER'],
'To' => CONFIG['USER_CLASS']['MEMBER'],
'MinRatio' => 0.95,
'MinUploads' => 1,
],
[
'From' => CONFIG['USER_CLASS']['MEMBER'],
'To' => CONFIG['USER_CLASS']['USER'],
'MinRatio' => 0.65,
],
];
$UserPromoteCriteria = [
[
'From' => CONFIG['USER_CLASS']['USER'],
'To' => CONFIG['USER_CLASS']['MEMBER'],
'MinUpload' => 0,
'MinDownload' => 80 * 1024 * 1024 * 1024,
'MinRatio' => 0.8,
'MinUploads' => 0,
'Weeks' => 1,
'AwardLevel' => 1,
],
[
'From' => CONFIG['USER_CLASS']['MEMBER'],
'To' => CONFIG['USER_CLASS']['POWER'],
'MinUpload' => 0,
'MinDownload' => 200 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 1,
'Weeks' => 2,
'AwardLevel' => 2,
'Invite' => 1,
],
[
'From' => CONFIG['USER_CLASS']['POWER'],
'To' => CONFIG['USER_CLASS']['ELITE'],
'MinUpload' => 0,
'MinDownload' => 500 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 25,
'Weeks' => 4,
'AwardLevel' => 3,
'Invite' => 1,
],
[
'From' => CONFIG['USER_CLASS']['ELITE'],
'To' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'MinUpload' => 0,
'MinDownload' => 1 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 100,
'Weeks' => 8,
'AwardLevel' => 4,
'Invite' => 2,
[
'From' => CONFIG['USER_CLASS']['USER'],
'To' => CONFIG['USER_CLASS']['MEMBER'],
'MinUpload' => 0,
'MinDownload' => 80 * 1024 * 1024 * 1024,
'MinRatio' => 0.8,
'MinUploads' => 0,
'Weeks' => 1,
'AwardLevel' => 1,
],
[
'From' => CONFIG['USER_CLASS']['MEMBER'],
'To' => CONFIG['USER_CLASS']['POWER'],
'MinUpload' => 0,
'MinDownload' => 200 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 1,
'Weeks' => 2,
'AwardLevel' => 2,
'Invite' => 1,
],
[
'From' => CONFIG['USER_CLASS']['POWER'],
'To' => CONFIG['USER_CLASS']['ELITE'],
'MinUpload' => 0,
'MinDownload' => 500 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 25,
'Weeks' => 4,
'AwardLevel' => 3,
'Invite' => 1,
],
[
'From' => CONFIG['USER_CLASS']['ELITE'],
'To' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'MinUpload' => 0,
'MinDownload' => 1 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 100,
'Weeks' => 8,
'AwardLevel' => 4,
'Invite' => 2,
],
[
'From' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'To' => CONFIG['USER_CLASS']['POWER_TM'],
'MinUpload' => 0,
'MinDownload' => 2 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 250,
'Weeks' => 12,
'AwardLevel' => 5,
'Invite' => 2,
],
[
'From' => CONFIG['USER_CLASS']['TORRENT_MASTER'],
'To' => CONFIG['USER_CLASS']['POWER_TM'],
'MinUpload' => 0,
'MinDownload' => 2 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 250,
'Weeks' => 12,
'AwardLevel' => 5,
'Invite' => 2,
],
[
'From' => CONFIG['USER_CLASS']['POWER_TM'],
'To' => CONFIG['USER_CLASS']['ELITE_TM'],
'MinUpload' => 0,
'MinDownload' => 5 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 500,
'Weeks' => 16,
'AwardLevel' => 6,
'Invite' => 3,
],
[
'From' => CONFIG['USER_CLASS']['ELITE_TM'],
'To' => CONFIG['USER_CLASS']['GURU'],
'MinUpload' => 0,
'MinDownload' => 10 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 1000,
'Weeks' => 20,
'AwardLevel' => 7,
]
],
[
'From' => CONFIG['USER_CLASS']['POWER_TM'],
'To' => CONFIG['USER_CLASS']['ELITE_TM'],
'MinUpload' => 0,
'MinDownload' => 5 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 500,
'Weeks' => 16,
'AwardLevel' => 6,
'Invite' => 3,
],
[
'From' => CONFIG['USER_CLASS']['ELITE_TM'],
'To' => CONFIG['USER_CLASS']['GURU'],
'MinUpload' => 0,
'MinDownload' => 10 * 1024 * 1024 * 1024 * 1024,
'MinRatio' => 1.2,
'MinUploads' => 1000,
'Weeks' => 20,
'AwardLevel' => 7,
]
];
define('HNR_MIN_SIZE_PERCENT', 0.2);
@@ -203,8 +203,8 @@ define('DONOR_FORUM_RANK', 6);
define('VERSION', @file_get_contents(CONFIG['SERVER_ROOT'] . '/VERSION'));
define('DURATION', [
'12h' => 12 * 3600 * 1000,
'24h' => 24 * 3600 * 1000,
'12h' => 12 * 3600 * 1000,
'24h' => 24 * 3600 * 1000,
]);
define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default
+1 -1
View File
@@ -46,7 +46,7 @@ abstract class IRC_BOT {
$this->Connecting = true;
//Open a socket to the IRC server
if (CONFIG['BOT_PORT_SSL']) {
$IrcAddress = 'tls://' . CONFIG['BOT_SERVER'] . ':' . CONFIG['BOT_PORT']_SSL;
$IrcAddress = 'tls://' . CONFIG['BOT_SERVER'] . ':' . CONFIG['BOT_PORT_SSL'];
} else {
$IrcAddress = 'tcp://' . CONFIG['BOT_SERVER'] . ':' . CONFIG['BOT_PORT'];
}
-1
View File
@@ -1,7 +1,6 @@
<?
class Lang {
const EN = 'en';
const CHS = 'chs';
const PT = 'pt';
-1
View File
@@ -4,7 +4,6 @@
* Class to manage locked accounts
*/
class LockedAccounts {
/**
* Lock an account
*
+62 -62
View File
@@ -5,67 +5,67 @@ use Aws\S3\S3Client;
use Guzzle\Service\Exception\CommandTransferException;
class Minio implements ImageStorage {
private $s3;
private $bucket;
private $image_url;
function __construct($Endpoint = CONFIG['MINIO_ENDPOINT'], $Key = CONFIG['MINIO_KEY'], $Secret = CONFIG['MINIO_SECRET'], $Bucket = CONFIG['MINIO_BUCKET'], $ImageUrl = CONFIG['IMAGE_URL']) {
$this->s3 = new S3Client([
'version' => 'latest',
'endpoint' => $Endpoint,
'region' => 'us-east-1',
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $Key,
'secret' => $Secret,
],
]);
$this->bucket = $Bucket;
$this->image_url = $ImageUrl;
}
private function image_path($key) {
$bucket = $this->bucket;
return $this->image_url . "/$bucket/$key";
}
public function upload($Name, $Content) {
$file_info = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $file_info->buffer($Content);
$this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => $Name,
'Body' => $Content,
'ContentType' => $mime_type,
]);
return $this->image_path($Name);
}
private $s3;
private $bucket;
private $image_url;
function __construct($Endpoint = CONFIG['MINIO_ENDPOINT'], $Key = CONFIG['MINIO_KEY'], $Secret = CONFIG['MINIO_SECRET'], $Bucket = CONFIG['MINIO_BUCKET'], $ImageUrl = CONFIG['IMAGE_URL']) {
$this->s3 = new S3Client([
'version' => 'latest',
'endpoint' => $Endpoint,
'region' => 'us-east-1',
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $Key,
'secret' => $Secret,
],
]);
$this->bucket = $Bucket;
$this->image_url = $ImageUrl;
}
private function image_path($key) {
$bucket = $this->bucket;
return $this->image_url . "/$bucket/$key";
}
public function upload($Name, $Content) {
$file_info = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $file_info->buffer($Content);
$this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => $Name,
'Body' => $Content,
'ContentType' => $mime_type,
]);
return $this->image_path($Name);
}
public function multi_upload($Datas) {
$commands = [];
foreach ($Datas as $Data) {
$Content = $Data['Content'];
$Name = $Data['Name'];
$file_info = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $file_info->buffer($Content);
if (!in_array($mime_type, ['image/gif', 'image/jpeg', 'image/jpg', 'image/png'])) {
throw new Exception("Invalid ext: $mime_type");
}
$commands[] = $this->s3->getCommand('PutObject', [
'Bucket' => $this->bucket,
'Key' => $Name,
'Body' => $Content,
'ContentType' => $mime_type,
]);
}
$ret = [];
try {
$results = CommandPool::batch($this->s3, $commands);
foreach ($results as $Idx => $Result) {
$ret[] = $this->image_path($Datas[$Idx]['Name']);
}
} catch (CommandTransferException $e) {
foreach ($e->getFailedCommands() as $failedCommand) {
throw new Exception($e->getExceptionForFailedCommand($failedCommand)->getMessage());
}
}
return $ret;
}
public function multi_upload($Datas) {
$commands = [];
foreach ($Datas as $Data) {
$Content = $Data['Content'];
$Name = $Data['Name'];
$file_info = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $file_info->buffer($Content);
if (!in_array($mime_type, ['image/gif', 'image/jpeg', 'image/jpg', 'image/png'])) {
throw new Exception("Invalid ext: $mime_type");
}
$commands[] = $this->s3->getCommand('PutObject', [
'Bucket' => $this->bucket,
'Key' => $Name,
'Body' => $Content,
'ContentType' => $mime_type,
]);
}
$ret = [];
try {
$results = CommandPool::batch($this->s3, $commands);
foreach ($results as $Idx => $Result) {
$ret[] = $this->image_path($Datas[$Idx]['Name']);
}
} catch (CommandTransferException $e) {
foreach ($e->getFailedCommands() as $failedCommand) {
throw new Exception($e->getExceptionForFailedCommand($failedCommand)->getMessage());
}
}
return $ret;
}
}
+1 -1
View File
@@ -770,7 +770,7 @@ class NotificationsManager {
ON DUPLICATE KEY UPDATE
TimesUsed = TimesUsed + 1");
$PushServerSocket = fsockopen("127.0.0.1", 6789);
$PushServerSocket = fsockopen(CONFIG['PUSH_CONFIG_SOCKET_LISTEN_ADDRESS'], CONFIG['PUSH_CONFIG_SOCKET_LISTEN_PORT']);
fwrite($PushServerSocket, $JSON);
fclose($PushServerSocket);
}
+1 -4
View File
@@ -1,7 +1,4 @@
<?php
define("PUSH_CONFIG['SOCKET_LISTEN_ADDRESS']", "127.0.0.1");
define("PUSH_CONFIG['SOCKET_LISTEN_PORT']", 6789);
require 'NMA_API.php';
require 'config.php';
require 'const.php';
@@ -20,7 +17,7 @@ class PushServer {
private function init() {
$this->ListenSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($this->ListenSocket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_bind($this->ListenSocket, PUSH_CONFIG['SOCKET_LISTEN_ADDRESS'], PUSH_CONFIG['SOCKET_LISTEN_PORT']);
socket_bind($this->ListenSocket, CONFIG['PUSH_CONFIG_SOCKET_LISTEN_ADDRESS'], CONFIG['PUSH_CONFIG_SOCKET_LISTEN_PORT']);
socket_listen($this->ListenSocket);
socket_set_nonblock($this->ListenSocket);
echo "\nInitialized\n";
-1
View File
@@ -7,7 +7,6 @@
*
*/
class Referral {
// array to store external site credentials and API URIs, stored in cache to keep user sessions alive
private $ExternalServices;
// set session length
-1
View File
@@ -1,7 +1,6 @@
<?
class SiteHistoryView {
public static function render_linkbox() {
if (check_perms('users_mod')) {
?>
-1
View File
@@ -4,7 +4,6 @@
* Class to manage site options
*/
class SiteOptions {
/**
* Get a site option
*
-1
View File
@@ -1,6 +1,5 @@
<?
class Stats {
public const PeerCount = 'peer_count';
public const SeederCount = 'seeder_count';
public const LeecherCount = 'leecher_count';
+1
View File
@@ -123,6 +123,7 @@ class Tools {
public static function get_country_code_by_ajax($IP) {
static $IPs = array();
$Class = strtr($IP, '.', '-');
$Class = strtr($Class, ':', '-');
$HTML = '<span class="cc_' . $Class . '">Resolving CC...';
if (!isset($IPs[$IP])) {
$HTML .= '<script type="text/javascript">' .
-1
View File
@@ -1,6 +1,5 @@
<?
class Top10Movies {
private $BaseQuery = "
SELECT
g.ID,
-1
View File
@@ -1,7 +1,6 @@
<?
class Top10View {
public static function render_linkbox($Selected, $Class) {
?>
<div class="<?= $Class ?>">
+2 -2
View File
@@ -2086,8 +2086,8 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
public static function sanitizeName($Name) {
return preg_replace(
'/_+/',
'_', // remove doubled-up underscore
trim( // trim leading, trailing underscore
'_', // remove doubled-up underscore
trim( // trim leading, trailing underscore
preg_replace(
'/[^a-z0-9_]+/',
'', // remove non alphanum, underscore
+2 -2
View File
@@ -450,7 +450,7 @@ class TorrentSearch {
case 'freetorrent':
if (Torrents::global_freeleech()) {
if ($Value != 1) {
// temp code
// temp code
$this->SphQL->where('freetorrent', -1);
} else {
return;
@@ -589,7 +589,7 @@ class TorrentSearch {
} elseif (in_array($Word, $SearchProcessings)) {
$this->add_word('processing', $Word);
} else {
// Supports Hello.World
// Supports Hello.World
$Word = str_replace('.', ' ', $Word);
$this->add_word('searchstr', $Word);
}
+1 -1
View File
@@ -1047,7 +1047,7 @@ class UngroupTorrentTableView extends TorrentTableView {
global $LoggedUser;
?>
<? /* UngroupTorrentTableView */ ?>
<tr class="TableTorrent-rowTitle Table-row <?= $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '') ?>" group-id="<?= $GroupID ?>">
<tr class="TableTorrent-rowTitle Table-row <?= $SnatchedGroupClass ?>" group-id="<?= $GroupID ?>">
<td class="Table-cell">
<div class="TableTorrent-title">
<span class="TableTorrent-titleActions">
+1 -1
View File
@@ -1085,7 +1085,7 @@ class Users {
'uploadCount' => (int) $result['Uploads'],
];
}
public static function get_nav_items(): array {
public static function get_nav_items(): array {
$list = G::$Cache->get_value("nav_items");
if (!$list) {
$QueryID = G::$DB->get_query_id();
+6 -6
View File
@@ -1,10 +1,10 @@
<?php
function vite($path) {
if (CONFIG['IS_DEV']) {
return CONFIG['VITE_SERVER'] . "/$path";
} else {
$manifest = json_decode(file_get_contents(__DIR__ . '/../public/manifest.json'), true);
return "/{$manifest[$path]['file']}";
}
if (CONFIG['IS_DEV']) {
return CONFIG['VITE_SERVER'] . "/$path";
} else {
$manifest = json_decode(file_get_contents(__DIR__ . '/../public/manifest.json'), true);
return "/{$manifest[$path]['file']}";
}
}
+4
View File
@@ -136,6 +136,7 @@ $CONFIG['REQUESTS_PER_PAGE'] = 25;
$CONFIG['MESSAGES_PER_PAGE'] = 25;
$CONFIG['LOG_ENTRIES_PER_PAGE'] = 50;
$CONFIG['DONATIONS_PER_PAGE'] = 50;
$CONFIG['ARTICLES_PER_PAGE'] = 25;
// Cache catalogues
$CONFIG['THREAD_CATALOGUE'] = 500; // posts per cache key.
@@ -225,3 +226,6 @@ $CONFIG['GLOBAL_FREELEECH'] = false;
$CONFIG['FEATURE_EMAIL_REENABLE'] = true;
$CONFIG['FREE_PROBABILITY'] = 20;
$CONFIG['PUSH_CONFIG_SOCKET_LISTEN_ADDRESS'] = "127.0.0.1";
$CONFIG['PUSH_CONFIG_SOCKET_LISTEN_PORT'] = 6789;
+8 -8
View File
@@ -1,9 +1,9 @@
</td>
</tr>
</table>
<div id="foot">
<span><a href="#"><?= CONFIG['SITE_NAME'] ?></a> </span>
</div>
</body>
</td>
</tr>
</table>
<div id="foot">
<span><a href="#"><?= CONFIG['SITE_NAME'] ?></a> </span>
</div>
</body>
</html>
</html>
-1
View File
@@ -61,7 +61,6 @@ switch ($Document) {
case 'log':
case 'login':
case 'logout':
case 'questions':
case 'random':
case 'referral':
case 'register':
+2 -2
View File
@@ -26,6 +26,6 @@ $DB->query("SELECT
FROM
torrents where Slot <> 1");
foreach ($DB->to_array('ID', MYSQLI_ASSOC) as $ID => $Torrent) {
$Slot = TorrentSlot::CalSlot($Torrent);
$DB->query("UPDATE torrents SET Slot=$Slot WHERE ID=$ID");
$Slot = TorrentSlot::CalSlot($Torrent);
$DB->query("UPDATE torrents SET Slot=$Slot WHERE ID=$ID");
}
+1 -1
View File
@@ -8,7 +8,7 @@ $DB->query("
WHERE Password='$Password'");
if (!$DB->has_results()) {
$IsGoodPassword = true;
$IsGoodPassword = true;
}
echo ($IsGoodPassword ? 'true' : 'false');
+3 -3
View File
@@ -3,7 +3,7 @@
$PostID = (int)$_POST['postid'];
if (empty($PostID)) {
ajax_json_error("empty postid");
ajax_json_error("empty postid");
}
$DB->query("
@@ -13,12 +13,12 @@ $DB->query("
WHERE p.ID = '$PostID'");
if (!$DB->has_results()) {
ajax_json_error("no results");
ajax_json_error("no results");
}
list($ForumID, $Body) = $DB->next_record();
if (!Forums::check_forumperm($ForumID)) {
ajax_json_error("assholes");
ajax_json_error("assholes");
}
ajax_json_success(array("body" => nl2br($Body)));
+2 -2
View File
@@ -3,13 +3,13 @@ $RequestTax = CONFIG['REQUEST_TAX'];
// Minimum and default amount of upload to remove from the user when they vote.
// Also change in static/functions/requests.js
$MinimumVote = CONFIG['REQUEST_MIN_VOTE']
$MinimumVote = CONFIG['REQUEST_MIN_VOTE'];
/*
* This is the page that displays the request to the end user after being created.
*/
if(empty($_GET['id']) || !is_number($_GET['id'])) {
if (empty($_GET['id']) || !is_number($_GET['id'])) {
ajax_json_error();
}
+17 -17
View File
@@ -5,8 +5,8 @@ $ID = (int)$_POST['id'];
$Note = $_POST['note'];
if (empty($FriendID) || empty($Type) || empty($ID)) {
echo json_encode(array('status' => 'error', 'response' => 'Error.'));
die();
echo json_encode(array('status' => 'error', 'response' => 'Error.'));
die();
}
// Make sure the recipient is on your friends list and not some random dude.
$DB->query("
@@ -20,8 +20,8 @@ $DB->query("
AND f.FriendID = '$FriendID'");
if (!$DB->has_results()) {
echo json_encode(array('status' => 'error', 'response' => 'Not on friend list.'));
die();
echo json_encode(array('status' => 'error', 'response' => 'Not on friend list.'));
die();
}
$Type = strtolower($Type);
@@ -30,28 +30,28 @@ $Link = '';
// https://en.wikipedia.org/wiki/English_articles#Distinction_between_a_and_an
$Article = 'a';
switch ($Type) {
case 'torrent':
$Link = "torrents.php?id=$ID";
$DB->query("
case 'torrent':
$Link = "torrents.php?id=$ID";
$DB->query("
SELECT Name
FROM torrents_group
WHERE ID = '$ID'");
break;
case 'artist':
$Article = 'an';
$Link = "artist.php?id=$ID";
$DB->query("
break;
case 'artist':
$Article = 'an';
$Link = "artist.php?id=$ID";
$DB->query("
SELECT Name
FROM artists_group
WHERE ArtistID = '$ID'");
break;
case 'collage':
$Link = "collages.php?id=$ID";
$DB->query("
break;
case 'collage':
$Link = "collages.php?id=$ID";
$DB->query("
SELECT Name
FROM collages
WHERE ID = '$ID'");
break;
break;
}
list($Name) = $DB->next_record();
Misc::send_pm_with_tpl($FriendID, 'send_recommendation', ['Username' => $LoggedUser['Username'], 'Article' => $Article, 'Type' => $Type, 'Link' => $Link, 'Name' => $Name, 'Note' => $Note]);
+21 -21
View File
@@ -4,13 +4,13 @@ User topic subscription page
*/
if (!empty($LoggedUser['DisableForums'])) {
ajax_json_error();
ajax_json_error();
}
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = CONFIG['POSTS_PER_PAGE'];
$PerPage = CONFIG['POSTS_PER_PAGE'];
}
list($Page, $Limit) = Format::page_limit($PerPage);
@@ -29,7 +29,7 @@ $sql = '
AND p.ID <= IFNULL(l.PostID, t.LastPostID)
AND ' . Forums::user_forums_sql();
if ($ShowUnread) {
$sql .= '
$sql .= '
AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID';
}
$sql .= "
@@ -38,12 +38,12 @@ $sql .= "
LIMIT $Limit";
$PostIDs = $DB->query($sql);
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
list($NumResults) = $DB->next_recofdasfdasfdsd();
if ($NumResults > $PerPage * ($Page - 1)) {
$DB->set_query_id($PostIDs);
$PostIDs = $DB->collect('ID');
$sql = '
$DB->set_query_id($PostIDs);
$PostIDs = $DB->collect('ID');
$sql = '
SELECT
f.ID AS ForumID,
f.Name AS ForumName,
@@ -68,24 +68,24 @@ if ($NumResults > $PerPage * ($Page - 1)) {
LEFT JOIN users_main AS ed ON ed.ID = um.ID
WHERE p.ID IN (' . implode(',', $PostIDs) . ')
ORDER BY f.Name ASC, t.LastPostID DESC';
$DB->query($sql);
$DB->query($sql);
}
$JsonPosts = array();
while (list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()) {
$JsonPost = array(
'forumId' => (int)$ForumID,
'forumName' => $ForumName,
'threadId' => (int)$TopicID,
'threadTitle' => $ThreadTitle,
'postId' => (int)$PostID,
'lastPostId' => (int)$LastPostID,
'locked' => $Locked == 1,
'new' => ($PostID < $LastPostID && !$Locked)
);
$JsonPosts[] = $JsonPost;
$JsonPost = array(
'forumId' => (int)$ForumID,
'forumName' => $ForumName,
'threadId' => (int)$TopicID,
'threadTitle' => $ThreadTitle,
'postId' => (int)$PostID,
'lastPostId' => (int)$LastPostID,
'locked' => $Locked == 1,
'new' => ($PostID < $LastPostID && !$Locked)
);
$JsonPosts[] = $JsonPost;
}
ajax_json_success(array(
'threads' => $JsonPosts
'threads' => $JsonPosts
));
+1 -1
View File
@@ -28,7 +28,7 @@ if (isset($_POST['id']) && is_number($_POST['id'])) {
$IS_STAFF && $_POST['visibility'] == 'staff' ? 'staff' : 'public'
);
}
$Location = (empty($_SERVER['HTTP_REFERER'])) ? "/index.php" : $_SERVER['HTTP_REFERER']; // redirect back
$Location = (empty($_SERVER['HTTP_REFERER'])) ? "/index.php" : $_SERVER['HTTP_REFERER']; // redirect back
header("Location: /apply.php?action=view&id=$ID");
} elseif (isset($_GET['id']) && is_number($_GET['id'])) {
$ID = intval($_GET['id']);
+21 -21
View File
@@ -6,11 +6,11 @@ $Artist1ID = db_string($_POST['artistid']);
$Artist2ID = db_string($_POST['similar_artistid']);
if (!is_number($Artist1ID)) {
error(0);
error(0);
}
if (empty($Artist2ID)) {
error('Blank artist id.');
error('Blank artist id.');
}
$DB->query("
@@ -21,49 +21,49 @@ list($Artist2ID) = $DB->next_record();
if (!empty($Artist2ID)) { // artist was found in the database
// Let's see if there's already a similar artists field for these two
$DB->query("
// Let's see if there's already a similar artists field for these two
$DB->query("
SELECT s1.SimilarID
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID
WHERE s1.ArtistID = '$Artist1ID'
AND s2.ArtistID = '$Artist2ID'");
list($SimilarID) = $DB->next_record();
list($SimilarID) = $DB->next_record();
if ($SimilarID) { // The similar artists field already exists, just update the score
$DB->query("
if ($SimilarID) { // The similar artists field already exists, just update the score
$DB->query("
UPDATE artists_similar_scores
SET Score = Score + 200
WHERE SimilarID = '$SimilarID'");
} else { // No, it doesn't exist - create it
$DB->query("
} else { // No, it doesn't exist - create it
$DB->query("
INSERT INTO artists_similar_scores (Score)
VALUES ('200')");
$SimilarID = $DB->inserted_id();
$DB->query("
$SimilarID = $DB->inserted_id();
$DB->query("
INSERT INTO artists_similar (ArtistID, SimilarID)
VALUES ('$Artist1ID', '$SimilarID')");
$DB->query("
$DB->query("
INSERT INTO artists_similar (ArtistID, SimilarID)
VALUES ('$Artist2ID', '$SimilarID')");
}
}
$DB->query("
$DB->query("
SELECT SimilarID
FROM artists_similar_votes
WHERE SimilarID = '$SimilarID'
AND UserID = '$UserID'
AND Way = 'up'");
if (!$DB->has_results()) {
$DB->query("
if (!$DB->has_results()) {
$DB->query("
INSERT INTO artists_similar_votes (SimilarID, UserID, way)
VALUES ('$SimilarID', '$UserID', 'up')");
}
}
$Cache->delete_value("artist_$Artist1ID"); // Delete artist cache
$Cache->delete_value("artist_$Artist2ID"); // Delete artist cache
$Cache->delete_value("similar_positions_$Artist1ID"); // Delete artist's similar map cache
$Cache->delete_value("similar_positions_$Artist2ID"); // Delete artist's similar map cache
$Cache->delete_value("artist_$Artist1ID"); // Delete artist cache
$Cache->delete_value("artist_$Artist2ID"); // Delete artist cache
$Cache->delete_value("similar_positions_$Artist1ID"); // Delete artist's similar map cache
$Cache->delete_value("similar_positions_$Artist2ID"); // Delete artist's similar map cache
}
$Location = (empty($_SERVER['HTTP_REFERER'])) ? "artist.php?id={$Artist1ID}" : $_SERVER['HTTP_REFERER'];
+349 -346
View File
@@ -361,50 +361,49 @@ View::show_header($ArtistHeaderName, 'browse,bbcode,comments,voting,recommend,su
</div>
</div>
</div>
</div>
<div class="LayoutMainSidebar">
<div class="Sidebar LayoutMainSidebar-sidebar">
<div class="SidebarItemSearch SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.box_search') ?></strong>
<div class="LayoutMainSidebar">
<div class="Sidebar LayoutMainSidebar-sidebar">
<div class="SidebarItemSearch SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.box_search') ?></strong>
</div>
<div class="SidebarItem-body Box-body">
<form class="FormOneLine FormSearchFileLists" name="filelists" action="torrents.php">
<input type="hidden" name="artistname" value="<?= $Name ?>" />
<input type="hidden" name="action" value="advanced" />
<input class="Input" type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
<input class="Button" type="submit" value="&gt;" />
</form>
</div>
</div>
<div class="SidebarItem-body Box-body">
<form class="FormOneLine FormSearchFileLists" name="filelists" action="torrents.php">
<input type="hidden" name="artistname" value="<?= $Name ?>" />
<input type="hidden" name="action" value="advanced" />
<input class="Input" type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
<input class="Button" type="submit" value="&gt;" />
</form>
<div class="SidebarItemTags SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.tag') ?></strong>
</div>
<ul class="Sidebar-list SidebarItem-body Box-body">
<? Tags::format_top(50, 'torrents.php?action=advanced&taglist=', $Name, "Sidebar-item"); ?>
</ul>
</div>
</div>
<div class="SidebarItemTags SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.tag') ?></strong>
<?
// Stats
?>
<div class="SidebarItemStats SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.statistics') ?></strong>
</div>
<ul class="Sidebar-list SidebarItem-body Box-body">
<li class="Sidebar-item"><?= t('server.artist.number_of_groups') ?>: <?= number_format($NumGroups) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_torrents') ?>: <?= number_format($NumTorrents) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_seeders') ?>: <?= number_format($NumSeeders) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_leechers') ?>: <?= number_format($NumLeechers) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_snatches') ?>: <?= number_format($NumSnatches) ?></li>
</ul>
</div>
<ul class="Sidebar-list SidebarItem-body Box-body">
<? Tags::format_top(50, 'torrents.php?action=advanced&taglist=', $Name, "Sidebar-item"); ?>
</ul>
</div>
<?
// Stats
?>
<div class="SidebarItemStats SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.statistics') ?></strong>
</div>
<ul class="Sidebar-list SidebarItem-body Box-body">
<li class="Sidebar-item"><?= t('server.artist.number_of_groups') ?>: <?= number_format($NumGroups) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_torrents') ?>: <?= number_format($NumTorrents) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_seeders') ?>: <?= number_format($NumSeeders) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_leechers') ?>: <?= number_format($NumLeechers) ?></li>
<li class="Sidebar-item"><?= t('server.artist.number_of_snatches') ?>: <?= number_format($NumSnatches) ?></li>
</ul>
</div>
<?
<?
if (empty($SimilarArray)) {
$DB->query("
if (empty($SimilarArray)) {
$DB->query("
SELECT
s2.ArtistID,
a.Name,
@@ -419,351 +418,355 @@ View::show_header($ArtistHeaderName, 'browse,bbcode,comments,voting,recommend,su
ORDER BY ass.Score DESC
LIMIT 30
");
$SimilarArray = $DB->to_array();
$NumSimilar = count($SimilarArray);
}
?>
<div class="SidbarItemArtists SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.similarartist') ?></strong>
</div>
<ul class="SidebarList SidebarItem-body Box-body">
<? if ($NumSimilar == 0) { ?>
<li class="SidebarList-item"><span style="font-style: italic;"><?= t('server.artist.similarartist_note') ?></span></li>
<?
}
$First = true;
foreach ($SimilarArray as $SimilarArtist) {
list($Artist2ID, $Artist2Name, $Artist2SubName, $Score, $SimilarID) = $SimilarArtist;
$Score = $Score / 100;
if ($First) {
$Max = $Score + 1;
$First = false;
$SimilarArray = $DB->to_array();
$NumSimilar = count($SimilarArray);
}
?>
<div class="SidbarItemArtists SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.similarartist') ?></strong>
</div>
<ul class="SidebarList SidebarItem-body Box-body">
<? if ($NumSimilar == 0) { ?>
<li class="SidebarList-item"><span style="font-style: italic;"><?= t('server.artist.similarartist_note') ?></span></li>
<?
}
$First = true;
foreach ($SimilarArray as $SimilarArtist) {
list($Artist2ID, $Artist2Name, $Artist2SubName, $Score, $SimilarID) = $SimilarArtist;
$Score = $Score / 100;
if ($First) {
$Max = $Score + 1;
$First = false;
}
$FontSize = (ceil(((($Score - 2) / $Max - 2) * 4))) + 8;
$ArtistDisplayName = Artists::display_artist(['Name' => $Artist2Name, 'SubName' => $Artist2SubName, 'ArtistID' => $Artist2ID])
$FontSize = (ceil(((($Score - 2) / $Max - 2) * 4))) + 8;
$ArtistDisplayName = Artists::display_artist(['Name' => $Artist2Name, 'SubName' => $Artist2SubName, 'ArtistID' => $Artist2ID])
?>
<li class="SidebarList-item u-hoverToShow-hover">
<span data-tooltip="<?= $Score ?>"><?= $ArtistDisplayName ?></span>
<div class="SidebarList-actions">
<? if (check_perms('site_delete_tag')) { ?>
<a class="SidebarList-action u-hoverToShow-hide remove remove_artist" href="artist.php?action=delete_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;auth=<?= $LoggedUser['AuthKey'] ?>" class="brackets" data-tooltip="<?= t('server.artist.remove_similar_artist_title') ?>">
<?= icon('remove') ?>
?>
<li class="SidebarList-item u-hoverToShow-hover">
<span data-tooltip="<?= $Score ?>"><?= $ArtistDisplayName ?></span>
<div class="SidebarList-actions">
<? if (check_perms('site_delete_tag')) { ?>
<a class="SidebarList-action u-hoverToShow-hide remove remove_artist" href="artist.php?action=delete_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;auth=<?= $LoggedUser['AuthKey'] ?>" class="brackets" data-tooltip="<?= t('server.artist.remove_similar_artist_title') ?>">
<?= icon('remove') ?>
</a>
<? } ?>
<a href=" artist.php?action=vote_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;way=up" class="SidebarList-action brackets vote_artist_up" data-tooltip="<?= t('server.artist.vote_up_similar_artist_title') ?>">
<?= icon('vote-up') ?>
</a>
<? } ?>
<a href=" artist.php?action=vote_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;way=up" class="SidebarList-action brackets vote_artist_up" data-tooltip="<?= t('server.artist.vote_up_similar_artist_title') ?>">
<?= icon('vote-up') ?>
</a>
<a href="artist.php?action=vote_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;way=down" class="SidebarList-action brackets vote_artist_down" data-tooltip="<?= t('server.artist.vote_down_similar_artist_title') ?>">
<?= icon('vote-down') ?>
</a>
<a href="artist.php?action=vote_similar&amp;artistid=<?= $ArtistID ?>&amp;similarid=<?= $SimilarID ?>&amp;way=down" class="SidebarList-action brackets vote_artist_down" data-tooltip="<?= t('server.artist.vote_down_similar_artist_title') ?>">
<?= icon('vote-down') ?>
</a>
</div>
<br style="clear: both;" />
</li>
<? } ?>
</ul>
</div>
<div class="SidebarItemArtistAdd SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.add_similarartist') ?></strong>
</div>
<div class="SidebarItem-body Box-body">
<form class="FormAddSimilarArtist" name="similar_artists" action="artist.php" method="post">
<input type="hidden" name="action" value="add_similar" />
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
<input type="hidden" name="artistid" value="<?= $ArtistID ?>" />
<div class="Form-row FormOneLine">
<input class="Input" type="text" placeholder="<?= t('server.artist.search_auto_fill') ?>" autocomplete="off" id="artistsimilar" size="20" <? Users::has_autocomplete_enabled('other'); ?> />
</div>
<br style="clear: both;" />
</li>
<? } ?>
</ul>
</div>
<div class="SidebarItemArtistAdd SidebarItem Box">
<div class="SidebarItem-header Box-header">
<strong><?= t('server.artist.add_similarartist') ?></strong>
</div>
<div class="SidebarItem-body Box-body">
<form class="FormAddSimilarArtist" name="similar_artists" action="artist.php" method="post">
<input type="hidden" name="action" value="add_similar" />
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
<input type="hidden" name="artistid" value="<?= $ArtistID ?>" />
<div class="Form-row FormOneLine">
<input class="Input" type="text" placeholder="<?= t('server.artist.search_auto_fill') ?>" autocomplete="off" id="artistsimilar" size="20" <? Users::has_autocomplete_enabled('other'); ?> />
</div>
<div class="Form-row FormOneLine">
<input type="text" placeholder=" <?= t('server.artist.artist_id') ?>" class="Input" id="similar_artistid" name="similar_artistid" />
<input class="Button" type="submit" value="+" />
</div>
</form>
<div class="Form-row FormOneLine">
<input type="text" placeholder=" <?= t('server.artist.artist_id') ?>" class="Input" id="similar_artistid" name="similar_artistid" />
<input class="Button" type="submit" value="+" />
</div>
</form>
</div>
</div>
</div>
</div>
<div class="LayoutMainSidebar-main">
<?
<div class="LayoutMainSidebar-main">
<?
echo $TorrentDisplayList;
echo $TorrentDisplayList;
$Collages = $Cache->get_value("artists_collages_$ArtistID");
if (!is_array($Collages)) {
$DB->query("
$Collages = $Cache->get_value("artists_collages_$ArtistID");
if (!is_array($Collages)) {
$DB->query("
SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c
JOIN collages_artists AS ca ON ca.CollageID = c.ID
WHERE ca.ArtistID = '$ArtistID'
AND Deleted = '0'
AND CategoryID = '7'");
$Collages = $DB->to_array();
$Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
}
if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0, count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
$SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').gtoggle(); return false;">(' . t('server.common.see_full') . ')</a>';
} else {
$Indices = range(0, count($Collages) - 1);
$SeeAll = '';
$Collages = $DB->to_array();
$Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
}
?>
<table class="TableCollage Table" id="collages">
<tr class="Table-rowHeader">
<td class="Table-cell" width="85%">This artist is in <?= number_format(count($Collages)) ?> collage<?= ((count($Collages) > 1) ? 's' : '') ?><?= $SeeAll ?></td>
<td class="Table-cell"># artists</td>
</tr>
<?
foreach ($Indices as $i) {
list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
unset($Collages[$i]);
?>
<tr class="Table-row">
<td class="Table-cell"><a href="collages.php?id=<?= $CollageID ?>"><?= $CollageName ?></a></td>
<td class="Table-cell"><?= number_format($CollageArtists) ?></td>
</tr>
<?
if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0, count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
$SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').gtoggle(); return false;">(' . t('server.common.see_full') . ')</a>';
} else {
$Indices = range(0, count($Collages) - 1);
$SeeAll = '';
}
foreach ($Collages as $Collage) {
list($CollageName, $CollageArtists, $CollageID) = $Collage;
?>
<tr class="Table-row hidden">
<td class="Table-cell"><a href="collages.php?id=<?= $CollageID ?>"><?= $CollageName ?></a></td>
<td class="Table-cell"><?= number_format($CollageArtists) ?></td>
?>
<table class="TableCollage Table" id="collages">
<tr class="Table-rowHeader">
<td class="Table-cell" width="85%">This artist is in <?= number_format(count($Collages)) ?> collage<?= ((count($Collages) > 1) ? 's' : '') ?><?= $SeeAll ?></td>
<td class="Table-cell"># artists</td>
</tr>
<? } ?>
</table>
<?
}
<?
foreach ($Indices as $i) {
list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
unset($Collages[$i]);
?>
<tr class="Table-row">
<td class="Table-cell"><a href="collages.php?id=<?= $CollageID ?>"><?= $CollageName ?></a></td>
<td class="Table-cell"><?= number_format($CollageArtists) ?></td>
</tr>
<?
}
foreach ($Collages as $Collage) {
list($CollageName, $CollageArtists, $CollageID) = $Collage;
?>
<tr class="Table-row hidden">
<td class="Table-cell"><a href="collages.php?id=<?= $CollageID ?>"><?= $CollageName ?></a></td>
<td class="Table-cell"><?= number_format($CollageArtists) ?></td>
</tr>
<? } ?>
</table>
<?
}
if ($NumRequests > 0) {
if ($NumRequests > 0) {
?>
<div class="Group" id="requests">
<div class="Group-header">
<div class="Group-headerTitle">
<?= t('server.common.requests') ?>
?>
<div class="Group" id="requests">
<div class="Group-header">
<div class="Group-headerTitle">
<?= t('server.common.requests') ?>
</div>
</div>
</div>
<div class="Group-body">
<div class="TableContainer">
<table class="TableRequest Table" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr class="Table-rowHeader">
<td class="Table-cell">
<?= t('server.artist.request_name') ?>
</td>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.vote') ?>
</td>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.bounty') ?>
</td>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.added') ?>
</td>
</tr>
<?
foreach ($Requests as $Request) {
$RequestVotes = Requests::get_votes_array($Request['ID']);
$RequestID = $Request['ID'];
$RequestName = Torrents::group_name($Request, false);
$FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$RequestName</a>";
$Tags = $Request['Tags'];
?>
<tr class="Table-row">
<td class="TableRequest-cellName Table-cell">
<?= $FullName ?>
<div class="torrent_info">
<?
?>
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
</div>
<div class="Group-body">
<div class="TableContainer">
<table class="TableRequest Table" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr class="Table-rowHeader">
<td class="Table-cell">
<?= t('server.artist.request_name') ?>
</td>
<td class="TableRequest-cellVotes Table-cell TableRequest-cellValue">
<span id="vote_count_<?= $Request['ID'] ?>"><?= count($RequestVotes['Voters']) ?></span>
<? if (check_perms('site_vote')) { ?>
&nbsp;&nbsp; <a href="javascript:globalapp.requestVote(0, <?= $Request['ID'] ?>)" class="brackets">+</a>
<? } ?>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.vote') ?>
</td>
<td class="TableRequest-cellBounty Table-cell TableRequest-cellValue">
<?= Format::get_size($RequestVotes['TotalBounty']) ?>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.bounty') ?>
</td>
<td class="TableRequest-cellCreatedAt TableRequest-cellValue Table-cell">
<?= time_diff($Request['TimeAdded'], 1) ?>
<td class="Table-cell TableRequest-cellValue">
<?= t('server.artist.added') ?>
</td>
</tr>
<? } ?>
</table>
<?
foreach ($Requests as $Request) {
$RequestVotes = Requests::get_votes_array($Request['ID']);
$RequestID = $Request['ID'];
$RequestName = Torrents::group_name($Request, false);
$FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$RequestName</a>";
$Tags = $Request['Tags'];
?>
<tr class="Table-row">
<td class="TableRequest-cellName Table-cell">
<?= $FullName ?>
<div class="torrent_info">
<?
?>
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
</div>
</td>
<td class="TableRequest-cellVotes Table-cell TableRequest-cellValue">
<span id="vote_count_<?= $Request['ID'] ?>"><?= count($RequestVotes['Voters']) ?></span>
<? if (check_perms('site_vote')) { ?>
&nbsp;&nbsp; <a href="javascript:globalapp.requestVote(0, <?= $Request['ID'] ?>)" class="brackets">+</a>
<? } ?>
</td>
<td class="TableRequest-cellBounty Table-cell TableRequest-cellValue">
<?= Format::get_size($RequestVotes['TotalBounty']) ?>
</td>
<td class="TableRequest-cellCreatedAt TableRequest-cellValue Table-cell">
<?= time_diff($Request['TimeAdded'], 1) ?>
</td>
</tr>
<? } ?>
</table>
</div>
</div>
</div>
</div>
<?
}
?>
<?
}
?>
<?
foreach ($TorrentGroups as $ReleaseType => $GroupInfo) {
$DisplayName = sectionTitle($ReleaseType);
?>
<?
foreach ($TorrentGroups as $ReleaseType => $GroupInfo) {
$DisplayName = sectionTitle($ReleaseType);
?>
<div class="Group">
<div class="Group-header">
<div class="Group-headerTitle">
<div id="torrents_<?= $ReleaseType ?>">
<?= $DisplayName ?>
</div>
</div>
<div class="Group-headerActions">
<a href="#" onclick="globalapp.toggleAny(event, '.torrent_table_<?= $ReleaseType ?>');return false;">
<span class="u-toggleAny-show u-hidden"><?= t('server.common.show') ?></span>
<span class="u-toggleAny-hide"><?= t('server.common.hide') ?></span>
</a>
</div>
</div>
<div class="Group-body torrent_table_<?= $ReleaseType ?>" id="torrent_table_<?= $ID ?>">
<?
$tableRender = new TorrentGroupCoverTableView($GroupInfo);
$tableRender->render();
?>
</div>
</div>
<?
}
// Similar Artist Map
if ($NumSimilar > 0) {
if ($SimilarData = $Cache->get_value("similar_positions_$ArtistID")) {
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->load_data($SimilarData);
if (!(current($Similar->Artists)->NameLength)) {
unset($Similar);
}
}
if (empty($Similar) || empty($Similar->Artists)) {
include(CONFIG['SERVER_ROOT'] . '/classes/image.class.php');
$Img = new IMAGE;
$Img->create(WIDTH, HEIGHT);
$Img->color(255, 255, 255, 127);
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->set_up();
$Similar->set_positions();
$Similar->background_image();
$SimilarData = $Similar->dump_data();
$Cache->cache_value("similar_positions_$ArtistID", $SimilarData, 3600 * 24);
}
if (false) {
?>
<div id="similar_artist_map" class="box">
<div id="flipper_head" class="head">
<strong id="flipper_title"><?= t('server.artist.similar_artist_map') ?></strong>
<a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;"><?= t('server.artist.switch_to_cloud') ?></a>
</div>
<div id="flip_view_1" style="display: block; width: 100%; height: <?= (HEIGHT) ?>px; position: relative; background-image: url(static/similar/<?= ($ArtistID) ?>.png?t=<?= (time()) ?>);">
<?
$Similar->write_artists();
?>
</div>
<div id="flip_view_2" style="display: none; width: <?= WIDTH ?>px; height: <?= HEIGHT ?>px;">
<canvas width="<?= WIDTH ?>px" height="<?= (HEIGHT - 20) ?>px" id="similarArtistsCanvas"></canvas>
<div id="artistTags" style="display: none;">
<ul>
<li></li>
</ul>
</div>
<strong style="margin-left: 10px;"><a id="currentArtist" href="#null"><?= t('server.artist.loading') ?></a></strong>
</div>
</div>
<?
}
?>
<script type="text/javascript">
//<![CDATA[
var cloudLoaded = false;
function flipView() {
var state = document.getElementById('flip_view_1').style.display == 'block';
if (state) {
document.getElementById('flip_view_1').style.display = 'none';
document.getElementById('flip_view_2').style.display = 'block';
document.getElementById('flipper_title').innerHTML = '<?= t('server.artist.similar_artist_cloud') ?>';
document.getElementById('flip_to').innerHTML = '<?= t('server.artist.switch_to_map') ?>';
if (!cloudLoaded) {
require("static/functions/tagcanvas.js", function() {
require("static/functions/artist_cloud.js", function() {});
});
cloudLoaded = true;
}
} else {
document.getElementById('flip_view_1').style.display = 'block';
document.getElementById('flip_view_2').style.display = 'none';
document.getElementById('flipper_title').innerHTML = '<?= t('server.artist.similar_artist_map') ?>';
document.getElementById('flip_to').innerHTML = '<?= t('server.artist.switch_to_cloud') ?>';
}
}
//TODO move this to global, perhaps it will be used elsewhere in the future
//http://stackoverflow.com/questions/7293344/load-javascript-dynamically
function require(file, callback) {
var script = document.getElementsByTagName('script')[0],
newjs = document.createElement('script');
// IE
newjs.onreadystatechange = function() {
if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
newjs.onreadystatechange = null;
callback();
}
};
// others
newjs.onload = function() {
callback();
};
newjs.src = file;
script.parentNode.insertBefore(newjs, script);
}
//]]>
</script>
<? } /* if $NumSimilar > 0 */ ?>
<?
// --- Comments ---
$Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAGE'], 9, '#comments');
?>
<div class="Group">
<div class="Group-header">
<div class="Group-headerTitle">
<div id="torrents_<?= $ReleaseType ?>">
<?= $DisplayName ?>
</div>
</div>
<div class="Group-headerActions">
<a href="#" onclick="globalapp.toggleAny(event, '.torrent_table_<?= $ReleaseType ?>');return false;">
<span class="u-toggleAny-show u-hidden"><?= t('server.common.show') ?></span>
<span class="u-toggleAny-hide"><?= t('server.common.hide') ?></span>
</a>
<?= t('server.artist.artistcomments') ?>
</div>
</div>
<div class="Group-body torrent_table_<?= $ReleaseType ?>" id="torrent_table_<?= $ID ?>">
<div id="artistcomments" class="Group-body">
<? View::pages($Pages) ?>
<?
$tableRender = new TorrentGroupCoverTableView($GroupInfo);
$tableRender->render();
//---------- Begin printing
CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
?>
<? View::pages($Pages) ?>
<?
View::parse('generic/reply/quickreply.php', array(
'InputName' => 'pageid',
'InputID' => $ArtistID,
'Action' => 'comments.php?page=artist',
'InputAction' => 'take_post',
'SubscribeBox' => true
));
?>
</div>
</div>
<?
}
// Similar Artist Map
if ($NumSimilar > 0) {
if ($SimilarData = $Cache->get_value("similar_positions_$ArtistID")) {
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->load_data($SimilarData);
if (!(current($Similar->Artists)->NameLength)) {
unset($Similar);
}
}
if (empty($Similar) || empty($Similar->Artists)) {
include(CONFIG['SERVER_ROOT'] . '/classes/image.class.php');
$Img = new IMAGE;
$Img->create(WIDTH, HEIGHT);
$Img->color(255, 255, 255, 127);
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->set_up();
$Similar->set_positions();
$Similar->background_image();
$SimilarData = $Similar->dump_data();
$Cache->cache_value("similar_positions_$ArtistID", $SimilarData, 3600 * 24);
}
if (false) {
?>
<div id="similar_artist_map" class="box">
<div id="flipper_head" class="head">
<strong id="flipper_title"><?= t('server.artist.similar_artist_map') ?></strong>
<a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;"><?= t('server.artist.switch_to_cloud') ?></a>
</div>
<div id="flip_view_1" style="display: block; width: 100%; height: <?= (HEIGHT) ?>px; position: relative; background-image: url(static/similar/<?= ($ArtistID) ?>.png?t=<?= (time()) ?>);">
<?
$Similar->write_artists();
?>
</div>
<div id="flip_view_2" style="display: none; width: <?= WIDTH ?>px; height: <?= HEIGHT ?>px;">
<canvas width="<?= WIDTH ?>px" height="<?= (HEIGHT - 20) ?>px" id="similarArtistsCanvas"></canvas>
<div id="artistTags" style="display: none;">
<ul>
<li></li>
</ul>
</div>
<strong style="margin-left: 10px;"><a id="currentArtist" href="#null"><?= t('server.artist.loading') ?></a></strong>
</div>
</div>
<?
}
?>
<script type="text/javascript">
//<![CDATA[
var cloudLoaded = false;
function flipView() {
var state = document.getElementById('flip_view_1').style.display == 'block';
if (state) {
document.getElementById('flip_view_1').style.display = 'none';
document.getElementById('flip_view_2').style.display = 'block';
document.getElementById('flipper_title').innerHTML = '<?= t('server.artist.similar_artist_cloud') ?>';
document.getElementById('flip_to').innerHTML = '<?= t('server.artist.switch_to_map') ?>';
if (!cloudLoaded) {
require("static/functions/tagcanvas.js", function() {
require("static/functions/artist_cloud.js", function() {});
});
cloudLoaded = true;
}
} else {
document.getElementById('flip_view_1').style.display = 'block';
document.getElementById('flip_view_2').style.display = 'none';
document.getElementById('flipper_title').innerHTML = '<?= t('server.artist.similar_artist_map') ?>';
document.getElementById('flip_to').innerHTML = '<?= t('server.artist.switch_to_cloud') ?>';
}
}
//TODO move this to global, perhaps it will be used elsewhere in the future
//http://stackoverflow.com/questions/7293344/load-javascript-dynamically
function require(file, callback) {
var script = document.getElementsByTagName('script')[0],
newjs = document.createElement('script');
// IE
newjs.onreadystatechange = function() {
if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
newjs.onreadystatechange = null;
callback();
}
};
// others
newjs.onload = function() {
callback();
};
newjs.src = file;
script.parentNode.insertBefore(newjs, script);
}
//]]>
</script>
<? } /* if $NumSimilar > 0 */ ?>
<?
// --- Comments ---
$Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAGE'], 9, '#comments');
?>
<div id="artistcomments">
<div class="BodyNavLinks"><a name="comments"></a>
<?= ($Pages) ?>
</div>
<?
//---------- Begin printing
CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
?>
<div class="BodyNavLinks">
<?= ($Pages) ?>
</div>
<?
View::parse('generic/reply/quickreply.php', array(
'InputName' => 'pageid',
'InputID' => $ArtistID,
'Action' => 'comments.php?page=artist',
'InputAction' => 'take_post',
'SubscribeBox' => true
));
?>
</div>
</div>
</div>
+8 -8
View File
@@ -1,13 +1,13 @@
<?php
authorize();
if (!check_perms('torrents_edit')) {
error(403);
error(403);
}
$AliasID = $_GET['aliasid'];
if (!is_number($AliasID)) {
error(0);
error(0);
}
$DB->query("
@@ -17,8 +17,8 @@ $DB->query("
WHERE aa.AliasID=" . $AliasID);
if ($DB->record_count() === 1) {
//This is the last alias on the artist
error("That alias is the last alias for that artist; removing it would cause bad things to happen.");
//This is the last alias on the artist
error("That alias is the last alias for that artist; removing it would cause bad things to happen.");
}
$DB->query("
@@ -26,10 +26,10 @@ $DB->query("
FROM torrents_artists
WHERE AliasID='$AliasID'");
if ($DB->has_results()) {
list($GroupID) = $DB->next_record();
if ($GroupID != 0) {
error("That alias still has the group (<a href=\"torrents.php?id=$GroupID\">$GroupID</a>) attached. Fix that first.");
}
list($GroupID) = $DB->next_record();
if ($GroupID != 0) {
error("That alias still has the group (<a href=\"torrents.php?id=$GroupID\">$GroupID</a>) attached. Fix that first.");
}
}
$DB->query("
+5 -5
View File
@@ -4,10 +4,10 @@ $SimilarID = db_string($_GET['similarid']);
$PrimaryArtistID = intval($_GET['artistid']);
if (!is_number($SimilarID) || !$SimilarID) {
error(404);
error(404);
}
if (!check_perms('site_delete_tag')) {
error(403);
error(403);
}
$DB->query("
SELECT ArtistID
@@ -25,9 +25,9 @@ $DB->query("
WHERE SimilarID = '$SimilarID'");
foreach ($ArtistIDs as $ArtistID) {
list($ArtistID) = $ArtistID;
$Cache->delete_value("artist_$ArtistID"); // Delete artist cache
$Cache->delete_value("similar_positions_$ArtistID");
list($ArtistID) = $ArtistID;
$Cache->delete_value("artist_$ArtistID"); // Delete artist cache
$Cache->delete_value("similar_positions_$ArtistID");
}
$Location = (empty($_SERVER['HTTP_REFERER'])) ? "artist.php?id={$PrimaryArtistID}" : $_SERVER['HTTP_REFERER'];
+15 -15
View File
@@ -1,11 +1,11 @@
<?php
authorize();
if (!check_perms('site_torrents_notify')) {
error(403);
error(403);
}
$ArtistID = $_GET['artistid'];
if (!is_number($ArtistID)) {
error(0);
error(0);
}
$DB->query("
@@ -17,7 +17,7 @@ list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
$Notify = $Cache->get_value('notify_artists_' . $LoggedUser['ID']);
if (empty($Notify)) {
$DB->query("
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE Label = 'Artist notifications'
@@ -25,31 +25,31 @@ if (empty($Notify)) {
ORDER BY ID
LIMIT 1");
} else {
$DB->query("
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE ID = '$Notify[ID]'");
}
if (empty($Notify) && !$DB->has_results()) {
$DB->query("
$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']);
$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) {
$ArtistNames .= "$ArtistAliases|";
$DB->query("
list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, 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']);
$Cache->delete_value('notify_artists_' . $LoggedUser['ID']);
}
$Cache->delete_value('notify_filters_' . $LoggedUser['ID']);
$Cache->delete_value('notify_artists_' . $LoggedUser['ID']);
}
}
$Location = (empty($_SERVER['HTTP_REFERER'])) ? "artist.php?id={$ArtistID}" : $_SERVER['HTTP_REFERER'];
+9 -9
View File
@@ -1,15 +1,15 @@
<?
authorize();
if (!check_perms('site_torrents_notify')) {
error(403);
error(403);
}
$ArtistID = $_GET['artistid'];
if (!is_number($ArtistID)) {
error(0);
error(0);
}
if (($Notify = $Cache->get_value('notify_artists_' . $LoggedUser['ID'])) === false) {
$DB->query("
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE Label = 'Artist notifications'
@@ -17,7 +17,7 @@ if (($Notify = $Cache->get_value('notify_artists_' . $LoggedUser['ID'])) === fal
ORDER BY ID
LIMIT 1");
} else {
$DB->query("
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE ID = '$Notify[ID]'");
@@ -28,16 +28,16 @@ $DB->query("
FROM artists_alias
WHERE ArtistID = '$ArtistID'");
while (list($Alias) = $DB->next_record(MYSQLI_NUM, false)) {
while (stripos($Artists, "|$Alias|") !== false) {
$Artists = str_ireplace("|$Alias|", '|', $Artists);
}
while (stripos($Artists, "|$Alias|") !== false) {
$Artists = str_ireplace("|$Alias|", '|', $Artists);
}
}
if ($Artists == '|') {
$DB->query("
$DB->query("
DELETE FROM users_notify_filters
WHERE ID = $ID");
} else {
$DB->query("
$DB->query("
UPDATE users_notify_filters
SET Artists = '" . db_string($Artists) . "'
WHERE ID = '$ID'");
+60 -60
View File
@@ -1,74 +1,74 @@
<?
if (!check_perms('admin_manage_blog')) {
error(403);
error(403);
}
View::show_header(t('server.blog.create_a_blog_post'), 'bbcode', 'PageBlogHome');
$IsNew = empty($_GET['id']);
?>
<div class="LayoutBody">
<div class="BodyHeader">
<div class="BodyHeader-nav">
<?= t('server.index.blog_note') ?>
</div>
</div>
<?
$BlogID = 0;
$Title = '';
$Body = '';
$ThreadID = null;
if (!$IsNew) {
$BlogID = intval($_GET['id']);
$DB->prepared_query("
<div class="BodyHeader">
<div class="BodyHeader-nav">
<?= t('server.index.blog_note') ?>
</div>
</div>
<?
$BlogID = 0;
$Title = '';
$Body = '';
$ThreadID = null;
if (!$IsNew) {
$BlogID = intval($_GET['id']);
$DB->prepared_query("
SELECT Title, Body, ThreadID
FROM blog
WHERE ID = ?", $BlogID);
list($Title, $Body, $ThreadID) = $DB->fetch_record(0, 1);
$ThreadID = $ThreadID ?? 0;
}
?>
list($Title, $Body, $ThreadID) = $DB->fetch_record(0, 1);
$ThreadID = $ThreadID ?? 0;
}
?>
<form class="Form BlogCreate <?= $IsNew ? 'create_form' : 'edit_form' ?>" name="blog_post" action="blog.php" method="post">
<input type="hidden" name="action" value="<?= $IsNew ? 'takenewblog' : 'takeeditblog' ?>" />
<input type="hidden" name="auth" value="<?= G::$LoggedUser['AuthKey'] ?>" />
<? if (!$IsNew) { ?>
<input type="hidden" name="blogid" value="<?= $BlogID; ?>" />
<? } ?>
<div class="Form-rowList" variant="header" id="blog_create_edit_box">
<div class="Form-rowHeader">
<div class="Form-title">
<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post') ?>
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.title') ?></div>
<div class="Form-inputs">
<input class="Input" type="text" name="title" size="95" <?= !empty($Title) ? ' value="' . display_str($Title) . '"' : ''; ?> />
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.body') ?></div>
<div class="Form-items">
<?php new TEXTAREA_PREVIEW('body', 'blog_content', display_str($Body), 60, 8, true, true, false); ?>
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.thread_id') ?></div>
<div class="Form-inputs">
<input class="Input is-small" type="text" name="thread" size="8" <?= $ThreadID !== null ? ' value="' . display_str($ThreadID) . '"' : ''; ?> /><?= t('server.blog.thread_id_note') ?>
</div>
</div>
<div class="Form-row">
<div>
<input type="checkbox" value="1" name="important" id="important" checked="checked" /><label for="important"><?= t('server.blog.important') ?></label>
</div>
<div>
<input id="subscribebox" type="checkbox" name="subscribe" <?= !empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''; ?> tabindex="2" />
<label for="subscribebox"><?= t('server.common.subscribe') ?></label>
</div>
<input class="Button" type="submit" value="<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post'); ?>" />
</div>
</div>
</form>
<form class="Form BlogCreate <?= $IsNew ? 'create_form' : 'edit_form' ?>" name="blog_post" action="blog.php" method="post">
<input type="hidden" name="action" value="<?= $IsNew ? 'takenewblog' : 'takeeditblog' ?>" />
<input type="hidden" name="auth" value="<?= G::$LoggedUser['AuthKey'] ?>" />
<? if (!$IsNew) { ?>
<input type="hidden" name="blogid" value="<?= $BlogID; ?>" />
<? } ?>
<div class="Form-rowList" variant="header" id="blog_create_edit_box">
<div class="Form-rowHeader">
<div class="Form-title">
<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post') ?>
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.title') ?></div>
<div class="Form-inputs">
<input class="Input" type="text" name="title" size="95" <?= !empty($Title) ? ' value="' . display_str($Title) . '"' : ''; ?> />
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.body') ?></div>
<div class="Form-items">
<?php new TEXTAREA_PREVIEW('body', 'blog_content', display_str($Body), 60, 8, true, true, false); ?>
</div>
</div>
<div class="Form-row">
<div class="Form-label"><?= t('server.blog.thread_id') ?></div>
<div class="Form-inputs">
<input class="Input is-small" type="text" name="thread" size="8" <?= $ThreadID !== null ? ' value="' . display_str($ThreadID) . '"' : ''; ?> /><?= t('server.blog.thread_id_note') ?>
</div>
</div>
<div class="Form-row">
<div>
<input type="checkbox" value="1" name="important" id="important" checked="checked" /><label for="important"><?= t('server.blog.important') ?></label>
</div>
<div>
<input id="subscribebox" type="checkbox" name="subscribe" <?= !empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''; ?> tabindex="2" />
<label for="subscribebox"><?= t('server.common.subscribe') ?></label>
</div>
<input class="Button" type="submit" value="<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post'); ?>" />
</div>
</div>
</form>
</div>
<?php
View::show_footer();
+12 -12
View File
@@ -3,7 +3,7 @@ authorize();
$CollageID = $_POST['collageid'];
if (!is_number($CollageID) || !$CollageID) {
error(404);
error(404);
}
$DB->query("
@@ -13,12 +13,12 @@ $DB->query("
list($Name, $CategoryID, $UserID) = $DB->next_record(MYSQLI_NUM, false);
if (!check_perms('site_collages_delete') && $UserID !== $LoggedUser['ID']) {
error(403);
error(403);
}
$Reason = trim($_POST['reason']);
if (!$Reason) {
error('You must enter a reason!');
error('You must enter a reason!');
}
$DB->query("
@@ -26,26 +26,26 @@ $DB->query("
FROM collages_torrents
WHERE CollageID = '$CollageID'");
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value("torrents_details_$GroupID");
$Cache->delete_value("torrent_collages_$GroupID");
$Cache->delete_value("torrent_collages_personal_$GroupID");
$Cache->delete_value("torrents_details_$GroupID");
$Cache->delete_value("torrent_collages_$GroupID");
$Cache->delete_value("torrent_collages_personal_$GroupID");
}
if ($CategoryID == $PersonalCollageCategoryCat) {
$DB->query("
$DB->query("
DELETE FROM collages
WHERE ID = '$CollageID'");
$DB->query("
$DB->query("
DELETE FROM collages_torrents
WHERE CollageID = '$CollageID'");
Comments::delete_page('collages', $CollageID);
Comments::delete_page('collages', $CollageID);
} else {
$DB->query("
$DB->query("
UPDATE collages
SET Deleted = '1'
WHERE ID = '$CollageID'");
Subscriptions::flush_subscriptions('collages', $CollageID);
Subscriptions::flush_quote_notifications('collages', $CollageID);
Subscriptions::flush_subscriptions('collages', $CollageID);
Subscriptions::flush_quote_notifications('collages', $CollageID);
}
Misc::write_log("Collage $CollageID ($Name) was deleted by " . $LoggedUser['Username'] . ": $Reason");
+21 -18
View File
@@ -302,26 +302,29 @@ View::show_header($Name, 'browse,collage,bbcode,voting,recommend', 'PageCollageT
?>
</div>
</div>
<div class="u-vstack" id="torrent_comments">
<div class="BodyNavLinks"><a name="comments"></a>
<?= $Pages ?>
<div class="Group">
<div class="Group-header">
<div class="Group-headerTitle">
<?= t('server.collages.comments') ?>
</div>
</div>
<?
CommentsView::render_comments($Thread, $LastRead, "collages.php?id=$CollageID");
?>
<div class="BodyNavLinks">
<?= $Pages ?>
<div class="Group-body" id="torrent_comments">
<? View::pages($Pages) ?>
<?
CommentsView::render_comments($Thread, $LastRead, "collages.php?id=$CollageID");
?>
<? View::pages($Pages) ?>
<?
View::parse('generic/reply/quickreply.php', array(
'InputName' => 'pageid',
'InputID' => $CollageID,
'Action' => 'comments.php?page=collages',
'InputAction' => 'take_post',
'TextareaCols' => 65,
'SubscribeBox' => true
));
?>
</div>
<?
View::parse('generic/reply/quickreply.php', array(
'InputName' => 'pageid',
'InputID' => $CollageID,
'Action' => 'comments.php?page=collages',
'InputAction' => 'take_post',
'TextareaCols' => 65,
'SubscribeBox' => true
));
?>
</div>
</div>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
enforce_login();
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
error(0);
error(0);
}
$PostID = (int)$_GET['postid'];
+2 -2
View File
@@ -89,7 +89,7 @@ switch ($_GET['feed']) {
LEFT JOIN users_main AS um ON b.UserID = um.ID
ORDER BY Time DESC
LIMIT 20");
$Blog = $DB->to_array();
$Blog = $DB->to_array(false, MYSQLI_BOTH, false);
$Cache->cache_value('blog', $Blog, 1209600);
}
foreach ($Blog as $BlogItem) {
@@ -112,7 +112,7 @@ switch ($_GET['feed']) {
FROM changelog
ORDER BY Time DESC
LIMIT 20");
$Changelog = $DB->to_array();
$Changelog = $DB->to_array(false, MYSQLI_BOTH, false);
$Cache->cache_value('changelog', $Changelog, 3600);
}
foreach ($Changelog as $Change) {
+7 -7
View File
@@ -5,24 +5,24 @@ $ThreadID = $_POST['threadid'];
$NewOption = $_POST['new_option'];
if (!is_number($ThreadID)) {
error(404);
error(404);
}
if (!check_perms('site_moderate_forums')) {
$DB->query("
$DB->query("
SELECT ForumID
FROM forums_topics
WHERE ID = $ThreadID");
list($ForumID) = $DB->next_record();
if (!in_array($ForumID, $CONFIG['ForumsRevealVoters'])) {
error(403);
}
list($ForumID) = $DB->next_record();
if (!in_array($ForumID, $CONFIG['ForumsRevealVoters'])) {
error(403);
}
}
$DB->query("
SELECT Answers
FROM forums_polls
WHERE TopicID = $ThreadID");
if (!$DB->has_results()) {
error(404);
error(404);
}
list($Answers) = $DB->next_record(MYSQLI_NUM, false);
+7 -7
View File
@@ -1,19 +1,19 @@
<?
authorize();
if (!isset($_GET['forumid']) || ($_GET['forumid'] != 'all' && !is_number($_GET['forumid']))) {
error(403);
error(403);
}
if ($_GET['forumid'] == 'all') {
$DB->query("
$DB->query("
UPDATE users_info
SET CatchupTime = NOW()
WHERE UserID = $LoggedUser[ID]");
$Cache->delete_value('user_info_' . $LoggedUser['ID']);
header('Location: forums.php');
$Cache->delete_value('user_info_' . $LoggedUser['ID']);
header('Location: forums.php');
} else {
// Insert a value for each topic
$DB->query("
// Insert a value for each topic
$DB->query("
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID
FROM forums_topics
@@ -22,5 +22,5 @@ if ($_GET['forumid'] == 'all') {
ON DUPLICATE KEY UPDATE
PostID = LastPostID");
header('Location: forums.php?action=viewforum&forumid=' . $_GET['forumid']);
header('Location: forums.php?action=viewforum&forumid=' . $_GET['forumid']);
}
+33 -33
View File
@@ -2,13 +2,13 @@
authorize();
// Quick SQL injection check
if (!isset($_GET['postid']) || !is_number($_GET['postid'])) {
error(0);
error(0);
}
$PostID = $_GET['postid'];
// Make sure they are moderators
if (!check_perms('site_admin_forums')) {
error(403);
error(403);
}
// Get topic ID, forum ID, number of pages
@@ -29,8 +29,8 @@ $DB->query("
GROUP BY t.ID");
list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record();
if (!$TopicID) {
// Post is deleted or thread doesn't exist
error(0); // This is evil, but the ajax call doesn't check the response
// Post is deleted or thread doesn't exist
error(0); // This is evil, but the ajax call doesn't check the response
}
// $Pages = number of pages in the thread
@@ -54,20 +54,20 @@ $DB->query("
AND t.ID = '$TopicID'");
if ($LastID < $PostID) { // Last post in a topic was removed
$DB->query("
$DB->query("
SELECT p.AuthorID, u.Username, p.AddedTime
FROM forums_posts AS p
LEFT JOIN users_main AS u ON u.ID = p.AuthorID
WHERE p.ID = '$LastID'");
list($LastAuthorID, $LastAuthorName, $LastTime) = $DB->next_record();
$DB->query("
list($LastAuthorID, $LastAuthorName, $LastTime) = $DB->next_record();
$DB->query("
UPDATE forums_topics
SET
LastPostID = '$LastID',
LastPostAuthorID = '$LastAuthorID',
LastPostTime = '$LastTime'
WHERE ID = '$TopicID'");
$DB->query("
$DB->query("
SELECT
t.ID,
t.Title,
@@ -81,10 +81,10 @@ if ($LastID < $PostID) { // Last post in a topic was removed
AND t.ID != '$TopicID'
ORDER BY LastPostID DESC
LIMIT 1");
list($LastTopicID, $LastTopicTitle, $LastTopicPostID, $LastTopicPostTime, $LastTopicAuthorID, $LastTopicAuthorName) = $DB->next_record(MYSQLI_BOTH, false);
list($LastTopicID, $LastTopicTitle, $LastTopicPostID, $LastTopicPostTime, $LastTopicAuthorID, $LastTopicAuthorName) = $DB->next_record(MYSQLI_BOTH, false);
if ($LastID < $LastTopicPostID) { // Topic is no longer the most recent in its forum
$DB->query("
if ($LastID < $LastTopicPostID) { // Topic is no longer the most recent in its forum
$DB->query("
UPDATE forums
SET
LastPostTopicID = '$LastTopicID',
@@ -93,16 +93,16 @@ if ($LastID < $PostID) { // Last post in a topic was removed
LastPostTime = '$LastTopicPostTime'
WHERE ID = '$ForumID'
AND LastPostTopicID = '$TopicID'");
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastTopicPostID,
'LastPostAuthorID' => $LastTopicAuthorID,
'LastPostTime' => $LastTopicPostTime,
'LastPostTopicID' => $LastTopicID,
'Title' => $LastTopicTitle
);
} else { // Topic is still the most recent in its forum
$DB->query("
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastTopicPostID,
'LastPostAuthorID' => $LastTopicAuthorID,
'LastPostTime' => $LastTopicPostTime,
'LastPostTopicID' => $LastTopicID,
'Title' => $LastTopicTitle
);
} else { // Topic is still the most recent in its forum
$DB->query("
UPDATE forums
SET
LastPostID = '$LastID',
@@ -110,21 +110,21 @@ if ($LastID < $PostID) { // Last post in a topic was removed
LastPostTime = '$LastTime'
WHERE ID = '$ForumID'
AND LastPostTopicID = '$TopicID'");
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastID,
'LastPostAuthorID' => $LastAuthorID,
'LastPostTime' => $LastTime
);
}
$UpdateArrayThread = array('Posts' => '-1', 'LastPostAuthorID' => $LastAuthorID, 'LastPostTime' => $LastTime);
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastID,
'LastPostAuthorID' => $LastAuthorID,
'LastPostTime' => $LastTime
);
}
$UpdateArrayThread = array('Posts' => '-1', 'LastPostAuthorID' => $LastAuthorID, 'LastPostTime' => $LastTime);
} else {
$UpdateArrayForums = array('NumPosts' => '-1');
$UpdateArrayThread = array('Posts' => '-1');
$UpdateArrayForums = array('NumPosts' => '-1');
$UpdateArrayThread = array('Posts' => '-1');
}
if ($StickyPostID == $PostID) {
$DB->query("
$DB->query("
UPDATE forums_topics
SET StickyPostID = 0
WHERE ID = $TopicID");
@@ -134,7 +134,7 @@ if ($StickyPostID == $PostID) {
$ThisCatalogue = floor((CONFIG['POSTS_PER_PAGE'] * $Page - CONFIG['POSTS_PER_PAGE']) / CONFIG['THREAD_CATALOGUE']);
$LastCatalogue = floor((CONFIG['POSTS_PER_PAGE'] * $Pages - CONFIG['POSTS_PER_PAGE']) / CONFIG['THREAD_CATALOGUE']);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete_value("thread_$TopicID" . "_catalogue_$i");
$Cache->delete_value("thread_$TopicID" . "_catalogue_$i");
}
$Cache->begin_transaction("thread_$TopicID" . '_info');
+2 -2
View File
@@ -13,7 +13,7 @@ $_GET['post'], which is the ID of the post.
// Quick SQL injection check
if (!$_GET['post'] || !is_number($_GET['post'])) {
error(0);
error(0);
}
// Variables for database input
@@ -31,7 +31,7 @@ list($Body, $ForumID) = $DB->next_record(MYSQLI_NUM);
// Is the user allowed to view the post?
if (!Forums::check_forumperm($ForumID)) {
error(0);
error(0);
}
// This gets sent to the browser, which echoes it wherever
+26 -26
View File
@@ -1,6 +1,6 @@
<?php
if (!check_perms('users_warn')) {
error(404);
error(404);
}
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'postid', 'userid'));
@@ -15,18 +15,18 @@ $SQLTime = sqltime();
$UserInfo = Users::user_info($UserID);
if ($UserInfo['Class'] > $LoggedUser['Class']) {
error(403);
error(403);
}
$URL = site_url() . "forums.php?action=viewthread&amp;postid=$PostID#post$PostID";
if ($WarningLength !== 'verbal') {
$Time = (int)$WarningLength * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - $Reason");
$WarnTime = time_plus($Time);
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . " for $URL\nReason: $Reason\n\n";
$Time = (int)$WarningLength * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - $Reason");
$WarnTime = time_plus($Time);
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . " for $URL\nReason: $Reason\n\n";
} else {
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL\nReason: $Reason\n\n";
Tools::update_user_notes($UserID, $AdminComment);
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL\nReason: $Reason\n\n";
Tools::update_user_notes($UserID, $AdminComment);
}
$DB->query("
@@ -70,30 +70,30 @@ $DB->query("
$CatalogueID = floor((CONFIG['POSTS_PER_PAGE'] * $Page - CONFIG['POSTS_PER_PAGE']) / CONFIG['THREAD_CATALOGUE']);
$Cache->begin_transaction("thread_$TopicID" . "_catalogue_$CatalogueID");
if ($Cache->MemcacheDBArray[$Key]['ID'] != $PostID) {
$Cache->cancel_transaction();
$Cache->delete_value("thread_$TopicID" . "_catalogue_$CatalogueID");
//just clear the cache for would be cache-screwer-uppers
$Cache->cancel_transaction();
$Cache->delete_value("thread_$TopicID" . "_catalogue_$CatalogueID");
//just clear the cache for would be cache-screwer-uppers
} else {
$Cache->update_row($Key, array(
'ID' => $Cache->MemcacheDBArray[$Key]['ID'],
'AuthorID' => $Cache->MemcacheDBArray[$Key]['AuthorID'],
'AddedTime' => $Cache->MemcacheDBArray[$Key]['AddedTime'],
'Body' => $Body, //Don't url decode.
'EditedUserID' => $LoggedUser['ID'],
'EditedTime' => $SQLTime,
'Username' => $LoggedUser['Username']
));
$Cache->commit_transaction(3600 * 24 * 5);
$Cache->update_row($Key, array(
'ID' => $Cache->MemcacheDBArray[$Key]['ID'],
'AuthorID' => $Cache->MemcacheDBArray[$Key]['AuthorID'],
'AddedTime' => $Cache->MemcacheDBArray[$Key]['AddedTime'],
'Body' => $Body, //Don't url decode.
'EditedUserID' => $LoggedUser['ID'],
'EditedTime' => $SQLTime,
'Username' => $LoggedUser['Username']
));
$Cache->commit_transaction(3600 * 24 * 5);
}
$ThreadInfo = Forums::get_thread_info($TopicID);
if ($ThreadInfo === null) {
error(404);
error(404);
}
if ($ThreadInfo['StickyPostID'] == $PostID) {
$ThreadInfo['StickyPost']['Body'] = $Body;
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];
$ThreadInfo['StickyPost']['EditedTime'] = $SQLTime;
$Cache->cache_value("thread_$TopicID" . '_info', $ThreadInfo, 0);
$ThreadInfo['StickyPost']['Body'] = $Body;
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];
$ThreadInfo['StickyPost']['EditedTime'] = $SQLTime;
$Cache->cache_value("thread_$TopicID" . '_info', $ThreadInfo, 0);
}
$DB->query("
+1 -1
View File
@@ -833,7 +833,7 @@ View::show_header($ThreadInfo['Title'] . ' &lt; ' . $Forums[$ForumID]['Name'] .
<input class="Input" type="text" id="input_comment_<?= $PostID ?>" maxlength=20 placeholder="<?= t('server.forums.comment_optional') ?>">
<button class="Button" id="button_<?= $PostID ?>"><?= check_perms('admin_send_bonus') ? t('server.forums.personal_reward') : t('server.forums.confirm') ?></button>
</div>
<? //}
<? //}
?>
</div> <? } ?>
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
authorize();
if (!is_number($_GET['friendid'])) {
error(404);
error(404);
}
$FriendID = db_string($_GET['friendid']);
@@ -11,7 +11,7 @@ $DB->query("
FROM users_main
WHERE ID = '$FriendID'");
if (!$DB->has_results()) {
error(404);
error(404);
}
$DB->query("

Some files were not shown because too many files have changed in this diff Show More