firewall_aliases_edit.php 24.3 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
  Copyright (C) 2014 Deciso B.V.
  Copyright (C) 2004 Scott Ullrich
  Copyright (C) 2009 Ermal Luçi
  Copyright (C) 2010 Jim Pingle
  Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.
Ad Schellevis's avatar
Ad Schellevis committed
31 32
*/

33
require_once("guiconfig.inc");
34
require_once("pfsense-utils.inc");
Ad Schellevis's avatar
Ad Schellevis committed
35

36
if (!isset($config['aliases']) || !is_array($config['aliases'])) {
37
    $config['aliases'] = array();
38 39
}
if (!isset($config['aliases']['alias'])) {
40
    $config['aliases']['alias'] = array();
Ad Schellevis's avatar
Ad Schellevis committed
41
}
42
$a_aliases = &$config['aliases']['alias'];
Ad Schellevis's avatar
Ad Schellevis committed
43

44 45
$pconfig = array();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
46 47 48
    if (isset($_GET['id']) && is_numericint($_GET['id']) && isset($a_aliases[$_GET['id']])) {
        $id = $_GET['id'];
        foreach (array("name","detail","address","type","descr","updatefreq","aliasurl","url") as $fieldname) {
49 50 51 52 53
            if (isset($a_aliases[$id][$fieldname])) {
                $pconfig[$fieldname] = $a_aliases[$id][$fieldname];
            } else {
                $pconfig[$fieldname] = null;
            }
54 55 56
        }
        // convert to array if only one is provided
        if (!empty($pconfig['aliasurl']) && !is_array($pconfig['aliasurl'])) {
57
            $pconfig['aliasurl'] = array($pconfig['aliasurl']);
58 59
        }
    } elseif (isset($_GET['name'])) {
60 61 62 63 64 65 66 67 68
        // search alias by name
        foreach ($a_aliases as $alias_id => $alias_data) {
            if (strtolower($alias_data['name']) == strtolower(trim($_GET['name']))) {
                $id = $alias_id;
                break;
            }
        }
        // initialize form fields, when not found present empty form
        foreach (array("name","detail","address","type","descr","updatefreq","aliasurl","url") as $fieldname) {
69 70 71 72 73
            if (isset($id) && isset($a_aliases[$id][$fieldname])) {
                $pconfig[$fieldname] = $a_aliases[$id][$fieldname];
            } else {
                $pconfig[$fieldname] = null;
            }
74
        }
75
    } else {
76 77 78
        // init empty
        $init_fields = array("name","detail","address","type","descr","updatefreq","url");
        foreach ($init_fields as $fieldname) {
79
            $pconfig[$fieldname] = null;
80 81
        }
    }
82
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
    $pconfig = $_POST;
    if (isset($_POST['id']) && is_numericint($_POST['id']) && isset($a_aliases[$_POST['id']])) {
        $id = $_POST['id'];
    }

    // fix form type conversions ( list to string, as saved in config )
    // -- fill in default row description and make sure separators are removed
    if (strpos($pconfig['type'],'urltable') !== false) {
        $pconfig['url'] = $pconfig['host_url'][0];
    } elseif (strpos($pconfig['type'],'url') !== false) {
        $pconfig['aliasurl'] = $pconfig['host_url'];
    } else {
        $pconfig['address'] = implode(' ',$pconfig['host_url']);
    }
    unset($pconfig['host_url']);
    foreach ($pconfig['detail'] as &$detailDescr) {
        if (empty($detailDescr)) {
            $detailDescr = sprintf(gettext("Entry added %s"), date('r'));
        } else {
            // trim and strip pipes
            $detailDescr = trim(str_replace('|',' ' , $detailDescr));
        }
    }
    $pconfig['detail'] = implode('||', $pconfig['detail']);

    if (isset($pconfig['submit'])) {
        $input_errors = array();
        // validate data

        /* Check for reserved keyword names */
        // Keywords not allowed in names
        $reserved_keywords = array("all", "pass", "block", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");

        // Add all Load balance names to reserved_keywords
        if (is_array($config['load_balancer']['lbpool']))
118 119
            foreach ($config['load_balancer']['lbpool'] as $lbpool)
                $reserved_keywords[] = $lbpool['name'];
120 121 122 123

        $reserved_ifs = get_configured_interface_list(false, true);
        $reserved_keywords = array_merge($reserved_keywords, $reserved_ifs, $reserved_table_names);
        foreach($reserved_keywords as $rk)
124 125
            if($rk == $pconfig['name'])
                $input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
126 127 128

        /* check for name interface description conflicts */
        foreach($config['interfaces'] as $interface) {
129 130 131 132
            if($interface['descr'] == $pconfig['name']) {
                $input_errors[] = gettext("An interface description with this name already exists.");
                break;
            }
133 134 135 136 137 138 139 140 141 142 143
        }
        if ( is_validaliasname($pconfig['name']) !== true) {
            $input_errors[] = gettext("The alias name must be less than 32 characters long and may only consist of the characters") . " a-z, A-Z, 0-9, _.";
        }

        if (!empty($pconfig['updatefreq']) && !is_numericint($pconfig['updatefreq'])) {
            $input_errors[] = gettext("Update Frequency should by a number");
        }

        /* check for name conflicts */
        if (empty($a_aliases[$id])) {
144 145 146 147 148
            foreach ($a_aliases as $alias) {
                if ($alias['name'] == $_POST['name']) {
                    $input_errors[] = gettext("An alias with this name already exists.");
                    break;
                }
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
            }
        }

        /* user may not change type */
        if (isset($id) && $pconfig['type'] != $a_aliases[$id]['type']) {
            $input_errors[] = gettext("Alias type may not be changed for an existing alias.");
        }

        if ($pconfig['type'] == 'urltable') {
            if (empty($pconfig['url']) || !is_URL($pconfig['url'])) {
                $input_errors[] = gettext("You must provide a valid URL.");
            }
        }

        if (count($input_errors) == 0) {
            // save to config
            $copy_fields = array("name","detail","address","type","descr","updatefreq","aliasurl","url");
            $confItem = array();
            foreach ($copy_fields as $fieldname) {
                if (!empty($pconfig[$fieldname])) {
                    $confItem[$fieldname] = $pconfig[$fieldname];
                }
            }

            /*   Check to see if alias name needs to be
             *   renamed on referenced rules and such
             */
            if (isset($id) && $pconfig['name'] <> $pconfig['origname']) {
              // Firewall rules
              $origname = $pconfig['origname'];
              update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('filter', 'rule'), array('source', 'port'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'port'), $pconfig['name'], $origname);
              // NAT Rules
              update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'rule'), array('source', 'port'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'port'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'rule'), array('target'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'rule'), array('local-port'), $pconfig['name'], $origname);
              // NAT 1:1 Rules
              update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $pconfig['name'], $origname);
              // NAT Outbound Rules
              update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('source', 'network'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('sourceport'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('destination', 'address'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('dstport'), $pconfig['name'], $origname);
              update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('target'), $pconfig['name'], $origname);
              // Alias in an alias
              update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $pconfig['name'], $origname);
            }


            // save to config
            if (isset($id)) {
                $a_aliases[$id] = $confItem;
            } else {
                $a_aliases[] = $confItem;
            }
            // Sort list
            $a_aliases = msort($a_aliases, "name");

            if (write_config()) {
              // post save actions
              mark_subsystem_dirty('aliases');
              if (strpos($pconfig['type'],'url') !== false) {
                  // update URL Table Aliases
                  configd_run('filter refresh_url_alias', true);
              }
            }

