mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
custom field cancel file
This commit is contained in:
@@ -12,7 +12,6 @@ class Field
|
||||
const TYPE_CHECKBOX = 'checkbox';
|
||||
const TYPE_SELECT = 'select';
|
||||
const TYPE_IMAGE = 'image';
|
||||
const TYPE_FILE = 'file';
|
||||
|
||||
public static $types = [
|
||||
self::TYPE_TEXT => [
|
||||
@@ -45,11 +44,6 @@ class Field
|
||||
'has_option' => false,
|
||||
'is_value_multiple' => false,
|
||||
],
|
||||
self::TYPE_FILE => [
|
||||
'text' => 'file',
|
||||
'has_option' => false,
|
||||
'is_value_multiple' => false,
|
||||
],
|
||||
];
|
||||
|
||||
private $preparedTorrentCustomFieldValues = [];
|
||||
@@ -64,7 +58,6 @@ class Field
|
||||
self::TYPE_CHECKBOX => $lang_fields['field_type_checkbox'],
|
||||
self::TYPE_SELECT => $lang_fields['field_type_select'],
|
||||
self::TYPE_IMAGE => $lang_fields['field_type_image'],
|
||||
self::TYPE_FILE => $lang_fields['field_type_file'],
|
||||
];
|
||||
return $map[$type] ?? '';
|
||||
}
|
||||
@@ -367,8 +360,6 @@ HEAD;
|
||||
</script>
|
||||
JS;
|
||||
$html .= tr($row['label'], $y, 1);
|
||||
} elseif ($row['type'] == self::TYPE_FILE) {
|
||||
$html .= tr($row['label'], sprintf('<input type="file" name="%s" />', $name), 1);
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
@@ -451,7 +442,6 @@ JS;
|
||||
switch ($customFieldWithValue['type']) {
|
||||
case self::TYPE_TEXT:
|
||||
case self::TYPE_TEXTAREA:
|
||||
case self::TYPE_FILE:
|
||||
$result .= format_comment($fieldValue);
|
||||
break;
|
||||
case self::TYPE_IMAGE:
|
||||
|
||||
@@ -254,16 +254,18 @@ class Imdb
|
||||
|
||||
}
|
||||
|
||||
public function renderTorrentsPageAverageRating(int $imdbId)
|
||||
public function renderTorrentsPageAverageRating($imdbId)
|
||||
{
|
||||
$imdbId = parse_imdb_id($imdbId);
|
||||
if ($this->getCacheStatus($imdbId) != 1) {
|
||||
return '';
|
||||
if ($imdbId && $this->getCacheStatus($imdbId) == 1) {
|
||||
$movie = $this->getMovie($imdbId);
|
||||
$rating = $movie->rating();
|
||||
} else {
|
||||
$rating = 'N/A';
|
||||
}
|
||||
$movie = $this->getMovie($imdbId);
|
||||
|
||||
$site = 'imdb';
|
||||
$rating = $movie->rating();
|
||||
$result = '<td class="embedded" style="text-align: right; width: 40px;padding-right: 5px"><div style="display: flex;flex-direction: column">';
|
||||
$result = '<td class="embedded" style="text-align: right; width: 40px;padding: 4px"><div style="display: flex;flex-direction: column">';
|
||||
$result .= sprintf(
|
||||
'<div style="display: flex;align-content: center;justify-content: space-between;padding: 2px 0"><img src="%s" alt="%s" title="%s" style="max-width: 16px;max-height: 16px"/><span>%s</span></div>',
|
||||
'pic/imdb2.png', $site, $site, $rating
|
||||
|
||||
@@ -230,7 +230,7 @@ HTML;
|
||||
|
||||
public function renderTorrentsPageAverageRating(array $ptGenData)
|
||||
{
|
||||
$result = '<td class="embedded" style="text-align: right; width: 40px;padding-right: 5px"><div style="display: flex;flex-direction: column">';
|
||||
$result = '<td class="embedded" style="text-align: right; width: 40px;padding: 4px"><div style="display: flex;flex-direction: column">';
|
||||
$count = 1;
|
||||
foreach (self::$validSites as $site => $info) {
|
||||
$rating = $ptGenData[$site]['data']["{$site}_rating_average"] ?? '';
|
||||
|
||||
@@ -7,7 +7,7 @@ use Nexus\Database\DB;
|
||||
class Torrent
|
||||
{
|
||||
/**
|
||||
* get torrent seeching or downloading status, download progress for someone
|
||||
* get torrent seeding or leeching status, download progress of someone
|
||||
*
|
||||
* @param int $uid
|
||||
* @param array $torrentIdArr
|
||||
@@ -23,14 +23,14 @@ class Torrent
|
||||
$peerList = array_column($peerList,'to_go', 'torrent');
|
||||
//download progress, from snatched
|
||||
$sql = sprintf(
|
||||
"select snatched.finished, snatched.to_go, snatched.torrentid, torrents.size from snatched inner join torrents on snatched.torrentid = torrents.id where snatched.userid = %s and snatched.torrentid in (%s)",
|
||||
"select snatched.to_go, snatched.torrentid, torrents.size from snatched inner join torrents on snatched.torrentid = torrents.id where snatched.userid = %s and snatched.torrentid in (%s)",
|
||||
sqlesc($uid), $torrentIdStr
|
||||
);
|
||||
$snatchedList = [];
|
||||
$res = sql_query($sql);
|
||||
while ($row = mysql_fetch_assoc($res)) {
|
||||
$id = $row['torrentid'];
|
||||
$activeStatus = 'none';
|
||||
$activeStatus = 'inactivity';
|
||||
if (isset($peerList[$id])) {
|
||||
if ($peerList[$id]['to_go'] == 0) {
|
||||
$activeStatus = 'seeding';
|
||||
@@ -48,4 +48,21 @@ class Torrent
|
||||
}
|
||||
return $snatchedList;
|
||||
}
|
||||
|
||||
public function renderProgressBar($activeStatus, $progress)
|
||||
{
|
||||
$color = '#aaa';
|
||||
$title = $activeStatus;
|
||||
if ($activeStatus == 'seeding') {
|
||||
$color = 'green';
|
||||
} elseif ($activeStatus == 'leeching') {
|
||||
$color = 'red';
|
||||
}
|
||||
$progress = ($progress * 100) . '%';
|
||||
$result = sprintf(
|
||||
'<div style="padding: 1px;margin-top: 2px;border: 1px solid #838383" title="%s"><div style="width: %s;background-color: %s;height: 2px"></div></div>',
|
||||
$title . " $progress", $progress, $color
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user