Portions created by the Initial Developer are Copyright (C) 2026 the Initial Developer. All Rights Reserved. */ //set the include path $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); set_include_path(parse_ini_file($conf[0])['document.root']); //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (!permission_exists('stream_map')) { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //connect to the database $database = database::new(); //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); //set from session variables $list_row_edit_button = $settings->get('theme', 'list_row_edit_button', 'false'); //get order and order by $order_by = $_GET["order_by"] ?? null; $order = $_GET["order"] ?? null; //define the variables $search = ''; $show = ''; $list_row_url = ''; //add the search variable if (!empty($_GET["search"])) { $search = strtolower($_GET["search"]); } //add the show variable if (!empty($_GET["show"])) { $show = $_GET["show"]; } //prepare the excluded applications array based on permission exists $excluded_app_array = []; if (!permission_exists('extension_view')) { $excluded_app_array[] = 'extensions'; } if (!permission_exists('ring_group_view')) { $excluded_app_array[] = 'ring_groups'; } if (!permission_exists('ivr_menu_view')) { $excluded_app_array[] = 'ivr_menus'; } if (!permission_exists('call_center_queue_view')) { $excluded_app_array[] = 'call_center_queues'; } if (!permission_exists('fifo_view')) { $excluded_app_array[] = 'fifo'; } if (!permission_exists('destination_view')) { $excluded_app_array[] = 'destinations'; } if (!permission_exists('dialplan_view')) { $excluded_app_array[] = 'dialplans'; } $excluded_applications = implode(',', $excluded_app_array); //get the stream map $sql = "SELECT "; $sql .= " application, "; $sql .= " type, "; $sql .= " uuid, "; $sql .= " domain_uuid, "; $sql .= " domain_name, "; $sql .= " name, "; $sql .= " number, "; $sql .= " music, "; $sql .= " description \n"; $sql .= "FROM view_stream_map \n"; $sql .= "WHERE true \n"; if (!empty($show) && $show === "all" && permission_exists('dialplan_all')) { //show all } else { $sql .= "AND domain_uuid = :domain_uuid \n"; $parameters['domain_uuid'] = $domain_uuid; } if (!empty($search)) { $sql .= "AND ( \n"; $sql .= " application like :search \n"; $sql .= " or type like :search \n"; $sql .= " or name like :search \n"; $sql .= " or number like :search \n"; $sql .= " or music like :search \n"; $sql .= " or description like :search \n"; $sql .= ") \n"; $parameters['search'] = '%'.$search.'%'; } if (!empty($excluded_applications)) { $sql .= "AND application NOT IN ('" . implode("','", $excluded_app_array) . "') \n"; } $sql .= "ORDER BY application, domain_name ASC \n"; //get the list $results = $database->select($sql, $parameters ?? null, 'all'); $num_rows = count($results); unset($sql, $parameters); //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); //create the text object $text_language = new text; //get the language $language = $settings->get('domain', 'language', 'en-us'); //additional includes $document['title'] = $text['title-stream_map']; require_once "resources/header.php"; //show the content echo "
\n"; echo $text['title_description-stream_map']."\n"; echo "