exam index seed bonus => seed points

This commit is contained in:
xiaomlove
2022-02-20 21:50:03 +08:00
parent 27c7bd47f8
commit 3a357f1534
7 changed files with 25 additions and 19 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class Exam extends NexusModel
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'],
self::INDEX_SEED_BONUS => ['name' => 'Seed bonus', 'unit' => '', 'source_user_field' => 'seed_points'],
self::INDEX_SEED_BONUS => ['name' => 'Seed points', 'unit' => '', 'source_user_field' => 'seed_points'],
];
const FILTER_USER_CLASS = 'classes';
+1 -1
View File
@@ -482,7 +482,7 @@ class ExamRepository extends BaseRepository
$attributes['index'] = $index['index'];
$attributes['created_at'] = $now;
$attributes['updated_at'] = $now;
$attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']};
$attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']} ?? 0;
do_log("[GET_TOTAL_VALUE]: " . $attributes['value']);
$newVersionProgress = ExamProgress::query()
->where('exam_user_id', $examUser->id)
+9 -3
View File
@@ -5242,7 +5242,6 @@ function get_ip_location_from_geoip($ip)
if (is_null($reader)) {
$reader = new \GeoIp2\Database\Reader($database);
}
$record = $reader->city($ip);
$lang = get_langfolder_cookie();
$langMap = [
'chs' => 'zh-CN',
@@ -5250,8 +5249,15 @@ function get_ip_location_from_geoip($ip)
'en' => 'en',
];
$locale = $langMap[$lang] ?? $lang;
$countryName = $record->country->names[$locale] ?? $record->country->names['en'];
$cityName = $record->city->names[$locale] ?? $record->city->names['en'] ?? '';
try {
$record = $reader->city($ip);
$countryName = $record->country->names[$locale] ?? $record->country->names['en'];
$cityName = $record->city->names[$locale] ?? $record->city->names['en'] ?? '';
} catch (\Exception $exception) {
do_log($exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error');
$countryName = '';
$cityName = '';
}
do_log("ip: $ip, locale: $locale, city: $cityName, country: $countryName");
return [
'name' => sprintf('%s·%s', $cityName, $countryName),
+11 -11
View File
@@ -89,7 +89,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["action"]) && $_POST["a
exit;
}
*/
//end process upload file
//start process torrent ID
@@ -166,13 +166,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["action"]) && $_POST["a
$anonymous = "no";
$anon = $CURUSER["username"];
}
//$file["name"] = str_replace("", "_", htmlspecialchars("$file[name]"));
//$file["name"] = preg_replace('/[^a-z0-9_\-\.]/i', '_', $file[name]);
//make_folder($SUBSPATH."/",$detail_torrent_id);
//stderr("",$file["name"]);
$r = sql_query("SELECT lang_name from language WHERE sub_lang=1 AND id = " . sqlesc($lang_id)) or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($r);
@@ -182,15 +182,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["action"]) && $_POST["a
$size = $file["size"];
sql_query("INSERT INTO subs (torrent_id, lang_id, title, filename, added, uppedby, anonymous, size, ext) VALUES (" . implode(",", array_map("sqlesc", array($torrent_id, $lang_id, $title, $filename, $added, $uppedby, $anonymous, $size, $ext))). ")") or sqlerr();
$id = mysql_insert_id();
//stderr("",make_folder($SUBSPATH."/",$torrent_id). "/" . $id . "." .$ext);
if (!move_uploaded_file($file["tmp_name"], make_folder($SUBSPATH."/",$torrent_id). "/" . $id . "." .$ext))
echo($lang_subtitles['std_failed_moving_file']);
KPS("+",$uploadsubtitle_bonus,$uppedby); //subtitle uploader gets bonus
write_log("$arr[lang_name] Subtitle $id ($title) was uploaded by $anon");
$msg_bt = "$arr[lang_name] Subtitle $id ($title) was uploaded by $anon, Download: " . get_protocol_prefix() . "$BASEURL/downloadsubs.php/".$file["name"]."";
}
@@ -270,7 +270,7 @@ if (get_user_class() >= UC_PEASANT)
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_subtitles['text_rule_four']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_subtitles['text_rule_five']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_subtitles['text_rule_six']."</p>\n");
print($lang_subtitles['text_red_star_required']);
if($in_detail != "")
{
@@ -311,7 +311,7 @@ if (get_user_class() >= UC_PEASANT)
{
tr($lang_subtitles['row_show_uploader'], "<input type=checkbox name=uplver value=yes>".$lang_subtitles['hide_uploader_note'], 1);
}
print("<tr><td class=toolbox colspan=2 align=center><input type=submit class=btn value=".$lang_subtitles['submit_upload_file']."> <input type=reset class=btn value=\"".$lang_subtitles['submit_reset']."\"></td></tr>\n");
print("</table>\n");
print("</form>\n");
@@ -377,7 +377,7 @@ if(get_user_class() >= UC_PEASANT)
{
// the number $start_subid is just for legacy support of prevoiusly uploaded subs, if the site is completely new, it should be 0 or just remove it
$lang = "<td class=rowfollow align=center valign=middle>" . "<img border=\"0\" src=\"pic/flag/". $arr["flagpic"] . "\" alt=\"" . $arr["lang_name"] . "\" title=\"" . $arr["lang_name"] . "\"/>" . "</td>\n";
$title = "<td class=rowfollow align=left><a href=\"" . ($arr['id'] <= $start_subid ? "downloadsubs_legacy.php/" . $arr['filename'] : "downloadsubs.php?torrentid=" . $arr['torrent_id'] ."&subid=" .$arr['id']) . "\"<b>" . htmlspecialchars($arr["title"]) . "</b></a>" .
$title = "<td class=rowfollow align=left><a href=\"" . (isset($start_subid) && $arr['id'] <= $start_subid ? "downloadsubs_legacy.php/" . $arr['filename'] : "downloadsubs.php?torrentid=" . $arr['torrent_id'] ."&subid=" .$arr['id']) . "\"<b>" . htmlspecialchars($arr["title"]) . "</b></a>" .
($mod || ($pu && $arr["uppedby"] == $CURUSER["id"]) ? " <font class=small><a href=?delete=$arr[id]>".$lang_subtitles['text_delete']."</a></font>" : "") ."</td>\n";
$addtime = gettime($arr["added"],false,false);
$added = "<td class=rowfollow align=center><nobr>" . $addtime . "</nobr></td>\n";
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => 'Uploaded',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => 'Seed time average',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => 'Downloaded',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => 'Seed bonus',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => 'Seed points',
'require_value' => 'Require',
'current_value' => 'Current',
'result' => 'Result',
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上传量',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做种时间',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下载量',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做种魔力',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做种积分',
'require_value' => '要求',
'current_value' => '当前',
'result' => '结果',
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上傳量',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做種時間',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下載量',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做種魔力',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做種積分',
'require_value' => '要求',
'current_value' => '當前',
'result' => '結果',