From 87c72c6088b671c06d27f4cc1f03f02f291c03dd Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 12 Aug 2019 19:21:04 -0600 Subject: [PATCH] Delete services.php --- app/services/services.php | 292 -------------------------------------- 1 file changed, 292 deletions(-) delete mode 100644 app/services/services.php diff --git a/app/services/services.php b/app/services/services.php deleted file mode 100644 index f4318ef32b..0000000000 --- a/app/services/services.php +++ /dev/null @@ -1,292 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2018 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//includes -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; - -//check permissions -if (permission_exists('service_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -global $IS_WINDOWS; - -if ($IS_WINDOWS == null) { - if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; } -} - -$HAS_WIN_SVC = false; -if($IS_WINDOWS){ - require_once "resources/classes/lib_win.php"; - $HAS_WIN_SVC = class_exists('win_service'); -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -require_once "resources/header.php"; -$document['title'] = $text['title-services']; -require_once "resources/paging.php"; - -$order_by = check_str($_GET["order_by"]); -$order = check_str($_GET["order"]); - -if (strlen($_GET["a"]) > 0) { - $service_uuid = check_str($_GET["id"]); - $sql = "select * from v_services "; - $sql .= "where service_uuid = '$service_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $domain_uuid = $row["domain_uuid"]; - $service_name = $row["service_name"]; - $service_type = $row["service_type"]; - $service_data = $row["service_data"]; - $service_cmd_start = $row["service_cmd_start"]; - $service_cmd_stop = $row["service_cmd_stop"]; - $service_description = $row["service_description"]; - } - unset ($prep_statement); - - if($service_type == 'svc'){ - if($HAS_WIN_SVC){ - $svc = new win_service($service_data); - if ($_GET["a"] == "stop") { - $_SESSION["message"] = $text['message-stopping'].': '.$service_name; - $svc->stop(); - } - if ($_GET["a"] == "start") { - $_SESSION["message"] = $text['message-starting'].': '.$service_name; - $svc->start(); - } - } - } - else { - if ($_GET["a"] == "stop") { - $_SESSION["message"] = $text['message-stopping'].': '.$service_name; - shell_exec($service_cmd_stop); - } - if ($_GET["a"] == "start") { - $_SESSION["message"] = $text['message-starting'].': '.$service_name; - shell_exec($service_cmd_start); - } - } - header("Location: services.php"); - return; -} - -//get the service count -$sql = "select * from v_services "; -if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } -$prep_statement = $db->prepare(check_sql($sql)); -$prep_statement->execute(); -$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); -$num_rows = count($result); -unset ($prep_statement, $result, $sql); - -//paging -$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; -$param = ""; -$page = $_GET['page']; -if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } -list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); -$offset = $rows_per_page * $page; - -//get the service data -$sql = "select * from v_services "; -if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } -$sql .= " limit $rows_per_page offset $offset "; -$prep_statement = $db->prepare(check_sql($sql)); -$prep_statement->execute(); -$services = $prep_statement->fetchAll(PDO::FETCH_NAMED); -unset ($prep_statement, $sql); - -//set the row style -$c = 0; -$row_style["0"] = "row_style0"; -$row_style["1"] = "row_style1"; - - -//check if a process is running -function is_process_running($pid) { - $status = shell_exec( 'ps -p ' . $pid ); - $status_array = explode ("\n", $status); - if (strlen(trim($status_array[1])) > 0) { - return true; - } - else { - return false; - } -} - -//show the table content -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
".$text['header-services']." 
\n"; -echo $text['description-services']."

\n"; -echo "
\n"; - -echo "\n"; -echo "\n"; -echo th_order_by('service_name', $text['label-name'], $order_by, $order); -echo "\n"; -echo "\n"; -echo th_order_by('service_description', $text['label-description'], $order_by, $order); -echo "\n"; -echo "\n"; - -if (is_array($services)) { - foreach($services as $row) { - $tr_link = (permission_exists('service_edit')) ? "href='service_edit.php?id=".escape($row[service_uuid])."'" : null; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } - } //end foreach - unset($sql, $services); -} //end if results - -echo "\n"; -echo "\n"; -echo "\n"; - -echo "
".$text['label-status']."".$text['label-action'].""; -if (permission_exists('service_add')) { - echo "$v_link_label_add"; -} -echo "
"; - if (permission_exists('service_edit')) { - echo "".escape($row[service_name]).""; - } - else { - echo escape($row[service_name]); - } - echo " \n"; - $service_running = false; - - if ($row[service_type] == "svc") { - if ($HAS_WIN_SVC) { - $service_data = $row[service_data]; - $svc = new win_service($service_data); - $svc_state = $svc->state() or $svc->last_error(); - if(!$svc_state){ - $svc_state = 'NOT_INSTALL'; - } - $service_running = (($svc_state == 'RUNNING') || ($svc_state == 'START_PENDING')); - - echo "$svc_state"; - - echo "\n"; - if ($svc_state == 'NOT_INSTALL') { - echo "$svc_state"; - } - else { - if ($service_running) { - echo " ".$text['label-stop'].""; - } - else { - echo " ".$text['label-start'].""; - } - } - } - else{ - echo "UNSUPPORT"; - echo "\n"; - echo "UNSUPPORT"; - } - } - else { - if ($row[service_type] == "pid" || $row[service_type] == "pid_file") { - $pid = file_get_contents($row[service_data]); - $service_running = is_process_running($pid); - } - if ($row[service_type] == "file") { - $service_data = $row[service_data]; - $service_running = file_exists($service_data); - } - - if ($service_running) { - echo "".$text['label-running'].""; - } - else { - echo "".$text['label-stopped'].""; - } - - echo "\n"; - if ($service_running) { - echo " ".$text['label-stop'].""; - } - else { - echo " ".$text['label-start'].""; - } - } - - echo "".escape($row[service_description])." "; - if (permission_exists('service_edit')) { - echo "$v_link_label_edit"; - } - if (permission_exists('service_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('service_add')) { - echo "$v_link_label_add"; -} -echo "
\n"; -echo "
"; -echo "

"; - -//include the footer -require_once "resources/footer.php"; - -?>