Prechádzať zdrojové kódy

! And this should remove the rest of send-topic. Just not needed any more.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 rokov pred
rodič
commit
fdb9dd1e7f

+ 0 - 3
Sources/Display.php

@@ -1063,7 +1063,6 @@ function Display()
 		'can_merge' => 'merge_any',
 		'can_split' => 'split_any',
 		'calendar_post' => 'calendar_post',
-		'can_send_topic' => 'send_topic',
 		'can_send_pm' => 'pm_send',
 		'can_send_email' => 'send_email_to_members',
 		'can_report_moderator' => 'report_any',
@@ -1113,7 +1112,6 @@ function Display()
 	$context['can_mark_unread'] = !$user_info['is_guest'];
 	$context['can_unwatch'] = !$user_info['is_guest'] && $modSettings['enable_unwatch'];
 
-	$context['can_send_topic'] = (!$modSettings['postmod_active'] || $topicinfo['approved']) && allowedTo('send_topic');
 	$context['can_print'] = empty($modSettings['disable_print_topic']);
 
 	// Start this off for quick moderation - it will be or'd for each post.
@@ -1183,7 +1181,6 @@ function Display()
 		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
 		'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
 		'unwatch' => array('test' => 'can_unwatch', 'text' => ($context['topic_unwatched'] ? '' : 'un') . 'watch', 'image' => ($context['topic_unwatched'] ? 'un' : '') . 'watch.png', 'lang' => true, 'url' => $scripturl . '?action=unwatchtopic;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sa=' . ($context['topic_unwatched'] ? 'off' : 'on') . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.png', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
 		'print' => array('test' => 'can_print', 'text' => 'print', 'image' => 'print.png', 'lang' => true, 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
 	);
 

+ 0 - 2
Sources/Security.php

@@ -450,7 +450,6 @@ function banPermissions()
 			'merge_any', 'split_any',
 			'modify_own', 'modify_any', 'modify_replies',
 			'move_any',
-			'send_topic',
 			'lock_own', 'lock_any',
 			'remove_own', 'remove_any',
 			'post_unapproved_topics', 'post_unapproved_replies_own', 'post_unapproved_replies_any',
@@ -1188,7 +1187,6 @@ function spamProtection($error_type)
 		'login' => 2,
 		'register' => 2,
 		'remind' => 30,
-		'sendtopic' => $modSettings['spamWaitTime'] * 4,
 		'sendmail' => $modSettings['spamWaitTime'] * 5,
 		'reporttm' => $modSettings['spamWaitTime'] * 4,
 		'search' => !empty($modSettings['search_floodcontrol_time']) ? $modSettings['search_floodcontrol_time'] : 1,

+ 1 - 105
Sources/SendTopic.php

@@ -30,118 +30,14 @@ function EmailUser()
 
 	$sub_actions = array(
 		'email' => 'CustomEmail',
-		'sendtopic' => 'SendTopic',
 	);
 
 	if (!isset($_GET['sa']) || !isset($sub_actions[$_GET['sa']]))
-		$_GET['sa'] = 'sendtopic';
+		$_GET['sa'] = 'email';
 
 	$sub_actions[$_GET['sa']]();
 }
 
-/**
- * Send a topic to a friend.
- * Uses the SendTopic template, with the main sub template.
- * Requires the send_topic permission.
- * Redirects back to the first page of the topic when done.
- * Is accessed via ?action=emailuser;sa=sendtopic.
- */
-function SendTopic()
-{
-	global $topic, $txt, $context, $scripturl, $sourcedir, $smcFunc, $modSettings;
-
-	// Check permissions...
-	isAllowedTo('send_topic');
-
-	// We need at least a topic... go away if you don't have one.
-	if (empty($topic))
-		fatal_lang_error('not_a_topic', false);
-
-	// Get the topic's subject.
-	$request = $smcFunc['db_query']('', '
-		SELECT m.subject, t.approved
-		FROM {db_prefix}topics AS t
-			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
-		WHERE t.id_topic = {int:current_topic}
-		LIMIT 1',
-		array(
-			'current_topic' => $topic,
-		)
-	);
-	if ($smcFunc['db_num_rows']($request) == 0)
-		fatal_lang_error('not_a_topic', false);
-	$row = $smcFunc['db_fetch_assoc']($request);
-	$smcFunc['db_free_result']($request);
-
-	// Can't send topic if its unapproved and using post moderation.
-	if ($modSettings['postmod_active'] && !$row['approved'])
-		fatal_lang_error('not_approved_topic', false);
-
-	// Censor the subject....
-	censorText($row['subject']);
-
-	// Sending yet, or just getting prepped?
-	if (empty($_POST['send']))
-	{
-		$context['page_title'] = sprintf($txt['sendtopic_title'], $row['subject']);
-		$context['start'] = $_REQUEST['start'];
-
-		return;
-	}
-
-	// Actually send the message...
-	checkSession();
-	spamProtection('sendtopic');
-
-	// This is needed for sendmail().
-	require_once($sourcedir . '/Subs-Post.php');
-
-	// Trim the names..
-	$_POST['y_name'] = trim($_POST['y_name']);
-	$_POST['r_name'] = trim($_POST['r_name']);
-
-	// Make sure they aren't playing "let's use a fake email".
-	if ($_POST['y_name'] == '_' || !isset($_POST['y_name']) || $_POST['y_name'] == '')
-		fatal_lang_error('no_name', false);
-	if (!isset($_POST['y_email']) || $_POST['y_email'] == '')
-		fatal_lang_error('no_email', false);
-	if (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['y_email']) == 0)
-		fatal_lang_error('email_invalid_character', false);
-
-	// The receiver should be valid to.
-	if ($_POST['r_name'] == '_' || !isset($_POST['r_name']) || $_POST['r_name'] == '')
-		fatal_lang_error('no_name', false);
-	if (!isset($_POST['r_email']) || $_POST['r_email'] == '')
-		fatal_lang_error('no_email', false);
-	if (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['r_email']) == 0)
-		fatal_lang_error('email_invalid_character', false);
-
-	// Emails don't like entities...
-	$row['subject'] = un_htmlspecialchars($row['subject']);
-
-	$replacements = array(
-		'TOPICSUBJECT' => $row['subject'],
-		'SENDERNAME' => $_POST['y_name'],
-		'RECPNAME' => $_POST['r_name'],
-		'TOPICLINK' => $scripturl . '?topic=' . $topic . '.0',
-	);
-
-	$emailtemplate = 'send_topic';
-
-	if (!empty($_POST['comment']))
-	{
-		$emailtemplate .= '_comment';
-		$replacements['COMMENT'] = $_POST['comment'];
-	}
-
-	$emaildata = loadEmailTemplate($emailtemplate, $replacements);
-	// And off we go!
-	sendmail($_POST['r_email'], $emaildata['subject'], $emaildata['body'], $_POST['y_email'], 'sendtopic');
-
-	// Back to the topic!
-	redirectexit('topic=' . $topic . '.0;topicsent');
-}
-
 /**
  * Allow a user to send an email.
  * Send an email to the user - allow the sender to write the message.

+ 0 - 76
Themes/default/SendTopic.template.php

@@ -14,19 +14,6 @@
 /*	This template contains two humble sub templates - main. Its job is pretty
 	simple: it collects the information we need to actually send the topic.
 
-	The main sub template gets shown from:
-		'?action=emailuser;sa=sendtopic;topic=##.##'
-	And should submit to:
-		'?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.' . $context['start']
-	It should send the following fields:
-		y_name: sender's name.
-		y_email: sender's email.
-		comment: any additional comment.
-		r_name: receiver's name.
-		r_email: receiver's email address.
-		send: this just needs to be set, as by the submit button.
-		sc: the session id, or $context['session_id'].
-
 	The report sub template gets shown from:
 		'?action=reporttm;topic=##.##;msg=##'
 	It should submit to:
@@ -36,69 +23,6 @@
 		sc: the session id, or $context['session_id'].
 */
 
