mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
fix takeedit.php array_sum()
This commit is contained in:
@@ -2630,7 +2630,7 @@ function stdfoot() {
|
|||||||
print (" with <b>".count($query_name)."</b> db queries, <b>".$Cache->getCacheReadTimes()."</b> reads and <b>".$Cache->getCacheWriteTimes()."</b> writes of Redis and <b>".mksize(memory_get_usage())."</b> ram]");
|
print (" with <b>".count($query_name)."</b> db queries, <b>".$Cache->getCacheReadTimes()."</b> reads and <b>".$Cache->getCacheWriteTimes()."</b> writes of Redis and <b>".mksize(memory_get_usage())."</b> ram]");
|
||||||
print ("</div>\n");
|
print ("</div>\n");
|
||||||
if ($enablesqldebug_tweak == 'yes' && get_user_class() >= $sqldebug_tweak) {
|
if ($enablesqldebug_tweak == 'yes' && get_user_class() >= $sqldebug_tweak) {
|
||||||
print("<div id=\"sql_debug\">SQL query list: <ul>");
|
print("<div id=\"sql_debug\" style='text-align: left;'>SQL query list: <ul>");
|
||||||
foreach($query_name as $query) {
|
foreach($query_name as $query) {
|
||||||
print(sprintf('<li>%s [%s]</li>', htmlspecialchars($query['query']), $query['time']));
|
print(sprintf('<li>%s [%s]</li>', htmlspecialchars($query['query']), $query['time']));
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-12
@@ -14,20 +14,21 @@ class Field
|
|||||||
const TYPE_FILE = 'file';
|
const TYPE_FILE = 'file';
|
||||||
|
|
||||||
public static $types = [
|
public static $types = [
|
||||||
self::TYPE_TEXT => '短文本',
|
self::TYPE_TEXT => '短文本(text)',
|
||||||
self::TYPE_TEXTAREA => '长文本',
|
self::TYPE_TEXTAREA => '长文本(textarea)',
|
||||||
self::TYPE_RADIO => '横向单选',
|
self::TYPE_RADIO => '横向单选(radio)',
|
||||||
self::TYPE_CHECKBOX => '横向多选',
|
self::TYPE_CHECKBOX => '横向多选(checkbox)',
|
||||||
self::TYPE_SELECT => '下拉单选',
|
self::TYPE_SELECT => '下拉单选(select)',
|
||||||
self::TYPE_FILE => '文件',
|
self::TYPE_FILE => '文件(file)',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public function radio($name, $options, $current = null)
|
public function radio($name, $options, $current = null)
|
||||||
{
|
{
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($options as $value => $label) {
|
foreach ($options as $value => $label) {
|
||||||
$arr[] = sprintf(
|
$arr[] = sprintf(
|
||||||
'<label><input type="radio" name="%s" value="%s"%s />%s</label>',
|
'<label style="margin-right: 4px;"><input type="radio" name="%s" value="%s"%s />%s</label>',
|
||||||
$name, $value, (string)$current === (string)$value ? ' checked' : '', $label
|
$name, $value, (string)$current === (string)$value ? ' checked' : '', $label
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -45,7 +46,7 @@ class Field
|
|||||||
$trOptions = tr($lang_fields['col_options'], '<textarea name="options" rows="6" cols="80">' . ($row['options'] ?? '') . '</textarea><br/>类型为单选、多选、下拉时必填,一行一个,格式:选项值|选项描述文本', 1, '', true);
|
$trOptions = tr($lang_fields['col_options'], '<textarea name="options" rows="6" cols="80">' . ($row['options'] ?? '') . '</textarea><br/>类型为单选、多选、下拉时必填,一行一个,格式:选项值|选项描述文本', 1, '', true);
|
||||||
$id = $row['id'] ?? 0;
|
$id = $row['id'] ?? 0;
|
||||||
$form = <<<HTML
|
$form = <<<HTML
|
||||||
<div style="width: 940px">
|
<div>
|
||||||
<h1 align="center"><a class="faqlink" href="?action=view&type=">{$lang_fields['text_field']}</a></h1>
|
<h1 align="center"><a class="faqlink" href="?action=view&type=">{$lang_fields['text_field']}</a></h1>
|
||||||
<form method="post" action="fields.php?action=submit&type=">
|
<form method="post" action="fields.php?action=submit&type=">
|
||||||
<div>
|
<div>
|
||||||
@@ -71,27 +72,47 @@ HTML;
|
|||||||
function buildFieldTable()
|
function buildFieldTable()
|
||||||
{
|
{
|
||||||
global $lang_fields;
|
global $lang_fields;
|
||||||
$sql = 'select * from torrents_custom_fields';
|
$perPage = 10;
|
||||||
|
$total = get_row_count('torrents_custom_fields');
|
||||||
|
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
|
||||||
|
$sql = "select * from torrents_custom_fields order by id desc $limit";
|
||||||
$res = sql_query($sql);
|
$res = sql_query($sql);
|
||||||
$header = [
|
$header = [
|
||||||
'id' => $lang_fields['col_id'],
|
'id' => $lang_fields['col_id'],
|
||||||
'name' => $lang_fields['col_name'],
|
'name' => $lang_fields['col_name'],
|
||||||
'label' => $lang_fields['col_label'],
|
'label' => $lang_fields['col_label'],
|
||||||
'type' => $lang_fields['col_type'],
|
'type_text' => $lang_fields['col_type'],
|
||||||
'required_text' => $lang_fields['col_required'],
|
'required_text' => $lang_fields['col_required'],
|
||||||
'action' => $lang_fields['col_action'],
|
'action' => $lang_fields['col_action'],
|
||||||
];
|
];
|
||||||
$rows = [];
|
$rows = [];
|
||||||
while ($row = mysql_fetch_assoc($res)) {
|
while ($row = mysql_fetch_assoc($res)) {
|
||||||
$row['required_text'] = $row['required'] ? '是' : '否';
|
$row['required_text'] = $row['required'] ? '是' : '否';
|
||||||
|
$row['type_text'] = self::$types[$row['type']] ?? '';
|
||||||
$row['action'] = sprintf(
|
$row['action'] = sprintf(
|
||||||
"<a href=\"javascript:confirm_delete('%s', '%s', '');\">%s</a> | <a href=\"?action=edit&type=&id=%s\">%s</a>",
|
"<a href=\"javascript:confirm_delete('%s', '%s', '');\">%s</a> | <a href=\"?action=edit&type=&id=%s\">%s</a>",
|
||||||
$row['id'], $lang_fields['js_sure_to_delete_this'], $lang_fields['text_delete'], $row['id'], $lang_fields['text_edit']
|
$row['id'], $lang_fields['js_sure_to_delete_this'], $lang_fields['text_delete'], $row['id'], $lang_fields['text_edit']
|
||||||
);
|
);
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
|
$head = <<<HEAD
|
||||||
|
<h1 align="center">{$lang_fields['field_management']} - </h1>
|
||||||
|
<div style="margin-bottom: 8px;">
|
||||||
|
<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;
|
||||||
$table = $this->buildTable($header, $rows);
|
$table = $this->buildTable($header, $rows);
|
||||||
return $table;
|
return $head . $table . $paginationBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save($data)
|
public function save($data)
|
||||||
@@ -154,7 +175,7 @@ HTML;
|
|||||||
}
|
}
|
||||||
$table .= '</tr>';
|
$table .= '</tr>';
|
||||||
}
|
}
|
||||||
$table .= '</tbody>';
|
$table .= '</tbody></table>';
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-25
@@ -8,36 +8,14 @@ if (get_user_class() < UC_ADMINISTRATOR) {
|
|||||||
}
|
}
|
||||||
$field = new \Nexus\Field\Field();
|
$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';
|
$action = $_GET['action'] ?? 'view';
|
||||||
if ($action == 'view') {
|
if ($action == 'view') {
|
||||||
stdhead($lang_fields['field_management']." - ".$lang_fields['text_field']);
|
stdhead($lang_fields['field_management']." - ".$lang_fields['text_field']);
|
||||||
begin_main_frame();
|
begin_main_frame();
|
||||||
echo buildTableHead();
|
$r = $field->buildFieldTable();
|
||||||
echo $field->buildFieldTable();
|
echo $r;
|
||||||
|
stdfoot();
|
||||||
} elseif ($action == 'add') {
|
} elseif ($action == 'add') {
|
||||||
stdhead($lang_fields['field_management']." - ".$lang_fields['text_add']);
|
stdhead($lang_fields['field_management']." - ".$lang_fields['text_add']);
|
||||||
begin_main_frame();
|
begin_main_frame();
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ if (!empty($_POST['pt_gen'])) {
|
|||||||
$updateset[] = "pt_gen = ''";
|
$updateset[] = "pt_gen = ''";
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateset[] = "tags = " . array_sum($_POST['tags']);
|
$updateset[] = "tags = " . array_sum($_POST['tags'] ?? []);
|
||||||
|
|
||||||
if ($enablenfo_main=='yes'){
|
if ($enablenfo_main=='yes'){
|
||||||
$nfoaction = $_POST['nfoaction'];
|
$nfoaction = $_POST['nfoaction'];
|
||||||
|
|||||||
Reference in New Issue
Block a user