Add file uploads 1/...

This commit is contained in:
Visman 2023-07-05 23:14:53 +07:00
parent 44d54e1fd6
commit 02e8fc4021
8 changed files with 51 additions and 1 deletions

View file

@ -780,6 +780,12 @@ class Routing
'AdminLogs:action',
'AdminLogsAction'
);
$r->add(
$r::DUO,
'/admin/uploads',
'AdminUploads:view',
'AdminUploads'
);
}
$uri = $_SERVER['REQUEST_URI'];

View file

@ -81,6 +81,7 @@ abstract class Admin extends Page
'censoring' => [$r->link('AdminCensoring'), 'Censoring'],
'logs' => [$r->link('AdminLogs'), 'Logs'],
'maintenance' => [$r->link('AdminMaintenance'), 'Maintenance'],
'uploads' => [$r->link('AdminUploads'), 'Uploads'],
];
}

View file

@ -116,6 +116,7 @@ class Install extends Admin
$this->c->DIR_CONFIG . '/db',
$this->c->DIR_CACHE,
$this->c->DIR_PUBLIC . '/img/avatars',
$this->c->DIR_PUBLIC . '/upload',
];
foreach ($folders as $folder) {
@ -829,6 +830,9 @@ class Install extends Admin
'g_pm_limit' => ['INT(10) UNSIGNED', false, 100],
'g_sig_length' => ['SMALLINT UNSIGNED', false, 400],
'g_sig_lines' => ['TINYINT UNSIGNED', false, 4],
'g_up_ext' => ['VARCHAR(255)', false, 'webp,jpg,jpeg,png,gif,avif'],
'g_up_size_kb' => ['INT(10) UNSIGNED', false, 0],
'g_up_limit_mb' => ['INT(10) UNSIGNED', false, 0],
],
'PRIMARY KEY' => ['g_id'],
'ENGINE' => $this->DBEngine,
@ -1517,6 +1521,8 @@ class Install extends Admin
], FORK_JSON_ENCODE
),
's_РЕГИСТР' => 'Ok',
'b_upload' => 1,
'i_upload_img_quality' => 75,
];
foreach ($forkConfig as $name => $value) {

View file

@ -25,7 +25,7 @@ class Update extends Admin
{
const PHP_MIN = '8.0.0';
const REV_MIN_FOR_UPDATE = 53;
const LATEST_REV_WITH_DB_CHANGES = 55;
const LATEST_REV_WITH_DB_CHANGES = 59;
const LOCK_NAME = 'lock_update';
const LOCK_TTL = 1800;
const CONFIG_FILE = 'main.php';
@ -602,4 +602,33 @@ class Update extends Admin
return null;
}
/**
* rev.58 to rev.59
*/
protected function stageNumber58(array $args): ?int
{
$config = $this->c->config;
$config->b_upload = 1;
$config->i_upload_img_quality = 75;
$config->save();
$this->c->DB->addField('::groups', 'g_up_ext', 'VARCHAR(255)', false, 'webp,jpg,jpeg,png,gif,avif');
$this->c->DB->addField('::groups', 'g_up_size_kb', 'INT(10) UNSIGNED', false, 0);
$this->c->DB->addField('::groups', 'g_up_limit_mb', 'INT(10) UNSIGNED', false, 0);
$coreConfig = new CoreConfig($this->configFile);
$coreConfig->add(
'multiple=>AdminUploads',
'\\ForkBB\\Models\\Pages\\Admin\\Uploads::class',
'AdminLogs'
);
$coreConfig->save();
return null;
}
}

View file

@ -390,6 +390,7 @@ return [
'AdminParserSmilies' => \ForkBB\Models\Pages\Admin\Parser\Smilies::class,
'AdminParserBBCode' => \ForkBB\Models\Pages\Admin\Parser\BBCode::class,
'AdminLogs' => \ForkBB\Models\Pages\Admin\Logs::class,
'AdminUploads' => \ForkBB\Models\Pages\Admin\Uploads::class,
'AdminListModel' => \ForkBB\Models\AdminList\AdminList::class,
'BanListModel' => \ForkBB\Models\BanList\BanList::class,

View file

@ -77,3 +77,6 @@ msgstr "Logs"
msgid "Admin menu"
msgstr "Admin menu"
msgid "Uploads"
msgstr "Uploads"

View file

@ -77,3 +77,6 @@ msgstr "Логи"
msgid "Admin menu"
msgstr "Меню админки"
msgid "Uploads"
msgstr "Загрузки"

1
public/upload/index.html Normal file
View file

@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><title>.</title></head><body>.</body></html>