");
print("");
print(" ");
diff --git a/public/edit.php b/public/edit.php
index a2b02c0a..4189c9fb 100644
--- a/public/edit.php
+++ b/public/edit.php
@@ -12,6 +12,16 @@ $res = sql_query("SELECT torrents.*, categories.mode as cat_mode FROM torrents L
$row = mysql_fetch_array($res);
if (!$row) die();
+/**
+ * custom fields
+ * @since v1.6
+ */
+$customFieldValueRes = sql_query("select * from torrents_custom_field_values where torrent_id = $id");
+$customFieldValues = [];
+while ($row = mysql_fetch_assoc($res)) {
+ $customFieldValues[$row['custom_field_id']] = unserialize($row['custom_field_value']);
+}
+
if ($enablespecial == 'yes' && get_user_class() >= $movetorrent_class)
$allowmove = true; //enable moving torrent to other section
else $allowmove = false;
diff --git a/public/takeupload.php b/public/takeupload.php
index e04d7af3..f0f4843f 100644
--- a/public/takeupload.php
+++ b/public/takeupload.php
@@ -352,6 +352,24 @@ if (!$ret) {
}
$id = mysql_insert_id();
+/**
+ * add custom fields
+ * @since v1.6
+ */
+if (!empty($_POST['custom_fields'])) {
+ $now = date('Y-m-d H:i:s');
+ foreach ($_POST['custom_fields'] as $customField => $customValue) {
+ $customData = [
+ 'torrent_id' => $id,
+ 'custom_field_id' => $customField,
+ 'custom_field_value' => serialize($customValue),
+ 'created_at' => $now,
+ 'updated_at' => $now,
+ ];
+ \Nexus\Database\DB::insert('torrents_custom_field_values', $customData);
+ }
+}
+
@sql_query("DELETE FROM files WHERE torrent = $id");
foreach ($filelist as $file) {
@sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
diff --git a/public/upload.php b/public/upload.php
index 6a4f6188..28cd0762 100644
--- a/public/upload.php
+++ b/public/upload.php
@@ -64,11 +64,11 @@ stdhead($lang_upload['head_upload']);
$ptGen = new \Nexus\PTGen\PTGen();
echo $ptGen->renderUploadPageFormInput("");
}
- if ($enablenfo_main=='yes')
- tr($lang_upload['row_nfo_file'], " ".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."", 1);
-
- $field = new \Nexus\Field\Field();
-
+ $field = new \Nexus\Field\Field();
+ $field->renderUploadPage();
+ if ($enablenfo_main=='yes') {
+ tr($lang_upload['row_nfo_file'], " ".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."", 1);
+ }
print(" |