221
            if($pconfig['type'] == 'host') {
222 223 224 225 226 227 228 229 230 231
                header("Location: firewall_aliases.php?tab=ip");
            } elseif (strpos($pconfig['type'],'url') !== false) {
                header("Location: firewall_aliases.php?tab=url");
            } else {
                header("Location: firewall_aliases.php?tab=".$pconfig['type']);
            }
            exit;

        }
    }
Ad Schellevis's avatar
Ad Schellevis committed
232 233
}

234 235 236 237 238
$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Edit"));
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php');

legacy_html_escape_form_data($pconfig);
include("head.inc");
Ad Schellevis's avatar
Ad Schellevis committed
239
?>
240
<body>
Ad Schellevis's avatar
Ad Schellevis committed
241
<?php
242
  include("fbegin.inc");
Ad Schellevis's avatar
Ad Schellevis committed
243
?>
244
<script type="text/javascript">
245
  $( document ).ready(function() {
246 247 248 249 250 251 252 253 254 255 256 257
    /**
     * remove host/port row or clear values on last entry
     */
    function removeRow() {
        if ( $('#detailTable > tbody > tr').length == 1 ) {
            $('#detailTable > tbody > tr:last > td > input').each(function(){
              $(this).val("");
            });
        } else {
            $(this).parent().parent().remove();
        }
    }
258 259 260 261 262 263 264
    // add new detail record
    $("#addNew").click(function(){
        // copy last row and reset values
        $('#detailTable > tbody').append('<tr>'+$('#detailTable > tbody > tr:last').html()+'</tr>');
        $('#detailTable > tbody > tr:last > td > input').each(function(){
          $(this).val("");
        });
265
        $(".act-removerow").click(removeRow);
266 267
    });

268 269
    $(".act-removerow").click(removeRow);

270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
    function toggleType() {
      if ($("#typeSelect").val() == 'urltable' || $("#typeSelect").val() == 'urltable_ports'  ) {
        $("#updatefreq").removeClass('show');
        $("#updatefreq").removeClass('hidden');
        $("#updatefreqHeader").removeClass('show');
        $("#updatefreqHeader").removeClass('hidden');
        $("#addNew").addClass('hidden');
        $("#addNew").addClass('show');
        $('#detailTable > tbody > tr:gt(0)').remove();
      } else {
        $("#updatefreq").addClass('hidden');
        $("#updatefreq").addClass('show');
        $("#updatefreqHeader").addClass('hidden');
        $("#updatefreqHeader").addClass('show');
        $("#addNew").removeClass('show');
        $("#addNew").removeClass('hidden');
      }
      switch($("#typeSelect").val()) {
          case 'urltable':
              $("#detailsHeading1").html("<?=gettext("IP or FQDN");?>");
              break;
          case 'urltable_ports':
              $("#detailsHeading1").html("<?=gettext("IP or FQDN");?>");
              break;
          case 'url':
              $("#detailsHeading1").html("<?=gettext("IP or FQDN");?>");
              break;
          case 'url_ports':
              $("#detailsHeading1").html("<?=gettext("IP or FQDN");?>");
              break;
          case 'host':
              $("#detailsHeading1").html("<?=gettext("Host(s)");?>");
              break;
          case 'network':
              $("#detailsHeading1").html("<?=gettext("Network(s)");?>");
              break;
          case 'port':
              $("#detailsHeading1").html("<?=gettext("Port(s)");?>");
              break;
      }
    }

    $("#typeSelect").change(function(){
      toggleType();
    });

    toggleType();
  });
Ad Schellevis's avatar
Ad Schellevis committed
318 319 320
</script>


321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
  <section class="page-content-main">
    <div class="container-fluid">
      <div class="row">
<?php  if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
        <div id="inputerrors"></div>
          <section class="col-xs-12">
            <div class="content-box">
              <header class="content-box-head container-fluid">
                <h3><?=gettext("Alias Edit");?></h3>
              </header>
          <div class="content-box-main">
                <form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
        <div class="table-responsive">
                    <table class="table table-striped">
                      <tr>
                        <td colspan="2" align="right">
                          <small><?=gettext("full help"); ?> </small>
