mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Minor improvements (#1658)
* Minor improvements * Update install.php * Update install.php * Update .gitignore * Update admin_cron.php * Update Upload.php * Update CHANGELOG.md
This commit is contained in:
parent
0587f7a035
commit
055a6e53ca
5 changed files with 25 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
|||
### TorrentPier ###
|
||||
*.log
|
||||
*.integrity
|
||||
install.php_*
|
||||
.env
|
||||
.php_cs.cache
|
||||
data/avatars
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
- Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Disabled resizing for textarea tag [\#1638](https://github.com/torrentpier/torrentpier/pull/1638) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611), [\#1612](https://github.com/torrentpier/torrentpier/pull/1612), [\#1615](https://github.com/torrentpier/torrentpier/pull/1615), [\#1627](https://github.com/torrentpier/torrentpier/pull/1627), [\#1633](https://github.com/torrentpier/torrentpier/pull/1633), [\#1641](https://github.com/torrentpier/torrentpier/pull/1641), [\#1651](https://github.com/torrentpier/torrentpier/pull/1651) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611), [\#1612](https://github.com/torrentpier/torrentpier/pull/1612), [\#1615](https://github.com/torrentpier/torrentpier/pull/1615), [\#1627](https://github.com/torrentpier/torrentpier/pull/1627), [\#1633](https://github.com/torrentpier/torrentpier/pull/1633), [\#1641](https://github.com/torrentpier/torrentpier/pull/1641), [\#1651](https://github.com/torrentpier/torrentpier/pull/1651), [\#1658](https://github.com/torrentpier/torrentpier/pull/1658) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Updated deps [\#1563](https://github.com/torrentpier/torrentpier/pull/1563), [\#1564](https://github.com/torrentpier/torrentpier/pull/1564), [\#1608](https://github.com/torrentpier/torrentpier/pull/1608), [\#1609](https://github.com/torrentpier/torrentpier/pull/1609), [\#1610](https://github.com/torrentpier/torrentpier/pull/1610), [\#1637](https://github.com/torrentpier/torrentpier/pull/1637), [\#1646](https://github.com/torrentpier/torrentpier/pull/1646), [\#1647](https://github.com/torrentpier/torrentpier/pull/1647), [\#1650](https://github.com/torrentpier/torrentpier/pull/1650), [\#1656](https://github.com/torrentpier/torrentpier/pull/1656) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601), [\#1606](https://github.com/torrentpier/torrentpier/pull/1606), [\#1607](https://github.com/torrentpier/torrentpier/pull/1607), [\#1625](https://github.com/torrentpier/torrentpier/pull/1625), [\#1626](https://github.com/torrentpier/torrentpier/pull/1626), [\#1629](https://github.com/torrentpier/torrentpier/pull/1629), [\#1630](https://github.com/torrentpier/torrentpier/pull/1630), [\#1631](https://github.com/torrentpier/torrentpier/pull/1631), [\#1632](https://github.com/torrentpier/torrentpier/pull/1632), [\#1639](https://github.com/torrentpier/torrentpier/pull/1639), [\#1640](https://github.com/torrentpier/torrentpier/pull/1640), [\#1654](https://github.com/torrentpier/torrentpier/pull/1654), [\#1655](https://github.com/torrentpier/torrentpier/pull/1655) ([Exileum](https://github.com/Exileum))
|
||||
|
||||
|
|
|
@ -188,7 +188,8 @@ switch ($mode) {
|
|||
}
|
||||
|
||||
if ($submit) {
|
||||
if ($_POST['mode'] == 'list') {
|
||||
$mode2 = $_POST['mode'] ?? '';
|
||||
if ($mode2 == 'list') {
|
||||
if ($cron_action == 'run' && $jobs) {
|
||||
\TorrentPier\Legacy\Admin\Cron::run_jobs($jobs);
|
||||
} elseif ($cron_action == 'delete' && $jobs) {
|
||||
|
@ -198,12 +199,12 @@ if ($submit) {
|
|||
}
|
||||
redirect('admin/' . basename(__FILE__) . '?mode=list');
|
||||
} elseif (\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST) == 1) {
|
||||
if ($_POST['mode'] == 'edit') {
|
||||
if ($mode2 == 'edit') {
|
||||
\TorrentPier\Legacy\Admin\Cron::update_cron_job($_POST);
|
||||
} elseif ($_POST['mode'] == 'add') {
|
||||
} elseif ($mode2 == 'add') {
|
||||
\TorrentPier\Legacy\Admin\Cron::insert_cron_job($_POST);
|
||||
} else {
|
||||
bb_die('Mode error');
|
||||
bb_die("Invalid mode: $mode2");
|
||||
}
|
||||
|
||||
redirect('admin/' . basename(__FILE__) . '?mode=list');
|
||||
|
|
12
install.php
12
install.php
|
@ -160,13 +160,13 @@ out("- Checking installed extensions...", 'info');
|
|||
|
||||
// [1] Check PHP Version
|
||||
if (!version_compare(PHP_VERSION, CHECK_REQUIREMENTS['php_min_version'], '>=')) {
|
||||
out("- TorrentPier requires PHP version " . CHECK_REQUIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION, 'error');
|
||||
out("- TorrentPier requires PHP version " . CHECK_REQUIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION, 'warning');
|
||||
}
|
||||
|
||||
// [2] Check installed PHP Extensions on server
|
||||
foreach (CHECK_REQUIREMENTS['ext_list'] as $ext) {
|
||||
if (!extension_loaded($ext)) {
|
||||
out("- ext-$ext not installed", 'error');
|
||||
out("- ext-$ext not installed. Check out php.ini file", 'error');
|
||||
exit;
|
||||
} else {
|
||||
out("- ext-$ext installed!");
|
||||
|
@ -232,14 +232,14 @@ if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
|
|||
out("- Composer successfully downloaded!\n", 'success');
|
||||
runProcess('php ' . BB_ROOT . 'composer-setup.php --install-dir=' . BB_ROOT);
|
||||
} else {
|
||||
out('- Cannot download Composer', 'error');
|
||||
out('- Cannot download Composer. Please, download it (composer.phar) manually', 'error');
|
||||
exit;
|
||||
}
|
||||
if (is_file(BB_ROOT . 'composer-setup.php')) {
|
||||
if (unlink(BB_ROOT . 'composer-setup.php')) {
|
||||
out("- Composer installation file successfully removed!\n", 'success');
|
||||
} else {
|
||||
out('- Cannot remove Composer installation file. Delete it manually', 'warning');
|
||||
out('- Cannot remove Composer installation file (composer-setup.php). Please, delete it manually', 'warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
|
|||
runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi');
|
||||
out("- Completed! Composer dependencies are installed!\n", 'success');
|
||||
} else {
|
||||
out('- composer.phar not found', 'error');
|
||||
out('- composer.phar not found. Please, download it (composer.phar) manually', 'error');
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
|
@ -386,5 +386,5 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
|
|||
$conn->close();
|
||||
out("- Importing SQL dump completed!\n", 'success');
|
||||
out("- Voila! Good luck & have fun!", 'success');
|
||||
rename(__FILE__, hash('md5', time()));
|
||||
rename(__FILE__, __FILE__ . '_' . hash('md5', time()));
|
||||
}
|
||||
|
|
|
@ -203,20 +203,21 @@ class Upload
|
|||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function store(string $mode = '', array $params = [])
|
||||
public function store(string $mode, array $params = []): bool
|
||||
{
|
||||
if ($mode == 'avatar') {
|
||||
delete_avatar($params['user_id'], $params['avatar_ext_id']);
|
||||
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id);
|
||||
return $this->_move($file_path);
|
||||
switch ($mode) {
|
||||
case 'avatar':
|
||||
delete_avatar($params['user_id'], $params['avatar_ext_id']);
|
||||
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id);
|
||||
break;
|
||||
case 'attach':
|
||||
$file_path = get_attach_path($params['topic_id']);
|
||||
break;
|
||||
default:
|
||||
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
|
||||
}
|
||||
|
||||
if ($mode == 'attach') {
|
||||
$file_path = get_attach_path($params['topic_id']);
|
||||
return $this->_move($file_path);
|
||||
}
|
||||
|
||||
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
|
||||
return $this->_move($file_path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue