mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Newtopic: Added configuring robots indexing (#1599)
* Added ability configure robots indexing while creating new topic * Update viewtopic.php * Update mysql.sql * Update posting.php * Update Post.php * Update CHANGELOG.md * Update posting.php * Update posting.php * Update Post.php * Update posting.tpl * Update posting.php
This commit is contained in:
parent
7e43a6d002
commit
607141e51d
7 changed files with 34 additions and 10 deletions
|
@ -9,6 +9,7 @@
|
|||
- [CLI] TorrentPier installer ☕️ [\#1576](https://github.com/torrentpier/torrentpier/pull/1576), [\#1582](https://github.com/torrentpier/torrentpier/pull/1582), [\#1585](https://github.com/torrentpier/torrentpier/pull/1585), [\#1591](https://github.com/torrentpier/torrentpier/pull/1591) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added robots meta-tag support 🤖 [\#1587](https://github.com/torrentpier/torrentpier/pull/1587) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Newtopic: Added configuring robots indexing [\#1599](https://github.com/torrentpier/torrentpier/pull/1599) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added showing releaser stats in profile [\#1568](https://github.com/torrentpier/torrentpier/pull/1568) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Improved `filelist.php` [\#1586](https://github.com/torrentpier/torrentpier/pull/1586) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
|
|
@ -1254,6 +1254,7 @@ CREATE TABLE IF NOT EXISTS `bb_topics`
|
|||
`topic_dl_type` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`topic_last_post_time` INT(11) NOT NULL DEFAULT '0',
|
||||
`topic_show_first_post` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`topic_allow_robots` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`topic_id`),
|
||||
KEY `forum_id` (`forum_id`),
|
||||
KEY `topic_last_post_id` (`topic_last_post_id`),
|
||||
|
@ -1270,7 +1271,7 @@ INSERT INTO `bb_topics`
|
|||
VALUES ('1', '1', 'Welcome to TorrentPier Cattle', '2', UNIX_TIMESTAMP(), '0', '0', '0', '0', '0', '1', '1',
|
||||
'0',
|
||||
'0',
|
||||
'0', UNIX_TIMESTAMP(), '0');
|
||||
'0', UNIX_TIMESTAMP(), '0', '1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `bb_topics_watch`
|
||||
|
|
|
@ -376,6 +376,7 @@ $lang['MAX_SMILIES_PER_POST'] = 'Emoticons limit of %s emoticons exceeded.';
|
|||
|
||||
$lang['ATTACH_SIGNATURE'] = 'Attach signature (signatures can be changed in profile)';
|
||||
$lang['NOTIFY'] = 'Notify me when on replies';
|
||||
$lang['ALLOW_ROBOTS_INDEXING'] = 'Allow robots indexing this topic';
|
||||
|
||||
$lang['STORED'] = 'Your message has been entered successfully.';
|
||||
$lang['EDITED'] = 'The message has been changed';
|
||||
|
|
20
posting.php
20
posting.php
|
@ -249,8 +249,12 @@ if (!empty($bb_cfg['tor_cannot_edit']) && $post_info['allow_reg_tracker'] && $po
|
|||
}
|
||||
}
|
||||
|
||||
// Notify
|
||||
// Notify & Allow robots indexing
|
||||
$robots_indexing = $post_info['topic_allow_robots'] ?? true;
|
||||
if ($submit || $refresh) {
|
||||
if (IS_AM) {
|
||||
$robots_indexing = !empty($_POST['robots']);
|
||||
}
|
||||
$notify_user = (int)!empty($_POST['notify']);
|
||||
} else {
|
||||
$notify_user = bf($userdata['user_opt'], 'user_opt', 'user_notify');
|
||||
|
@ -334,7 +338,7 @@ if (($delete || $mode == 'delete') && !$confirm) {
|
|||
if (!$error_msg) {
|
||||
$topic_type = (isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce']) ? $post_data['topic_type'] : $topic_type;
|
||||
|
||||
\TorrentPier\Legacy\Post::submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time, $poster_rg_id, $attach_rg_sig);
|
||||
\TorrentPier\Legacy\Post::submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time, $poster_rg_id, $attach_rg_sig, (int)$robots_indexing);
|
||||
|
||||
$post_url = POST_URL . "$post_id#$post_id";
|
||||
$post_msg = ($mode == 'editpost') ? $lang['EDITED'] : $lang['STORED'];
|
||||
|
@ -496,9 +500,14 @@ if (!IS_GUEST) {
|
|||
}
|
||||
}
|
||||
|
||||
// Topic type selection
|
||||
$topic_type_toggle = '';
|
||||
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])) {
|
||||
// Allow robots indexing
|
||||
if (IS_AM) {
|
||||
$template->assign_var('SHOW_ROBOTS_CHECKBOX');
|
||||
}
|
||||
|
||||
// Topic type selection
|
||||
$template->assign_block_vars('switch_type_toggle', []);
|
||||
|
||||
if ($is_auth['auth_sticky']) {
|
||||
|
@ -613,11 +622,12 @@ $template->assign_vars([
|
|||
'MESSAGE' => $message,
|
||||
|
||||
'POSTER_RGROUPS' => !empty($poster_rgroups) ? $poster_rgroups : '',
|
||||
'ATTACH_RG_SIG' => ($switch_rg_sig) ?: false,
|
||||
'ATTACH_RG_SIG' => $switch_rg_sig ?: false,
|
||||
|
||||
'U_VIEWTOPIC' => ($mode == 'reply') ? TOPIC_URL . "$topic_id&postorder=desc" : '',
|
||||
|
||||
'S_NOTIFY_CHECKED' => ($notify_user) ? 'checked' : '',
|
||||
'S_NOTIFY_CHECKED' => $notify_user ? 'checked' : '',
|
||||
'S_ROBOTS_CHECKED' => $robots_indexing ? 'checked' : '',
|
||||
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
||||
'S_TOPIC_ID' => $topic_id,
|
||||
'S_POST_ACTION' => POSTING_URL,
|
||||
|
|
|
@ -90,10 +90,11 @@ class Post
|
|||
* @param bool $update_post_time
|
||||
* @param int $poster_rg_id
|
||||
* @param int $attach_rg_sig
|
||||
* @param int $robots_indexing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_rg_sig)
|
||||
public static function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_rg_sig, $robots_indexing)
|
||||
{
|
||||
global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore;
|
||||
|
||||
|
@ -140,9 +141,9 @@ class Post
|
|||
|
||||
$sql_insert = "
|
||||
INSERT INTO
|
||||
" . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type)
|
||||
" . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_allow_robots)
|
||||
VALUES
|
||||
('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type)
|
||||
('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $robots_indexing)
|
||||
";
|
||||
|
||||
$sql_update = "
|
||||
|
@ -151,7 +152,8 @@ class Post
|
|||
SET
|
||||
topic_title = '$post_subject',
|
||||
topic_type = $topic_type,
|
||||
topic_dl_type = $topic_dl_type
|
||||
topic_dl_type = $topic_dl_type,
|
||||
topic_allow_robots = $robots_indexing
|
||||
WHERE
|
||||
topic_id = $topic_id
|
||||
";
|
||||
|
|
|
@ -132,6 +132,12 @@
|
|||
<td><label for="notify">{L_NOTIFY}</label></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF SHOW_ROBOTS_CHECKBOX -->
|
||||
<tr>
|
||||
<td><input type="checkbox" id="robots" name="robots" {S_ROBOTS_CHECKED} /></td>
|
||||
<td><label for="robots">{L_ALLOW_ROBOTS_INDEXING}</label></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -113,6 +113,9 @@ $topic_id = $t_data['topic_id'];
|
|||
$forum_id = $t_data['forum_id'];
|
||||
$topic_attachment = isset($t_data['topic_attachment']) ? (int)$t_data['topic_attachment'] : null;
|
||||
|
||||
// Allow robots indexing
|
||||
$page_cfg['allow_robots'] = (bool)$t_data['topic_allow_robots'];
|
||||
|
||||
if ($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_porn_forums')) {
|
||||
bb_die($lang['ERROR_PORNO_FORUM']);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue