Completed
Pull Request — release-2.1 (#4924)
by Jeremy
08:56
created

ManageMail.template.php ➔ template_mailtest()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 0
dl 0
loc 25
rs 9.52
c 0
b 0
f 0
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines http://www.simplemachines.org
7
 * @copyright 2018 Simple Machines and individual contributors
8
 * @license http://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 Beta 4
11
 */
12
13
/**
14
 * Template for browsing the mail queue.
15
 */
16
function template_browse()
17
{
18
	global $context, $txt;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
19
20
	echo '
21
	<div id="manage_mail">
22
		<div id="mailqueue_stats">
23
			<div class="cat_bar">
24
				<h3 class="catbg">', $txt['mailqueue_stats'], '</h3>
25
			</div>
26
			<div class="windowbg">
27
				<dl class="settings">
28
					<dt><strong>', $txt['mailqueue_size'], '</strong></dt>
29
					<dd>', $context['mail_queue_size'], '</dd>
30
					<dt><strong>', $txt['mailqueue_oldest'], '</strong></dt>
31
					<dd>', $context['oldest_mail'], '</dd>
32
				</dl>
33
			</div>
34
		</div>';
35
36
	template_show_list('mail_queue');
37
38
	echo '
39
	</div>';
40
}
41
42
/**
43
 * Template for testing mail send.
44
 */
45
46
function template_mailtest()
47
{
48
	global $context, $txt;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
49
50
	// The results.
51
	if (!empty($context['result']))
52
		echo '
53
					<div class="', $context['result'] == 'success' ? 'infobox' : 'errorbox', '">', $txt['mailtest_result_' . $context['result']], '</div>';
54
55
	echo '
56
	<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post">
57
		<div class="cat_bar">
58
			<h3 class="catbg">', $txt['mailtest_header'], '</h3>
59
		</div>
60
		<div class="windowbg noup">
61
				<dl id="post_header">
62
					<dt><span id="caption_subject">', $txt['subject'], '</span></dt>
63
					<dd><input type="text" name="subject" tabindex="1" size="80" maxlength="80"></dd>
64
				</dl>
65
				<textarea class="editor" name="message" rows="12" cols="60" tabindex="2" style="width: 90%; height: 150px;"></textarea>
66
				<dl id="post_footer">
67
					<dd><input type="submit" value="', $txt['send_message'], '" />
68
		</div>
69
	</form>';
70
}
71
72
?>