Passed
Push — master ( fc2135...8f2b4c )
by John
01:25
created

ManageUltimateMenu.template.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * @package Ultimate Menu mod
5
 * @version 1.0.3
6
 * @author John Rayes <[email protected]>
7
 * @copyright Copyright (c) 2014, John Rayes
8
 * @license http://opensource.org/licenses/MIT MIT
9
 */
10
11
function template_main()
12
{
13
	global $context, $scripturl, $txt, $settings;
14
15
	echo '
16
		<form action="', $scripturl, '?action=admin;area=umen;sa=savebutton" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden">
17
			<div class="cat_bar">
18
				<h3 class="catbg">
19
					', $context['page_title'], '
20
				</h3>
21
			</div>
22
			<span class="upperframe"><span></span></span>
23
				<div class="roundframe">';
24
25
	// If an error occurred, explain what happened.
26
	if (!empty($context['post_error']))
27
	{
28
		echo '
29
					<div class="errorbox" id="errors">
30
						<strong>', $txt[$context['error_title']], '</strong>
31
						<ul>';
32
33
		foreach ($context['post_error'] as $error)
34
			echo '
35
							<li>', $txt[$error], '</li>';
36
37
		echo '
38
						</ul>
39
					</div>';
40
	}
41
42
	echo '
43
					<dl class="settings">
44
						<dt>
45
							<strong>', $txt['um_menu_button_name'], ':</strong>
46
						</dt>
47
						<dd>
48
							<input type="text" name="name" id="bnbox" value="', $context['button_data']['name'], '" tabindex="1" class="input_text" style="width: 100%;" />
49
						</dd>
50
						<dt>
51
							<strong>', $txt['um_menu_button_position'], ':</strong>
52
						</dt>
53
						<dd>
54
							<select name="position" size="10" style="width: 22%;" onchange="this.form.position.disabled = this.options[this.selectedIndex].value == \'\';">
55
								<option value="after"', $context['button_data']['position'] == 'after' ? ' selected="selected"' : '', '>' . $txt['mboards_order_after'] . '...</option>
56
								<option value="child_of"', $context['button_data']['position'] == 'child_of' ? ' selected="selected"' : '', '>' . $txt['mboards_order_child_of'] . '...</option>
57
								<option value="before"', $context['button_data']['position'] == 'before' ? ' selected="selected"' : '', '>' . $txt['mboards_order_before'] . '...</option>
58
							</select>
59
							<select name="parent" size="10" style="width: 75%;">';
60
61
	foreach ($context['menu_buttons'] as $buttonIndex => $buttonData)
62
	{
63
		echo '
64
									<option value="', $buttonIndex, '"', $context['button_data']['parent'] == $buttonIndex ? ' selected="selected"' : '', '>', $buttonData['title'], '</option>';
65
66
		if (!empty($buttonData['sub_buttons']))
67
		{
68
			foreach ($buttonData['sub_buttons'] as $childButton => $childButtonData)
69
				echo '
70
									<option value="', $childButton, '"', $context['button_data']['parent'] == $childButton ? ' selected="selected"' : '', '>-- ', $childButtonData['title'], '</option>';
71
72
			if (!empty($childButtonData['sub_buttons']))
73
				foreach ($childButtonData['sub_buttons'] as $grandChildButton => $grandChildButtonData)
74
					echo '
75
									<option value="', $grandChildButton, '"', $context['button_data']['parent'] == $grandChildButton ? ' selected="selected"' : '', '>---- ', $grandChildButtonData['title'], '</option>';
76
		}
77
	}
78
79
	echo '
80
							</select>
81
						</dd>
82
						<dt>
83
							<strong>', $txt['um_menu_button_type'], ':</strong>
84
						</dt>
85
						<dd>
86
							<input type="radio" class="input_check" name="type" value="forum"', $context['button_data']['type'] == 'forum' ? ' checked="checked"' : '', '/>', $txt['um_menu_forum'], '<br />
87
							<input type="radio" class="input_check" name="type" value="external"', $context['button_data']['type'] == 'external' ? ' checked="checked"' : '', '/>', $txt['um_menu_external'], '
88
						</dd>
89
						<dt>
90
							<strong>', $txt['um_menu_link_type'], ':</strong>
91
						</dt>
92
						<dd>
93
							<input type="radio" class="input_check" name="target" value="_self"', $context['button_data']['target'] == '_self' ? ' checked="checked"' : '', '/>', $txt['um_menu_same_window'], '<br />
94
							<input type="radio" class="input_check" name="target" value="_blank"', $context['button_data']['target'] == '_blank' ? ' checked="checked"' : '', '/>', $txt['um_menu_new_tab'], '
95
						</dd>
96
						<dt>
97
							<strong>', $txt['um_menu_button_link'], ':</strong><br />
98
						</dt>
99
						<dd>
100
							<input type="text" name="link" value="', $context['button_data']['link'], '" tabindex="1" class="input_text" style="width: 100%;" />
101
							<span class="smalltext">', $txt['um_menu_button_link_desc'], '</span>
102
						</dd>
103
						<dt>
104
							<strong>', $txt['um_menu_button_perms'], ':</strong>
105
						</dt>
106
						<dd>
107
							<fieldset id="group_perms">
108
								<legend><a href="#" onclick="this.parentNode.parentNode.style.display = \'none\';document.getElementById(\'group_perms_groups_link\').style.display = \'block\'; return false;">', $txt['avatar_select_permission'], '</a></legend>';
109
110
	$all_checked = true;
111
112
	// List all the groups to configure permissions for.
113
	foreach ($context['button_data']['permissions'] as $permission)
114
	{
115
		echo '
116
								<div id="permissions_', $permission['id'], '">
117
									<label for="check_group', $permission['id'], '">
118
										<input type="checkbox" class="input_check" name="permissions[]" value="', $permission['id'], '" id="check_group', $permission['id'], '"', $permission['checked'] ? ' checked="checked"' : '', ' />
119
										<span', ($permission['is_post_group'] ? ' class="border-bottom" title="' . $txt['mboards_groups_post_group'] . '"' : ''), '>', $permission['name'], '</span>
120
									</label>
121
								</div>';
122
123
		if (!$permission['checked'])
124
			$all_checked = false;
125
	}
126
127
	echo '
128
								<input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'permissions[]\');" id="check_group_all"', $all_checked ? ' checked="checked"' : '', ' />
129
								<label for="check_group_all"><em>', $txt['check_all'], '</em></label><br />
130
							</fieldset>
131
							<a href="#" onclick="document.getElementById(\'group_perms\').style.display = \'block\'; this.style.display = \'none\'; return false;" id="group_perms_groups_link" style="display: none;">[ ', $txt['avatar_select_permission'], ' ]</a>
132
							<script type="text/javascript"><!-- // --><![CDATA[
133
								document.getElementById("group_perms").style.display = "none";
134
								document.getElementById("group_perms_groups_link").style.display = "";
135
							// ]]></script>
136
						</dd>
137
						<dt>
138
							<strong>', $txt['um_menu_button_status'], ':</strong>
139
						</dt>
140
						<dd>
141
							<input type="radio" class="input_check" name="status" value="active"', $context['button_data']['status'] == 'active' ? ' checked="checked"' : '', ' />', $txt['um_menu_button_active'], ' <br />
142
							<input type="radio" class="input_check" name="status" value="inactive"', $context['button_data']['status'] == 'inactive' ? ' checked="checked"' : '', ' />', $txt['um_menu_button_inactive'], '
143
						</dd>
144
					</dl>
145
					<input name="in" value="', $context['button_data']['id'], '" type="hidden" />
146
					<div class="righttext padding">
147
						<input name="submit" value="', $txt['admin_manage_menu_submit'], '" class="button_submit" type="submit" />
148
					</div>
149
				</div>
150
			</form>
151
			<span class="lowerframe"><span></span></span>
152
			<br class="clear" />';
153
}
154
155
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...