-// This is where we get information about who they want to send the topic to, etc.
-function template_main()
-{
-	global $context, $txt, $scripturl;
-
-	echo '
-	<div id="send_topic">
-		<form action="', $scripturl, '?action=emailuser;sa=sendtopic;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
-			<div class="cat_bar">
-				<h3 class="catbg">
-					<span class="generic_icons mail icon"></span>', $context['page_title'], '
-				</h3>
-			</div>
-			<div class="windowbg2">
-				<div class="content">
-					<fieldset id="sender" class="send_topic">
-						<dl class="settings send_topic">
-							<dt>
-								<label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
-							</dt>
-							<dd>
-								<input type="text" id="y_name" name="y_name" size="30" maxlength="40" value="', $context['user']['name'], '" class="input_text">
-							</dd>
-							<dt>
-								<label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label>
-							</dt>
-							<dd>
-								<input type="text" id="y_email" name="y_email" size="30" maxlength="50" value="', $context['user']['email'], '" class="input_text">
-							</dd>
-							<dt>
-								<label for="comment"><strong>', $txt['sendtopic_comment'], ':</strong></label>
-							</dt>
-							<dd>
-								<input type="text" id="comment" name="comment" size="30" maxlength="100" class="input_text">
-							</dd>
-						</dl>
-					</fieldset>
-					<fieldset id="recipient" class="send_topic">
-						<dl class="settings send_topic">
-							<dt>
-								<label for="r_name"><strong>', $txt['sendtopic_receiver_name'], ':</strong></label>
-							</dt>
-							<dd>
-								<input type="text" id="r_name" name="r_name" size="30" maxlength="40" class="input_text">
-							</dd>
-							<dt>
-								<label for="r_email"><strong>', $txt['sendtopic_receiver_email'], ':</strong></label>
-							</dt>
-							<dd>
-								<input type="text" id="r_email" name="r_email" size="30" maxlength="50" class="input_text">
-							</dd>
-						</dl>
-					</fieldset>
-					<div class="flow_auto">
-						<input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit">
-						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
-					</div>
-				</div>
-			</div>
-		</form>
-	</div>';
-}
-
 // Send an email to a user!
 function template_custom_email()
 {

+ 0 - 40
Themes/default/languages/EmailTemplates.english.php

@@ -407,46 +407,6 @@ Please log in to the forum to review these items.
 
 {REGARDS}';
 
-/**
-	@additional_params: send_topic
-		TOPICSUBJECT: The subject of the topic being sent.
-		SENDERNAME: The name of the member sending the topic.
-		RECPNAME: The name of the person receiving the email.
-		TOPICLINK: A link to the topic being sent.
-	@description:
-*/
-$txt['send_topic_subject'] = 'Topic: {TOPICSUBJECT} (From: {SENDERNAME})';
-$txt['send_topic_body'] = 'Dear {RECPNAME},
-I want you to check out "{TOPICSUBJECT}" on {FORUMNAME}.  To view it, please click this link:
-
-{TOPICLINK}
-
-Thanks,
-
-{SENDERNAME}';
-
-/**
-	@additional_params: send_topic_comment
-		TOPICSUBJECT: The subject of the topic being sent.
-		SENDERNAME: The name of the member sending the topic.
-		RECPNAME: The name of the person receiving the email.
-		TOPICLINK: A link to the topic being sent.
-		COMMENT: A comment left by the sender.
-	@description:
-*/
-$txt['send_topic_comment_subject'] = 'Topic: {TOPICSUBJECT} (From: {SENDERNAME})';
-$txt['send_topic_comment_body'] = 'Dear {RECPNAME},
-I want you to check out "{TOPICSUBJECT}" on {FORUMNAME}.  To view it, please click this link:
-
-{TOPICLINK}
-
-A comment has also been added regarding this topic:
-{COMMENT}
-
-Thanks,
-
-{SENDERNAME}';
-
 /**
 	@additional_params: send_email
 		EMAILSUBJECT: The subject the user wants to email.

+ 0 - 3
Themes/default/languages/Errors.english.php

@@ -23,7 +23,6 @@ $txt['username_reserved'] = 'The username you tried to use contains the reserved
 $txt['numbers_one_to_nine'] = 'This field only accepts numbers from 0-9';
 $txt['not_a_user'] = 'The user whose profile you are trying to view does not exist.';
 $txt['not_a_topic'] = 'This topic doesn\'t exist on this board.';
-$txt['not_approved_topic'] = 'This topic has not been approved yet.';
 $txt['email_in_use'] = 'That email address (%1$s) is being used by a registered member already. If you feel this is a mistake, go to the login page and use the password reminder with that address.';
 $txt['attachments_no_write'] = 'The attachments directory is not writable';
 
@@ -127,7 +126,6 @@ $txt['cannot_report_any'] = 'You are not allowed to report posts in this board.'
 $txt['cannot_search_posts'] = 'You are not allowed to search for posts in this forum.';
 $txt['cannot_send_mail'] = 'You don\'t have the privilege of sending out emails to everyone.';
 $txt['cannot_issue_warning'] = 'Sorry, you do not have permission to issue warnings to members.';
-$txt['cannot_send_topic'] = 'Sorry, but the administrator has disallowed sending topics on this board.';
 $txt['cannot_send_email_to_members'] = 'Sorry, but the administrator has disallowed sending emails on this board.';
 $txt['cannot_split_any'] = 'Splitting just any topic is not allowed in this board.';
 $txt['cannot_view_attachments'] = 'It seems that you are not allowed to download or view attachments on this board.';
@@ -213,7 +211,6 @@ $txt['register_WaitTime_broken'] = 'You already registered just %1$d seconds ago
 $txt['login_WaitTime_broken'] = 'You will have to wait about %1$d seconds to login again, sorry.';
 $txt['pm_WaitTime_broken'] = 'The last personal message from your IP was less than %1$d seconds ago. Please try again later.';
 $txt['reporttm_WaitTime_broken'] = 'The last topic report from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['sendtopic_WaitTime_broken'] = 'The last topic sent from your IP was less than %1$d seconds ago. Please try again later.';
 $txt['sendmail_WaitTime_broken'] = 'The last email sent from your IP was less than %1$d seconds ago. Please try again later.';
 $txt['search_WaitTime_broken'] = 'Your last search was less than %1$d seconds ago. Please try again later.';
 $txt['remind_WaitTime_broken'] = 'Your last reminder was less than %1$d seconds ago. Please try again later.';

+ 0 - 1
Themes/default/languages/Reports.english.php

@@ -62,7 +62,6 @@ $txt['board_perms_name_post_autosave_draft'] = 'Automatically save drafts of pos
 $txt['board_perms_name_remove_any'] = 'Remove any topic';
 $txt['board_perms_name_remove_own'] = 'Remove own topics';
 $txt['board_perms_name_report_any'] = 'Report any post';
-$txt['board_perms_name_send_topic'] = 'Send topics to friends';
 $txt['board_perms_name_split_any'] = 'Split any topics';
 $txt['board_perms_name_view_attachments'] = 'View attachments';
 

+ 0 - 1
Themes/default/languages/Who.english.php

@@ -80,7 +80,6 @@ $txt['whotopic_printpage'] = 'Printing the topic &quot;<a href="' . $scripturl .
 $txt['whotopic_quickmod2'] = 'Moderating the topic <a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>.';
 $txt['whotopic_removepoll'] = 'Removing the poll in &quot;<a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>&quot;.';
 $txt['whotopic_removetopic2'] = 'Removing the topic <a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>.';
-$txt['whotopic_sendtopic'] = 'Sending the topic &quot;<a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>&quot; to a friend.';
 $txt['whotopic_splittopics'] = 'Splitting the topic &quot;<a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>&quot; into two topics.';
 $txt['whotopic_sticky'] = 'Setting the topic &quot;<a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>&quot; as sticky.';
 $txt['whotopic_vote'] = 'Voting in <a href="' . $scripturl . '?topic=%1$d.0">%2$s</a>.';

+ 0 - 2
Themes/default/languages/index.english.php

@@ -363,12 +363,10 @@ $txt['send_topic'] = 'Send this topic';
 $txt['watch'] = 'Watch';
 $txt['unwatch'] = 'Stop watching';
 
-$txt['sendtopic_title'] = 'Send the topic &quot;%1$s&quot; to a friend.';
 $txt['sendtopic_sender_name'] = 'Your name';
 $txt['sendtopic_sender_email'] = 'Your email address';
 $txt['sendtopic_receiver_name'] = 'Recipient\'s name';
 $txt['sendtopic_receiver_email'] = 'Recipient\'s email address';
-$txt['sendtopic_comment'] = 'Add a comment';
 
 $txt['allow_user_email'] = 'Allow users to email me';
 

+ 0 - 1
index.php

@@ -334,7 +334,6 @@ function smf_main()
 		'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'),
 		'search' => array('Search.php', 'PlushSearch1'),
 		'search2' => array('Search.php', 'PlushSearch2'),
-		'sendtopic' => array('SendTopic.php', 'EmailUser'),
 		'smstats' => array('Stats.php', 'SMStats'),
 		'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'),
 		'spellcheck' => array('Subs-Post.php', 'SpellCheck'),