mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-26 05:17:22 +08:00
field basic
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require "../include/bittorrent.php";
|
||||
dbconn();
|
||||
require_once(get_langfile_path());
|
||||
loggedinorreturn();
|
||||
if (get_user_class() < UC_ADMINISTRATOR) {
|
||||
permissiondenied();
|
||||
}
|
||||
$field = new \Nexus\Field\Field();
|
||||
|
||||
function buildTableHead()
|
||||
{
|
||||
global $lang_fields;
|
||||
$head = <<<HEAD
|
||||
<h1 align="center">{$lang_fields['field_management']} - </h1>
|
||||
<div>
|
||||
<span id="item" onclick="dropmenu(this);">
|
||||
<span style="cursor: pointer;" class="big"><b>{$lang_fields['text_manage']}</b></span>
|
||||
<div id="itemlist" class="dropmenu" style="display: none">
|
||||
<ul>
|
||||
<li><a href="?action=view&type=field">{$lang_fields['text_field']}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
<span id="add">
|
||||
<a href="?action=add&type=" class="big"><b>{$lang_fields['text_add']}</b></a>
|
||||
</span>
|
||||
</div>
|
||||
HEAD;
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$action = $_GET['action'] ?? 'view';
|
||||
if ($action == 'view') {
|
||||
stdhead($lang_fields['field_management']." - ".$lang_fields['text_field']);
|
||||
begin_main_frame();
|
||||
echo buildTableHead();
|
||||
echo $field->buildFieldTable();
|
||||
} elseif ($action == 'add') {
|
||||
stdhead($lang_fields['field_management']." - ".$lang_fields['text_add']);
|
||||
begin_main_frame();
|
||||
echo $field->buildFieldForm();
|
||||
} elseif ($action == 'submit') {
|
||||
try {
|
||||
$result = $field->save($_REQUEST);
|
||||
redirect('fields.php?action=view&type=');
|
||||
} catch (\Exception $e) {
|
||||
stderr($lang_fields['field_management']." - ".$lang_fields['text_field'], $e->getMessage());
|
||||
}
|
||||
} elseif ($action == 'edit') {
|
||||
$id = intval($_GET['id'] ?? 0);
|
||||
if ($id == 0) {
|
||||
stderr($lang_fields['field_management'], "invalid id");
|
||||
}
|
||||
$sql = "select * from torrents_custom_fields where id = $id";
|
||||
$res = sql_query($sql);
|
||||
$row = mysql_fetch_assoc($res);
|
||||
if (empty($row)) {
|
||||
stderr('', 'invlaid id');
|
||||
}
|
||||
stdhead($lang_fields['field_management']." - ".$lang_fields['text_edit']);
|
||||
begin_main_frame();
|
||||
echo $field->buildFieldForm($row);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -343,7 +343,7 @@ if (empty($url) && !empty($ptGenImdbLink)) {
|
||||
}
|
||||
|
||||
$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen, tags) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) .
|
||||
", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ", " . array_sum($_POST['tags']) . ")");
|
||||
", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ", " . array_sum($_POST['tags'] ?? []) . ")");
|
||||
if (!$ret) {
|
||||
if (mysql_errno() == 1062)
|
||||
bark($lang_takeupload['std_torrent_existed']);
|
||||
|
||||
Reference in New Issue
Block a user