Projet

Général

Profil

« Précédent | Suivant » 

Révision a03fb095

Ajouté par Renato Botelho il y a plus de 9 ans

Remove some redundancy and simplify changes made on last commit

Voir les différences:

usr/local/www/status_interfaces.php
46 46
require_once("shaper.inc");
47 47
require_once("filter.inc");
48 48

  
49
if ($_POST['if']) {
49
if ($_POST['if'] && $_POST['submit']) {
50 50
	$interface = $_POST['if'];
51
	if ($_POST['action'] == "disconnect" || $_POST['action'] == "release") {
51
	if ($_POST['status'] == "up")
52 52
		interface_bring_down($interface);
53
	} else if ($_POST['action'] == "connect" || $_POST['action'] == "renew") {
53
	else
54 54
		interface_configure($interface); 
55
	}
56 55
	header("Location: status_interfaces.php");
57 56
	exit;
58 57
}
......
97 96
		</td>
98 97
		<td width="78%" class="listr">
99 98
			<form name="dhcplink_form" action="status_interfaces.php" method="post">
99
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
100
				<input type="hidden" name="status" value="<?php echo $ifinfo['dhcplink']; ?>" />
100 101
				<?=htmlspecialchars($ifinfo['dhcplink']);?>&nbsp;&nbsp;
101
				<?php if ($ifinfo['dhcplink'] == "up"): ?>
102
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
103
					<input type="hidden" name="action" value="release" />
104
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Release"); ?>" />
105
				<?php else: ?>
106
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
107
					<input type="hidden" name="action" value="renew" />
108
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Renew"); ?>" />
109
				<?php endif; ?>
102
				<?php $action = ($ifinfo['dhcplink'] == "up" ? gettext("Release") : gettext("Renew")); ?>
103
				<input type="submit" name="submit" class="formbtn" value="<?php echo $action; ?>" />
110 104
			</form>
111 105
		</td>
112 106
	</tr>
......
118 112
		</td>
119 113
		<td width="78%" class="listr">
120 114
			<form name="dhcp6link_form" action="status_interfaces.php" method="post">
115
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
116
				<input type="hidden" name="status" value="<?php echo $ifinfo['dhcp6link']; ?>" />
121 117
				<?=htmlspecialchars($ifinfo['dhcp6link']);?>&nbsp;&nbsp;
122
				<?php if ($ifinfo['dhcp6link'] == "up"): ?>
123
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
124
					<input type="hidden" name="action" value="release" />
125
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Release"); ?>" />
126
				<?php else: ?>
127
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
128
					<input type="hidden" name="action" value="renew" />
129
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Renew"); ?>" />
130
				<?php endif; ?>
118
				<?php $action = ($ifinfo['dhcp6link'] == "up" ? gettext("Release") : gettext("Renew")); ?>
119
				<input type="submit" name="submit" class="formbtn" value="<?php echo $action; ?>" />
131 120
			</form>
132 121
		</td>
133 122
	</tr>
......
136 125
		<td width="22%" class="vncellt"><?=gettext("PPPoE"); ?></td>
137 126
		<td width="78%" class="listr">
138 127
			<form name="pppoelink_form" action="status_interfaces.php" method="post">
128
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
129
				<input type="hidden" name="status" value="<?php echo $ifinfo['pppoelink']; ?>" />
139 130
				<?=htmlspecialchars($ifinfo['pppoelink']);?>&nbsp;&nbsp;
140
				<?php if ($ifinfo['pppoelink'] == "up"): ?>
141
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
142
					<input type="hidden" name="action" value="disconnect" />
143
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Disconnect"); ?>" />
144
				<?php else: ?>
145
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
146
					<input type="hidden" name="action" value="connect" />
147
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Connect"); ?>" />
148
				<?php endif; ?>
131
				<?php $action = ($ifinfo['pppoelink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?>
132
				<input type="submit" name="submit" class="formbtn" value="<?php echo $action; ?>" />
149 133
			</form>
150 134
		</td>
151 135
	</tr>
......
154 138
		<td width="22%" class="vncellt"><?=gettext("PPTP"); ?></td>
155 139
		<td width="78%" class="listr">
156 140
			<form name="pptplink_form" action="status_interfaces.php" method="post">
141
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
142
				<input type="hidden" name="status" value="<?php echo $ifinfo['pptplink']; ?>" />
157 143
				<?=htmlspecialchars($ifinfo['pptplink']);?>&nbsp;&nbsp;
158
				<?php if ($ifinfo['pptplink'] == "up"): ?>
159
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
160
					<input type="hidden" name="action" value="disconnect" />
161
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Disconnect"); ?>" />
162
				<?php else: ?>
163
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
164
					<input type="hidden" name="action" value="connect" />
165
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Connect"); ?>" />
166
				<?php endif; ?>
144
				<?php $action = ($ifinfo['pptplink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?>
145
				<input type="submit" name="submit" class="formbtn" value="<?php echo $action; ?>" />
167 146
			</form>
168 147
		</td>
169 148
	</tr>
......
172 151
		<td width="22%" class="vncellt"><?=gettext("L2TP"); ?></td>
173 152
		<td width="78%" class="listr">
174 153
			<form name="l2tplink_form" action="status_interfaces.php" method="post">
154
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
155
				<input type="hidden" name="status" value="<?php echo $ifinfo['l2tplink']; ?>" />
175 156
				<?=htmlspecialchars($ifinfo['l2tplink']);?>&nbsp;&nbsp;
176
				<?php if ($ifinfo['l2tplink'] == "up"): ?>
177
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
178
					<input type="hidden" name="action" value="disconnect" />
179
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Disconnect"); ?>" />
180
				<?php else: ?>
181
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
182
					<input type="hidden" name="action" value="connect" />
183
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Connect"); ?>" />
184
				<?php endif; ?>
157
				<?php $action = ($ifinfo['l2tplink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?>
158
				<input type="submit" name="submit" class="formbtn" value="<?php echo $action; ?>" />
185 159
			</form>
186 160
		</td>
187 161
	</tr>
......
190 164
		<td width="22%" class="vncellt"><?=gettext("PPP"); ?></td>
191 165
		<td width="78%" class="listr">
192 166
			<form name="ppplink_form" action="status_interfaces.php" method="post">
167
				<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
168
				<input type="hidden" name="status" value="<?php echo $ifinfo['ppplink']; ?>" />
193 169
				<?=htmlspecialchars($ifinfo['pppinfo']);?>
194 170
				<?php if ($ifinfo['ppplink'] == "up"): ?>
195
					<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
196
					<input type="hidden" name="action" value="disconnect" />
197 171
					<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Disconnect"); ?>" />
198 172
				<?php else: ?>
199 173
					<?php if (!$ifinfo['nodevice']): ?>
200
						<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" />
201
						<input type="hidden" name="action" value="connect" />
202 174
						<input type="submit" name="submit" class="formbtn" value="<?php echo gettext("Connect"); ?>" />
203 175
					<?php endif; ?>
204 176
				<?php endif; ?>

Formats disponibles : Unified diff