Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('module_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //get includes and the title require_once "resources/header.php"; $document['title'] = $text['title-modules']; require_once "resources/paging.php"; //get the http values ans set as variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; $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)); $msg = "".$text['label-unload_module'].":
".$response."
"; } } if ($_GET["a"] == "start") { $module_name = $_GET["m"]; if ($fp) { $cmd = "api load $module_name"; $response = trim(event_socket_request($fp, $cmd)); $msg = "".$text['label-load_module'].":
".$response."
"; } } } $esl_alive = false; if($fp){ $esl_alive = true; fclose($fp); } //Warning if FS not start if(!$esl_alive){ $msg = "
".$text['error-event-socket']."
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } //use the module class to get the list of modules from the db and add any missing modules $module = new modules; $module->db = $db; $module->dir = $_SESSION['switch']['mod']['dir']; $module->get_modules(); $result = $module->modules; $module_count = count($result); $module->synch(); $module->xml(); $msg = $module->msg; //show the msg if ($msg) { echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } //show the content echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['header-modules']."
".$text['description-modules']."
\n"; $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "\n"; $tmp_module_header = "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\n"; $tmp_module_header .= "\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 "\n"; echo "\n"; echo "\n"; } echo "\n"; echo $tmp_module_header; } $tr_link = (permission_exists('module_edit')) ? "href='module_edit.php?id=".$row["module_uuid"]."'" : null; echo "\n"; echo " \n"; if($esl_alive) { if ($module->active($row["module_name"])) { echo " \n"; echo " \n"; } else { if ($row['module_enabled']=="true") { echo " \n"; } else { echo " \n"; } echo " \n"; } } else{ echo " \n"; echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo "\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 "\n"; echo "\n"; echo "\n"; echo "
".$text['label-label']."".$text['label-status']."".$text['label-action']."".$text['label-enabled']."".$text['label-description'].""; $tmp_module_header .= "$v_link_label_add"; $tmp_module_header .= "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
  \n"; if (permission_exists('module_add')) { echo " $v_link_label_add\n"; } echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " ".$row["module_category"]." 
"; if (permission_exists('module_edit')) { echo "".$row["module_label"].""; } else { echo $row["module_label"]; } echo " ".$text['label-running']."".$text['label-stop']."".$text['label-stopped']."".$text['label-stopped']." ".$notice."".$text['label-start']."".$text['label-unknown']."".$text['label-none'].""; if ($row["module_enabled"] == "true") { echo $text['option-true']; } else if ($row["module_enabled"] == "false") { echo $text['option-false']; } echo "".$row["module_description"]." "; if (permission_exists('module_edit')) { echo "$v_link_label_edit"; } if (permission_exists('module_delete')) { echo "$v_link_label_delete"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls"; if (permission_exists('module_add')) { echo "$v_link_label_add"; } echo "
\n"; echo "
"; echo "

"; //show the footer require_once "resources/footer.php"; ?>