status_services.php 3.69 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4
    Copyright (C) 2014-2015 Deciso B.V.
5 6
    Copyright (C) 2005-2006 Colin Smith <ethethlay@gmail.com>
    Copyright (C) 2004-2005 Scott Ullrich
Ad Schellevis's avatar
Ad Schellevis committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    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.
*/

require_once("guiconfig.inc");
32
require_once("services.inc");
33
require_once('plugins.inc');
34
require_once("vslb.inc");
35 36
require_once("system.inc");
require_once("unbound.inc");
37
require_once("pfsense-utils.inc");
38
require_once("openvpn.inc");
39
require_once("filter.inc");
40
require_once("ipsec.inc");
41
require_once("interfaces.inc");
42
require_once("rrd.inc");
Ad Schellevis's avatar
Ad Schellevis committed
43

44 45 46
if (!empty($_POST['service'])) {
    $service_name = $_POST['service'];
    switch ($_POST['action']) {
47
        case 'restart':
48
          echo service_control_restart($service_name, $_POST);
49
          break;
50
        case 'start':
51
          echo service_control_start($service_name, $_POST);
52
          break;
53
        case 'stop':
54
          echo service_control_stop($service_name, $_POST);
55 56
          break;
    }
57
    exit;
Ad Schellevis's avatar
Ad Schellevis committed
58 59
}

60

61
$services = services_get();
62 63 64

if (count($services) > 0) {
    uasort($services, "service_name_compare");
65 66
}

Ad Schellevis's avatar
Ad Schellevis committed
67 68 69 70
include("head.inc");

?>

71
<body>
72

73
<?php include("fbegin.inc"); ?>
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  <section class="page-content-main">
    <div class="container-fluid">
      <div class="row">
        <?php if (isset($savemsg)) print_info_box($savemsg); ?>
        <section class="col-xs-12">
          <div class="content-box">
            <div class="table-responsive">
              <table class="table table-striped">
              <thead>
                <tr>
                  <td><?=gettext("Service");?></td>
                  <td><?=gettext("Description");?></td>
                  <td><?=gettext("Status");?></td>
                </tr>
              </thead>
              <tbody>
<?php
               if (count($services) > 0):
                foreach($services as $service):?>
                <tr>
                    <td><?=$service['name'];?></td>
                    <td><?=$service['description'];?></td>
                    <td>
                      <?=get_service_status_icon($service, true, true);?>
98
                      <?=get_service_control_links($service, false);?>
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
                    </td>
                </tr>
<?php
                endforeach;
              else:?>
                <tr>
                  <td colspan="3"> <?=gettext("No services found");?></td>
                </tr>
<?php
                 endif;?>
              </tbody>
            </table>
          </div>
        </div>
      </section>
    </div>
  </div>
</section>
117
<?php include("foot.inc"); ?>