mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-28 03:29:18 +00:00
Create resources/destinations.php
This commit is contained in:
60
app/destinations/resources/destinations.php
Normal file
60
app/destinations/resources/destinations.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
include_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the action
|
||||
$action = $_REQUEST['action'];
|
||||
$destination_type = $_REQUEST['destination_type'];
|
||||
|
||||
//sanitize the variables
|
||||
$action = preg_replace('#[^a-zA-Z0-9_\-]#', '', $action);
|
||||
$destination_type = preg_replace('#[^a-zA-Z0-9_\-]#', '', $destination_type);
|
||||
|
||||
//get the destinations
|
||||
$destination = new destinations;
|
||||
$destinations = $destination->get($destination_type);
|
||||
|
||||
//show the select
|
||||
echo " <select name='subaction' id='action' class='formfld' style='".$select_style."'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($destinations as $key => $rows) {
|
||||
if ($key == $action && permission_exists($destination->singular($key)."_destinations")) {
|
||||
if (is_array($rows)) {
|
||||
foreach($rows as $row) {
|
||||
|
||||
//set the variables
|
||||
$select_label = $row['label'];
|
||||
$select_value = $row['destination'];
|
||||
|
||||
//update the select values
|
||||
$select_value = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_value);
|
||||
$select_value = str_replace("\${context}", $_SESSION['domain_name'], $select_value);
|
||||
$select_label = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_label);
|
||||
$select_label = str_replace("\${context}", $_SESSION['domain_name'], $select_label);
|
||||
|
||||
$select_label = str_replace('&low_bar;', '_', $select_label);
|
||||
$select_label = str_replace("✉", 'email-icon', $select_label);
|
||||
//$select_label = escape(trim($select_label));
|
||||
$select_label = str_replace('email-icon', '✉', $select_label);
|
||||
|
||||
//add the select option
|
||||
echo " <option value='".$select_value."'>".$select_label."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user