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-stream_map']."
".number_format($num_rows)."
\n"; echo "
\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo $text['title_description-stream_map']."\n"; echo "

\n"; echo "
\n"; echo "\n"; echo "\n"; if (!empty($results) && is_array($results) && @sizeof($results) != 0) { $previous_application = ''; $x = 0; foreach ($results as $row) { if ($row['application'] == 'extensions' && permission_exists('extension_edit')) { $list_row_url = "/app/extensions/extension_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'ivr_menus' && permission_exists('ivr_menu_edit')) { $list_row_url = "/app/ivr_menus/ivr_menu_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'dialplans' && permission_exists('dialplan_edit')) { $list_row_url = "/app/dialplans/dialplan_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'fifo' && permission_exists('fifo_edit')) { $list_row_url = "/app/fifo/fifo_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'call_center_queues' && permission_exists('call_center_queue_edit')) { $list_row_url = "/app/call_centers/call_center_queue_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'ring_groups' && permission_exists('call_center_queue_edit')) { $list_row_url = "/app/ring_groups/ring_group_edit.php?id=".urlencode($row['uuid']); } if ($row['application'] == 'destinations' && permission_exists('destination_edit')) { $list_row_url = "/app/destinations/destination_edit.php?id=".urlencode($row['uuid']); } if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; } //add the table header if ($previous_application != $row['application']) { $previous_application = $row['application']; if ($x > 0) { echo "\n"; echo "\n"; } $application = $row['application']; if ($application == 'call_center_queues') { $application = 'call_centers'; } //add multi-lingual support if (file_exists(dirname(__DIR__, 2)."/app/".$application."/app_languages.php")) { $text2 = $text_language->get($settings->get('domain', 'language', 'en-us'), 'app/'.$application); } echo "".escape($text2['title-'.$application])."\n"; echo "
\n"; echo "\n"; echo "\n"; if (permission_exists('extension_view') && $list_row_edit_button == 'true') { echo " \n"; } echo "\n"; echo "\n"; if (!empty($show) && $show == 'all' && permission_exists('dialplan_all')) { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if (permission_exists('extension_view') && $list_row_edit_button == 'true') { echo " \n"; } echo "\n"; } //ad the table row echo "\n"; if (!empty($show) && $show == 'all' && permission_exists('dialplan_all')) { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if (permission_exists('extension_edit') && $list_row_edit_button == 'true') { echo " \n"; } echo "\n"; //increment the value $x++; } unset($extensions); } echo "
 
".escape($text['label-domain_name'])."".escape($text['label-name'])."".escape($text['label-type'])."".escape($text['label-extension'])."".escape($text['label-stream'])."".escape($text['label-description'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
".escape($row['domain_name'])."".escape($row['name'])."".escape($row['type'])."".escape($row['number'])."".escape($row['music'])."".escape($row['description'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
\n"; echo "
\n"; echo "
\n"; //echo "
".$paging_controls."
\n"; echo "\n"; echo "
\n"; //include the footer require_once "resources/footer.php"; ?>