Projet

Général

Profil

0001-Factorise-saml-tabs-in-a-function.patch

Jérôme Schneider, 22 octobre 2014 16:24

Télécharger (5,42 ko)

Voir les différences:

Subject: [PATCH 1/3] Factorise saml tabs in a function

 etc/inc/captiveportal_saml.inc                         | 18 ++++++++++++++++++
 .../www/services_captiveportal_saml_federation.php     | 12 ++----------
 usr/local/www/services_captiveportal_saml_sp.php       | 11 ++---------
 .../www/services_captiveportal_saml_whitelist.php      | 10 ++--------
 4 files changed, 24 insertions(+), 27 deletions(-)
 create mode 100644 etc/inc/captiveportal_saml.inc
etc/inc/captiveportal_saml.inc
1
<?php
2

  
3
function display_saml_tabs($file_name) {
4
    $tab_array = array();
5
    $tab_array[] = array(gettext("Service provider"), false, "services_captiveportal_saml_sp.php");
6
    # $tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
7
    $tab_array[] = array(gettext("Federations"), false, "services_captiveportal_saml_federation.php");
8
    $tab_array[] = array(gettext("Whitelists"), false, "services_captiveportal_saml_whitelist.php");
9
    $tab_array[] = array(gettext("Blacklists"), false, "services_captiveportal_saml_blacklist.php");
10
    for ($i = 0; $i < sizeof($tab_array); $i++) {
11
        if ($tab_array[$i][2] == $file_name) {
12
            $tab_array[$i][1] = true;
13
        }
14
    }
15
    display_top_tabs($tab_array);
16
}
17

  
18
?>
usr/local/www/services_captiveportal_saml_federation.php
38 38
##|-PRIV
39 39

  
40 40
require("guiconfig.inc");
41
require_once("captiveportal_saml.inc");
41 42
require_once("certs.inc");
42 43

  
43 44
$pgtitle = array(gettext("Service"), gettext("Captive portal"),"SAML 2.0 Federations");
......
197 198

  
198 199
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="CA manager">
199 200
	<tr>
200
		<td>
201
		<?php
202
			$tab_array = array();
203
			$tab_array[] = array(gettext("Service provider"), false, "services_captiveportal_saml_sp.php");
204
			# $tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
205
			$tab_array[] = array(gettext("Federations"), true, "services_captiveportal_saml_federation.php");
206
			$tab_array[] = array(gettext("Whitelists"), false, "services_captiveportal_saml_whitelist.php");
207
			display_top_tabs($tab_array);
208
		?>
209
		</td>
201
		<td><?php display_saml_tabs(basename(__FILE__));  ?></td>
210 202
	</tr>
211 203
	<tr>
212 204
		<td id="mainarea">
usr/local/www/services_captiveportal_saml_sp.php
44 44
require_once("filter.inc");
45 45
require_once("shaper.inc");
46 46
require_once("captiveportal.inc");
47
require_once("captiveportal_saml.inc");
47 48

  
48 49
if (!is_array($config['captiveportal']))
49 50
	$config['captiveportal'] = array();
......
109 110
<form action="services_captiveportal_saml_sp.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
110 111

  
111 112
<table width="100%" border="0" cellpadding="0" cellspacing="0">
112
  <tr><td class="tabnavtbl">
113
<?php
114
	$tab_array = array();
115
	$tab_array[] = array(gettext("Service provider"), true, "services_captiveportal_saml_sp.php");
116
	# $tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
117
	$tab_array[] = array(gettext("Federations"), false, "services_captiveportal_saml_federation.php");
118
	$tab_array[] = array(gettext("Whitelists"), false, "services_captiveportal_saml_whitelist.php");
119
	display_top_tabs($tab_array, true);
120
?>    </td></tr>
113
  <tr><td class="tabnavtbl"><?php display_saml_tabs(basename(__FILE__)); ?></td></tr>
121 114
  <tr>
122 115
  <td class="tabcont">
123 116
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
usr/local/www/services_captiveportal_saml_whitelist.php
39 39

  
40 40
require("guiconfig.inc");
41 41
require_once("certs.inc");
42
require_once("captiveportal_saml.inc");
42 43

  
43 44
$pgtitle = array(gettext("Service"), gettext("Captive portal"),"SAML 2.0 Whitelists");
44 45
$shortcut_section = "captiveportal";
......
189 190
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="CA manager">
190 191
	<tr>
191 192
		<td>
192
		<?php
193
			$tab_array = array();
194
			$tab_array[] = array(gettext("Service provider"), false, "services_captiveportal_saml_sp.php");
195
			# $tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
196
			$tab_array[] = array(gettext("Federations"), false, "services_captiveportal_saml_federation.php");
197
			$tab_array[] = array(gettext("Whitelists"), true, "services_captiveportal_saml_whitelist.php");
198
			display_top_tabs($tab_array);
199
		?>
193
		<?php display_saml_tabs(basename(__FILE__)); ?>
200 194
		</td>
201 195
	</tr>
202 196
	<tr>
203
-