2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('module_view')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2013-05-29 23:46:48 +02:00
|
|
|
|
|
|
|
|
//add multi-lingual support
|
2015-01-18 11:06:08 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-05-29 23:46:48 +02:00
|
|
|
|
2015-01-18 11:06:08 +01:00
|
|
|
//get includes and the title
|
|
|
|
|
require_once "resources/header.php";
|
|
|
|
|
$document['title'] = $text['title-modules'];
|
|
|
|
|
require_once "resources/paging.php";
|
2013-05-29 23:46:48 +02:00
|
|
|
|
2015-01-18 11:06:08 +01:00
|
|
|
//get the http values ans set as variables
|
|
|
|
|
$order_by = $_GET["order_by"];
|
|
|
|
|
$order = $_GET["order"];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
|
|
|
|
if (strlen($_GET["a"]) > 0) {
|
|
|
|
|
if ($_GET["a"] == "stop") {
|
|
|
|
|
$module_name = $_GET["m"];
|
|
|
|
|
if ($fp) {
|
|
|
|
|
$cmd = "api unload $module_name";
|
|
|
|
|
$response = trim(event_socket_request($fp, $cmd));
|
2013-05-29 23:46:48 +02:00
|
|
|
$msg = "<strong>".$text['label-unload_module'].":</strong> <pre>".$response."</pre>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($_GET["a"] == "start") {
|
|
|
|
|
$module_name = $_GET["m"];
|
|
|
|
|
if ($fp) {
|
|
|
|
|
$cmd = "api load $module_name";
|
|
|
|
|
$response = trim(event_socket_request($fp, $cmd));
|
2013-05-29 23:46:48 +02:00
|
|
|
$msg = "<strong>".$text['label-load_module'].":</strong> <pre>".$response."</pre>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-22 11:05:13 +01:00
|
|
|
$esl_alive = false;
|
|
|
|
|
if($fp){
|
|
|
|
|
$esl_alive = true;
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Warning if FS not start
|
|
|
|
|
if(!$esl_alive){
|
|
|
|
|
$msg = "<div align='center'>".$text['error-event-socket']."<br /></div>";
|
|
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table width='40%'>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<th align='left'>".$text['label-message']."</th>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//use the module class to get the list of modules from the db and add any missing modules
|
2016-05-26 19:21:37 +02:00
|
|
|
$module = new modules;
|
|
|
|
|
$module->db = $db;
|
|
|
|
|
$module->dir = $_SESSION['switch']['mod']['dir'];
|
|
|
|
|
$module->get_modules();
|
|
|
|
|
$result = $module->modules;
|
2012-06-04 16:58:40 +02:00
|
|
|
$module_count = count($result);
|
2016-05-26 19:21:37 +02:00
|
|
|
$module->synch();
|
|
|
|
|
$module->xml();
|
|
|
|
|
$msg = $module->msg;
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//show the msg
|
|
|
|
|
if ($msg) {
|
|
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table width='40%'>\n";
|
|
|
|
|
echo "<tr>\n";
|
2013-05-29 23:46:48 +02:00
|
|
|
echo "<th align='left'>".$text['label-message']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='row_style1'>$msg</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the content
|
2015-02-15 08:59:02 +01:00
|
|
|
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>\n";
|
2013-05-29 23:46:48 +02:00
|
|
|
echo "<td align='left' nowrap><b>".$text['header-modules']."</b></td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
2013-05-29 23:46:48 +02:00
|
|
|
echo "<td align='left'>".$text['description-modules']."</td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
$tmp_module_header = "\n";
|
|
|
|
|
$tmp_module_header .= "<tr>\n";
|
2013-05-29 23:46:48 +02:00
|
|
|
$tmp_module_header .= "<th>".$text['label-label']."</th>\n";
|
|
|
|
|
$tmp_module_header .= "<th>".$text['label-status']."</th>\n";
|
|
|
|
|
$tmp_module_header .= "<th>".$text['label-action']."</th>\n";
|
|
|
|
|
$tmp_module_header .= "<th>".$text['label-enabled']."</th>\n";
|
2014-06-22 08:35:33 +02:00
|
|
|
$tmp_module_header .= "<th>".$text['label-description']."</th>\n";
|
2014-02-26 03:25:10 +01:00
|
|
|
$tmp_module_header .= "<td class='list_control_icons'>";
|
|
|
|
|
$tmp_module_header .= "<a href='module_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
$tmp_module_header .= "</td>\n";
|
|
|
|
|
$tmp_module_header .= "<tr>\n";
|
|
|
|
|
|
|
|
|
|
if ($module_count > 0) {
|
|
|
|
|
$prev_module_category = '';
|
|
|
|
|
foreach($result as $row) {
|
|
|
|
|
if ($prev_module_category != $row["module_category"]) {
|
|
|
|
|
$c=0;
|
|
|
|
|
if (strlen($prev_module_category) > 0) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td colspan='6'>\n";
|
|
|
|
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td width='33.3%' nowrap> </td>\n";
|
|
|
|
|
echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
|
|
|
|
echo " <td width='33.3%' align='right'>\n";
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('module_add')) {
|
|
|
|
|
echo " <a href='module_edit.php' alt='add'>$v_link_label_add</a>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "<tr><td colspan='4' align='left'>\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " <b>".$row["module_category"]."</b> </td></tr>\n";
|
|
|
|
|
echo $tmp_module_header;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 10:52:47 +02:00
|
|
|
$tr_link = (permission_exists('module_edit')) ? "href='module_edit.php?id=".$row["module_uuid"]."'" : null;
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<tr ".$tr_link.">\n";
|
2014-06-21 02:58:16 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if (permission_exists('module_edit')) {
|
|
|
|
|
echo "<a href='module_edit.php?id=".$row["module_uuid"]."'>".$row["module_label"]."</a>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo $row["module_label"];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
2016-01-22 11:05:13 +01:00
|
|
|
if($esl_alive) {
|
2016-05-26 21:08:53 +02:00
|
|
|
if ($module->active($row["module_name"])) {
|
2016-01-22 11:05:13 +01:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-running']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'><a href='modules.php?a=stop&m=".$row["module_name"]."' alt='".$text['label-stop']."'>".$text['label-stop']."</a></td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2016-01-22 11:05:13 +01:00
|
|
|
if ($row['module_enabled']=="true") {
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'><b>".$text['label-stopped']."</b></td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-stopped']." ".$notice."</td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'><a href='modules.php?a=start&m=".$row["module_name"]."' alt='".$text['label-start']."'>".$text['label-start']."</a></td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2016-01-22 11:05:13 +01:00
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-unknown']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-none']."</td>\n";
|
2013-05-29 23:46:48 +02:00
|
|
|
}
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if ($row["module_enabled"] == "true") {
|
|
|
|
|
echo $text['option-true'];
|
|
|
|
|
}
|
|
|
|
|
else if ($row["module_enabled"] == "false") {
|
|
|
|
|
echo $text['option-false'];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-05-29 23:46:48 +02:00
|
|
|
echo "</td>\n";
|
2014-06-22 08:35:33 +02:00
|
|
|
echo " <td valign='top' class='row_stylebg'>".$row["module_description"]." </td>\n";
|
2014-02-26 03:25:10 +01:00
|
|
|
echo " <td class='list_control_icons'>";
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('module_edit')) {
|
2014-02-26 03:25:10 +01:00
|
|
|
echo "<a href='module_edit.php?id=".$row["module_uuid"]."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('module_delete')) {
|
2014-02-26 03:25:10 +01:00
|
|
|
echo "<a href='module_delete.php?id=".$row["module_uuid"]."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2014-02-26 03:25:10 +01:00
|
|
|
echo "</td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
$prev_module_category = $row["module_category"];
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $modules, $row_count);
|
|
|
|
|
} //end if results
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td colspan='6'>\n";
|
|
|
|
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td width='33.3%' nowrap> </td>\n";
|
|
|
|
|
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
2014-02-26 03:25:10 +01:00
|
|
|
echo " <td class='list_control_icons'>";
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('module_add')) {
|
2014-02-26 03:25:10 +01:00
|
|
|
echo "<a href='module_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2014-02-26 03:25:10 +01:00
|
|
|
echo "</td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br><br>";
|
|
|
|
|
|
|
|
|
|
//show the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
?>
|