338
                          <i class="fa fa-toggle-off text-danger"  style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
                        </td>
                      </tr>
                      <tr>
                        <td width="22%"><a id="help_for_name" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Name"); ?></td>
                        <td width="78%">
                          <input name="origname" type="hidden" id="origname" class="form-control unknown" size="40" value="<?=$pconfig['name'];?>" />
                          <?php if (isset($id)): ?>
                            <input name="id" type="hidden" value="<?=$id;?>" />
                          <?php endif; ?>
                          <input name="name" type="text" id="name" class="form-control unknown" size="40" maxlength="31" value="<?=$pconfig['name'];?>" />
                          <div class="hidden" for="help_for_name">
                            <?=gettext("The name of the alias may only consist of the characters \"a-z, A-Z, 0-9 and _\"."); ?>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td><a id="help_for_description" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Description"); ?></td>
                        <td>
                          <input name="descr" type="text" class="form-control unknown" id="descr" size="40" value="<?=$pconfig['descr'];?>" />
                          <div class="hidden" for="help_for_description">
                            <?=gettext("You may enter a description here for your reference (not parsed)."); ?>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td><a id="help_for_type" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Type"); ?></td>
                        <td>
                          <select name="type" class="form-control" id="typeSelect">
                            <option value="host" <?=$pconfig['type'] == "host" ? "selected=\"selected\"" : ""; ?>><?=gettext("Host(s)"); ?></option>
                            <option value="network" <?=$pconfig['type'] == "network" ? "selected=\"selected\"" : ""; ?>><?=gettext("Network(s)"); ?></option>
                            <option value="port" <?=$pconfig['type'] == "port" ? "selected=\"selected\"" : ""; ?>><?=gettext("Port(s)"); ?></option>
                            <option value="url" <?=$pconfig['type'] == "url" ? "selected=\"selected\"" : ""; ?>><?=gettext("URL (IPs)");?></option>
                            <option value="url_ports" <?=$pconfig['type'] == "url_ports" ? "selected=\"selected\"" : ""; ?>><?=gettext("URL (Ports)");?></option>
                            <option value="urltable" <?=$pconfig['type'] == "urltable" ? "selected=\"selected\"" : ""; ?>><?=gettext("URL Table (IPs)"); ?></option>
                            <option value="urltable_ports" <?=$pconfig['type'] == "urltable_ports" ? "selected=\"selected\"" : ""; ?>><?=gettext("URL Table (Ports)"); ?></option>
                          </select>
                        </td>
                    </tr>
                    <tr>
                      <td><div id="addressnetworkport"><a id="help_for_hosts" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Host(s)"); ?></div></td>
                      <td>
                        <table class="table table-striped table-condensed" id="detailTable">
                          <thead>
                            <tr>
383
                              <th></th>
384 385 386 387 388 389 390 391 392
                              <th id="detailsHeading1"><?=gettext("Network"); ?></th>
                              <th id="detailsHeading3"><?=gettext("Description"); ?></th>
                              <th id="updatefreqHeader" ><?=gettext("Update Freq. (days)");?></th>
                            </tr>
                          </thead>
                          <tbody>
<?php                      if (is_array($pconfig['aliasurl'])):
                            $detail_desc = explode("||", $pconfig['detail']);
                            foreach ($pconfig['aliasurl'] as $aliasid => $aliasurl):
393
?>
394
                            <tr>
395 396 397
                              <td>
                                <div style="cursor:pointer;" class="act-removerow btn btn-default btn-xs" alt="remove"><span class="glyphicon glyphicon-minus"></span></div>
                              </td>
398 399 400 401 402 403 404 405
                              <td>
                                <input type="text" class="form-control" name="host_url[]" value="<?=$aliasurl;?>"/>
                              </td>
                              <td>
                                <input type="text" class="form-control" name="detail[]" value="<?= isset($detail_desc[$aliasid])?$detail_desc[$aliasid]:"";?>"?>
                              </td>
                              <td>
<?php                          if ($aliasid ==0):
406
?>
407 408
                                <input type="text" class="form-control input-sm" id="updatefreq"  name="updatefreq" value="<?=$pconfig['updatefreq'];?>" >
<?php                          endif;
409
?>
410 411 412 413 414 415 416 417 418 419 420
                              </td>
                            </tr>
<?php                        endforeach;
                          else:
                            $detail_desc = explode("||", $pconfig['detail']);
                            if (empty($pconfig['address']) && isset($pconfig['url'])) {
                              $addresslst = array($pconfig['url']);
                            } else {
                              $addresslst = explode(' ', $pconfig['address']);
                            }
                            foreach ($addresslst as $addressid => $address):
421
?>
422
                            <tr>
423 424 425
                              <td>
                                <div style="cursor:pointer;" class="act-removerow btn btn-default btn-xs" alt="remove"><span class="glyphicon glyphicon-minus"></span></div>
                              </td>
426 427 428 429 430 431 432 433
                              <td>
                                <input type="text" class="form-control"  name="host_url[]" value="<?=$address;?>"/>
                              </td>
                              <td>
                                <input type="text" class="form-control" name="detail[]" value="<?= isset($detail_desc[$addressid])?$detail_desc[$addressid]:"";?>"?>
                              </td>
                              <td>
<?php                          if ($addressid ==0):
434
?>
435 436
                                <input type="text" class="form-control  input-sm" id="updatefreq" name="updatefreq" value="<?=$pconfig['updatefreq'];?>" >
<?php                          endif;
437
?>
438 439
                              </td>
                            </tr>
440

441 442
<?php                      endforeach;
                          endif;
443
?>
444 445 446
                          </tbody>
                          <tfoot>
                            <tr>
447
                              <td colspan="4">
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498
                                <div id="addNew" style="cursor:pointer;" class="btn btn-default btn-xs" alt="add"><span class="glyphicon glyphicon-plus"></span></div>
                              </td>
                            </tr>
                          </tfoot>
                        </table>
                        <div class="hidden" for="help_for_hosts">
                          <span class="text-info">
                            <?=gettext("Networks")?><br/>
                          </span>
                          <small>
                            <?=gettext("Networks are specified in CIDR format.  Select the CIDR mask that pertains to each entry. /32 specifies a single IPv4 host, /128 specifies a single IPv6 host, /24 specifies 255.255.255.0, /64 specifies a normal IPv6 network, etc. Hostnames (FQDNs) may also be specified, using a /32 mask for IPv4 or /128 for IPv6. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range.");?>
                            <br/>
                          </small>
                          <span class="text-info">
                            <?=gettext("Hosts")?><br/>
                          </span>
                          <small>
                            <?=gettext("Enter as many hosts as you would like.  Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used.");?>
                            <br/>
                          </small>
                          <span class="text-info">
                            <?=gettext("Ports")?><br/>
                          </span>
                          <small>
                            <?=gettext("Enter as many ports as you wish.  Port ranges can be expressed by separating with a colon.");?>
                            <br/>
                          </small>
                          <span class="text-info">
                            <?=gettext("URL's")?><br/>
                          </span>
                          <small>
                            <?=gettext("Enter a URL containing a large number of IPs,ports and/or Subnets. After saving the lists will be downloaded and scheduled for automatic updates when a frequency is provided.");?>
                          </small>
                        </div>
                      </td>
                    <tr>
                      <td>&nbsp;</td>
                      <td>
                        <input id="submit" name="submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
                        <input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
                      </td>
                    </tr>
                  </table>
                            </div>
            </form>
            </div>
        </div>
          </section>
      </div>
    </div>
  </section>
499
<?php include("foot.inc"); ?>