mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Added mod "Reason to move topic" (#1388)
* Added mod "Reason to move topic" * Update CHANGELOG.md
This commit is contained in:
parent
6585b3124d
commit
58af3dff58
6 changed files with 24 additions and 28 deletions
|
@ -6,6 +6,7 @@
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
- Release 2.4.2 🐯 ([belomaxorka](https://github.com/belomaxorka))
|
- Release 2.4.2 🐯 ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
- Added mod "Reason to move topic" [\#1388](https://github.com/torrentpier/torrentpier/pull/1388) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Created template file for AJAX quick actions [\#1381](https://github.com/torrentpier/torrentpier/pull/1381) ([belomaxorka](https://github.com/belomaxorka))
|
- Created template file for AJAX quick actions [\#1381](https://github.com/torrentpier/torrentpier/pull/1381) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Removed `wbr()` [\#1387](https://github.com/torrentpier/torrentpier/pull/1387) ([belomaxorka](https://github.com/belomaxorka))
|
- Removed `wbr()` [\#1387](https://github.com/torrentpier/torrentpier/pull/1387) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Removed converting for legacy md5 passwords [\#1386](https://github.com/torrentpier/torrentpier/pull/1386) ([belomaxorka](https://github.com/belomaxorka))
|
- Removed converting for legacy md5 passwords [\#1386](https://github.com/torrentpier/torrentpier/pull/1386) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
|
|
@ -1336,6 +1336,7 @@ $lang['UPDATE_POST_TIME'] = 'Update post time';
|
||||||
$lang['TOPIC_SPLIT_NEW'] = 'New topic';
|
$lang['TOPIC_SPLIT_NEW'] = 'New topic';
|
||||||
$lang['TOPIC_SPLIT_OLD'] = 'Old topic';
|
$lang['TOPIC_SPLIT_OLD'] = 'Old topic';
|
||||||
$lang['BOT_LEAVE_MSG_MOVED'] = 'Add bot-message about moving';
|
$lang['BOT_LEAVE_MSG_MOVED'] = 'Add bot-message about moving';
|
||||||
|
$lang['BOT_REASON_MOVED'] = 'Reason to move';
|
||||||
$lang['BOT_AFTER_SPLIT_TO_OLD'] = 'Add bot-message about split to <b>old topic</b>';
|
$lang['BOT_AFTER_SPLIT_TO_OLD'] = 'Add bot-message about split to <b>old topic</b>';
|
||||||
$lang['BOT_AFTER_SPLIT_TO_NEW'] = 'Add bot-message about split to <b>new topic</b>';
|
$lang['BOT_AFTER_SPLIT_TO_NEW'] = 'Add bot-message about split to <b>new topic</b>';
|
||||||
//qr
|
//qr
|
||||||
|
@ -2515,7 +2516,7 @@ $lang['WRONG_INPUT'] = 'You have entered some wrong values. Please check your in
|
||||||
$lang['PROCESSING'] = 'Processing...';
|
$lang['PROCESSING'] = 'Processing...';
|
||||||
$lang['FINISHED'] = 'Finished';
|
$lang['FINISHED'] = 'Finished';
|
||||||
|
|
||||||
$lang['BOT_TOPIC_MOVED_FROM_TO'] = 'Topic has been moved from forum [b]%s[/b] to forum [b]%s[/b][br][br]%s';
|
$lang['BOT_TOPIC_MOVED_FROM_TO'] = 'Topic has been moved from forum [b]%s[/b] to forum [b]%s[/b].[br][b]Reason to move:[/b] %s[br][br]%s';
|
||||||
$lang['BOT_MESS_SPLITS'] = 'Topic has been split. New topic - [b]%s[/b][br][br]%s';
|
$lang['BOT_MESS_SPLITS'] = 'Topic has been split. New topic - [b]%s[/b][br][br]%s';
|
||||||
$lang['BOT_TOPIC_SPLITS'] = 'Topic has been split from [b]%s[/b][br][br]%s';
|
$lang['BOT_TOPIC_SPLITS'] = 'Topic has been split from [b]%s[/b][br][br]%s';
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ switch ($mode) {
|
||||||
|
|
||||||
if ($confirmed) {
|
if ($confirmed) {
|
||||||
$new_forum_id = (int)$_POST['new_forum'];
|
$new_forum_id = (int)$_POST['new_forum'];
|
||||||
$result = \TorrentPier\Legacy\Admin\Common::topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']));
|
$result = \TorrentPier\Legacy\Admin\Common::topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']), $_POST['reason_move_bot']);
|
||||||
|
|
||||||
//Обновление кеша новостей на главной
|
//Обновление кеша новостей на главной
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
||||||
|
|
|
@ -419,15 +419,15 @@ class Common
|
||||||
/**
|
/**
|
||||||
* Topic movement
|
* Topic movement
|
||||||
*
|
*
|
||||||
* @param array|string $topic_id
|
* @param int|array|string $topic_id
|
||||||
* @param int $to_forum_id
|
* @param int|string $to_forum_id
|
||||||
* @param null $from_forum_id
|
* @param int|string|null $from_forum_id
|
||||||
* @param bool $leave_shadow
|
* @param bool $leave_shadow
|
||||||
* @param bool $insert_bot_msg
|
* @param bool $insert_bot_msg
|
||||||
*
|
* @param string $reason_move
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function topic_move($topic_id, $to_forum_id, $from_forum_id = null, $leave_shadow = false, $insert_bot_msg = false)
|
public static function topic_move(int|array|string $topic_id, int|string $to_forum_id, int|string $from_forum_id = null, bool $leave_shadow = false, bool $insert_bot_msg = false, string $reason_move = ''): bool
|
||||||
{
|
{
|
||||||
global $log_action;
|
global $log_action;
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ class Common
|
||||||
// Bot
|
// Bot
|
||||||
if ($insert_bot_msg) {
|
if ($insert_bot_msg) {
|
||||||
foreach ($topics as $topic_id => $row) {
|
foreach ($topics as $topic_id => $row) {
|
||||||
Post::insert_post('after_move', $topic_id, $to_forum_id, $row['forum_id']);
|
Post::insert_post('after_move', $topic_id, $to_forum_id, $row['forum_id'], reason_move: $reason_move);
|
||||||
}
|
}
|
||||||
self::sync('topic', array_keys($topics));
|
self::sync('topic', array_keys($topics));
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,16 +417,15 @@ class Post
|
||||||
* Insert post to the existing thread
|
* Insert post to the existing thread
|
||||||
*
|
*
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param int $topic_id
|
* @param int|string $topic_id
|
||||||
* @param int $forum_id
|
* @param int|string|null $forum_id
|
||||||
* @param int $old_forum_id
|
* @param int|string|null $old_forum_id
|
||||||
* @param int $new_topic_id
|
* @param int|string|null $new_topic_id
|
||||||
* @param string $new_topic_title
|
* @param string $new_topic_title
|
||||||
* @param int $old_topic_id
|
* @param int|null $old_topic_id
|
||||||
* @param string $message
|
* @param string $reason_move
|
||||||
* @param int $poster_id
|
|
||||||
*/
|
*/
|
||||||
public static function insert_post($mode, $topic_id, $forum_id = null, $old_forum_id = null, $new_topic_id = null, $new_topic_title = '', $old_topic_id = null, $message = '', $poster_id = null)
|
public static function insert_post(string $mode, int|string $topic_id, int|string $forum_id = null, int|string $old_forum_id = null, int|string $new_topic_id = null, string $new_topic_title = '', int $old_topic_id = null, string $reason_move = ''): void
|
||||||
{
|
{
|
||||||
global $userdata, $lang;
|
global $userdata, $lang;
|
||||||
|
|
||||||
|
@ -434,10 +433,12 @@ class Post
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_username = $post_text = $poster_ip = '';
|
$post_username = '';
|
||||||
|
|
||||||
$post_time = TIMENOW;
|
$post_time = TIMENOW;
|
||||||
|
|
||||||
|
$poster_id = BOT_UID;
|
||||||
|
$poster_ip = '7f000001';
|
||||||
|
|
||||||
if ($mode == 'after_move') {
|
if ($mode == 'after_move') {
|
||||||
if (!$forum_id || !$old_forum_id) {
|
if (!$forum_id || !$old_forum_id) {
|
||||||
return;
|
return;
|
||||||
|
@ -455,15 +456,10 @@ class Post
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_text = sprintf($lang['BOT_TOPIC_MOVED_FROM_TO'], '[url=' . make_url(FORUM_URL . $old_forum_id) . ']' . $forum_names[$old_forum_id] . '[/url]', '[url=' . make_url(FORUM_URL . $forum_id) . ']' . $forum_names[$forum_id] . '[/url]', profile_url($userdata));
|
$reason_move = !empty($reason_move) ? htmlCHR($reason_move) : $lang['NOSELECT'];
|
||||||
|
$post_text = sprintf($lang['BOT_TOPIC_MOVED_FROM_TO'], '[url=' . make_url(FORUM_URL . $old_forum_id) . ']' . $forum_names[$old_forum_id] . '[/url]', '[url=' . make_url(FORUM_URL . $forum_id) . ']' . $forum_names[$forum_id] . '[/url]', $reason_move, profile_url($userdata));
|
||||||
$poster_id = BOT_UID;
|
|
||||||
$poster_ip = '7f000001';
|
|
||||||
} elseif ($mode == 'after_split_to_old') {
|
} elseif ($mode == 'after_split_to_old') {
|
||||||
$post_text = sprintf($lang['BOT_MESS_SPLITS'], '[url=' . make_url(TOPIC_URL . $new_topic_id) . ']' . htmlCHR($new_topic_title) . '[/url]', profile_url($userdata));
|
$post_text = sprintf($lang['BOT_MESS_SPLITS'], '[url=' . make_url(TOPIC_URL . $new_topic_id) . ']' . htmlCHR($new_topic_title) . '[/url]', profile_url($userdata));
|
||||||
|
|
||||||
$poster_id = BOT_UID;
|
|
||||||
$poster_ip = '7f000001';
|
|
||||||
} elseif ($mode == 'after_split_to_new') {
|
} elseif ($mode == 'after_split_to_new') {
|
||||||
$sql = "SELECT t.topic_title, p.post_time
|
$sql = "SELECT t.topic_title, p.post_time
|
||||||
FROM " . BB_TOPICS . " t, " . BB_POSTS . " p
|
FROM " . BB_TOPICS . " t, " . BB_POSTS . " p
|
||||||
|
@ -474,9 +470,6 @@ class Post
|
||||||
$post_time = $row['post_time'] - 1;
|
$post_time = $row['post_time'] - 1;
|
||||||
|
|
||||||
$post_text = sprintf($lang['BOT_TOPIC_SPLITS'], '[url=' . make_url(TOPIC_URL . $old_topic_id) . ']' . $row['topic_title'] . '[/url]', profile_url($userdata));
|
$post_text = sprintf($lang['BOT_TOPIC_SPLITS'], '[url=' . make_url(TOPIC_URL . $old_topic_id) . ']' . $row['topic_title'] . '[/url]', profile_url($userdata));
|
||||||
|
|
||||||
$poster_id = BOT_UID;
|
|
||||||
$poster_ip = '7f000001';
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF SHOW_BOT_OPTIONS -->
|
<!-- IF SHOW_BOT_OPTIONS -->
|
||||||
<p class="mrg_2"><input type="checkbox" name="insert_bot_msg" id="insert_bot_msg" checked /><label for="insert_bot_msg">{L_BOT_LEAVE_MSG_MOVED}</label></p>
|
<p class="mrg_2"><input type="checkbox" name="insert_bot_msg" id="insert_bot_msg" checked /><label for="insert_bot_msg">{L_BOT_LEAVE_MSG_MOVED}</label></p>
|
||||||
|
<p class="mrg_2">{L_BOT_REASON_MOVED} <input type="text" name="reason_move_bot" maxlength="60" size="30"/></p>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue