echo "</tr>\n";
if (if_group("superadmin")) {
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
    echo "    " . $text['label-accountcode'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    if ($action == "add") {
        $accountcode = $_SESSION['domain_name'];
    }
    echo "    <input class='formfld' type='text' name='broadcast_accountcode' maxlength='255' value=\"{$broadcast_accountcode}\">\n";
    echo "<br />\n";
    echo $text['description-accountcode'] . "\n";
    echo "</td>\n";
    echo "</tr>\n";
} elseif (if_group("admin") && file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/billing/app_config.php")) {
    $sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '" . $_SESSION['domain_uuid'] . "'";
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
    echo "    " . $text['label-accountcode'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    echo "  <select name='broadcast_accountcode' id='broadcast_accountcode' class='formfld'>\n";
    $prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
    $prep_statement_accountcode->execute();
    $result_accountcode = $prep_statement_accountcode->fetchAll(PDO::FETCH_NAMED);
    foreach ($result_accountcode as &$row_accountcode) {
        $selected = '';
        if ($action == "add" && $row_accountcode['type_value'] == $_SESSION['domain_name']) {
            $selected = 'selected="selected"';
        } elseif ($row_accountcode['type_value'] == $accountcode) {
    }
    echo "<strong style='color: black;'>" . ucwords($_REQUEST['group']) . "</strong>";
    echo "<br><br>";
} else {
    if (sizeof($user_extensions) > 0) {
        echo "<br>";
        echo "<strong style='color: black;'>" . $text['label-other_extensions'] . "</strong>";
        echo "<br><br>";
    }
}
if (sizeof($other_extensions) > 0) {
    echo "<table width='100%'><tr><td>";
    foreach ($other_extensions as $ext_block) {
        echo $ext_block;
    }
    echo "</td></tr></table>";
} else {
    echo $text['label-no_extensions_found'];
}
echo "<br><br>";
if (if_group("superadmin") && isset($_GET['debug'])) {
    echo '$activity<br>';
    echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
    print_r($activity);
    echo "</textarea>";
    echo "<br><br>";
    echo '$_SESSION<br>';
    echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
    print_r($_SESSION);
    echo "</textarea>";
}
Exemple #3
0
	License.

	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	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('get_call_details') || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//get_call_details
//get the call details for all calls or all active calls
//usage
//http://x.x.x.x/app/get_call_details/index.php?dest=101&username=example&password=1234
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
    $msg['error']['message'] = "Connection to Event Socket failed.";
    echo json_encode($row);
}
$response = trim(event_socket_request($fp, "api show calls"));
echo "</tr>\n";
if (if_group("superadmin")) {
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
    echo "    " . $text['label-accountcode'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    if ($action == "add") {
        $accountcode = $_SESSION['domain_name'];
    }
    echo "    <input class='formfld' type='text' name='broadcast_accountcode' maxlength='255' value=\"{$broadcast_accountcode}\">\n";
    echo "<br />\n";
    echo $text['description-accountcode'] . "\n";
    echo "</td>\n";
    echo "</tr>\n";
} elseif (if_group("admin") && file_exists($_SERVER["PROJECT_ROOT"] . "/app/billing/app_config.php")) {
    $sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '" . $_SESSION['domain_uuid'] . "'";
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
    echo "    " . $text['label-accountcode'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    echo "  <select name='broadcast_accountcode' id='broadcast_accountcode' class='formfld'>\n";
    $prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
    $prep_statement_accountcode->execute();
    $result_accountcode = $prep_statement_accountcode->fetchAll(PDO::FETCH_NAMED);
    foreach ($result_accountcode as &$row_accountcode) {
        $selected = '';
        if ($action == "add" && $row_accountcode['type_value'] == $_SESSION['domain_name']) {
            $selected = 'selected="selected"';
        } elseif ($row_accountcode['type_value'] == $accountcode) {
Exemple #5
0
*/
//check the permission
if (defined('STDIN')) {
    $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
    preg_match("/^(.*)\\/core\\/.*\$/", $document_root, $matches);
    $document_root = $matches[1];
    set_include_path($document_root);
    require_once "resources/require.php";
    $_SERVER["DOCUMENT_ROOT"] = $document_root;
    $format = 'text';
    //html, text
} else {
    include "root.php";
    require_once "resources/require.php";
    require_once "resources/check_auth.php";
    if (permission_exists('upgrade_schema') || permission_exists('upgrade_svn') || if_group("superadmin")) {
        //echo "access granted";
    } else {
        echo "access denied";
        exit;
    }
    $format = 'html';
}
require_once "resources/classes/text.php";
//add multi-lingual support
$language = new text();
$text = $language->get();
//show the title
if ($format == 'text') {
    echo "\n";
    echo $text['label-upgrade'] . "\n";
	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2012
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
	James Rose <*****@*****.**>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('setting_view') || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//get the number of rows in v_extensions
$sql = " select count(*) as num_rows from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
$num_rows = 0;
if ($prep_statement) {
    $prep_statement->execute();
    $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
Exemple #7
0
    echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, '', '', $param);
}
echo th_order_by('username', $text['label-username'], $order_by, $order);
echo "<th>" . $text['label-groups'] . "</th>\n";
echo th_order_by('user_enabled', $text['label-enabled'], $order_by, $order, '', '', $param);
echo "<td class='list_control_icons'>";
if (permission_exists('user_add')) {
    if ($_SESSION['limit']['users']['numeric'] == '' || $_SESSION['limit']['users']['numeric'] != '' && $total_users < $_SESSION['limit']['users']['numeric']) {
        echo "<a href='signup.php' alt='" . $text['button-add'] . "'>" . $v_link_label_add . "</a>";
    }
}
echo "</td>\n";
echo "</tr>\n";
if ($user_count > 0) {
    foreach ($users as $row) {
        if (if_superadmin($superadmins, $row['user_uuid']) && !if_group("superadmin")) {
            //hide
        } else {
            $tr_link = permission_exists('user_edit') ? "href='usersupdate.php?id=" . $row['user_uuid'] . "'" : null;
            echo "<tr " . $tr_link . ">\n";
            if (permission_exists('user_all') && $_GET['showall'] == 'true') {
                echo "\t<td valign='top' class='" . $row_style[$c] . "'>" . $_SESSION['domains'][$row['domain_uuid']]['domain_name'] . "</td>\n";
            }
            echo "\t<td valign='top' class='" . $row_style[$c] . "'>";
            if (permission_exists('user_edit')) {
                echo "<a href='usersupdate.php?id=" . $row['user_uuid'] . "'>" . $row['username'] . "</a>";
            } else {
                echo $row['username'];
            }
            echo "\t</td>\n";
            echo "\t<td valign='top' class='" . $row_style[$c] . "'>";
function sound_select_list($var, $name, $description_name, $load_sound = false)
{
    global $text, $recordings, $db;
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap>\n";
    echo "\t" . $text['label-' . $description_name] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    echo "<select name='{$name}' class='formfld' " . (if_group("superadmin") ? "onchange='changeToInput(this);'" : null) . ">\n";
    echo "\t<option value=''></option>\n";
    //misc optgroup
    if (if_group("superadmin")) {
        echo "<optgroup label=" . $text['miscellaneous'] . ">\n";
        echo "\t<option value='say:'>say:</option>\n";
        echo "\t<option value='tone_stream:'>tone_stream:</option>\n";
        echo "</optgroup>\n";
    }
    //recordings
    $tmp_selected = false;
    if (count($recordings) > 0) {
        echo "<optgroup label=" . $text['recordings'] . ">\n";
        foreach ($recordings as &$row) {
            $recording_name = $row["recording_name"];
            $recording_filename = $row["recording_filename"];
            if ($var == $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $recording_filename && strlen($var) > 0) {
                $tmp_selected = true;
                echo "\t<option value='" . $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $recording_filename . "' selected='selected'>" . $recording_name . "</option>\n";
            } else {
                if ($var == $recording_filename && strlen($var) > 0) {
                    $tmp_selected = true;
                    echo "\t<option value='" . $recording_filename . "' selected='selected'>" . $recording_name . "</option>\n";
                } else {
                    echo "\t<option value='" . $recording_filename . "'>" . $recording_name . "</option>\n";
                }
            }
        }
        echo "</optgroup>\n";
    }
    //phrases
    $sql = "select * from v_phrases where domain_uuid = '" . $domain_uuid . "' ";
    $prep_statement = $db->prepare(check_sql($sql));
    $prep_statement->execute();
    $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
    if (count($result) > 0) {
        echo "<optgroup label='Phrases'>\n";
        foreach ($result as &$row) {
            if ($var == "phrase:" . $row["phrase_uuid"]) {
                $tmp_selected = true;
                echo "\t<option value='phrase:" . $row["phrase_uuid"] . "' selected='selected'>" . $row["phrase_name"] . "</option>\n";
            } else {
                echo "\t<option value='phrase:" . $row["phrase_uuid"] . "'>" . $row["phrase_name"] . "</option>\n";
            }
        }
        unset($prep_statement);
        echo "</optgroup>\n";
    }
    //sounds
    if ($load_sound) {
        $file = new file();
        $sound_files = $file->sounds();
        if (is_array($sound_files)) {
            echo "<optgroup label=" . $text["sounds"] . ">\n";
            foreach ($sound_files as $value) {
                if (strlen($value) > 0) {
                    if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
                        $var = substr($var, 71);
                    }
                    if ($var == $value) {
                        $tmp_selected = true;
                        echo "\t<option value='{$value}' selected='selected'>{$value}</option>\n";
                    } else {
                        echo "\t<option value='{$value}'>{$value}</option>\n";
                    }
                }
            }
            echo "</optgroup>\n";
        }
    }
    //select
    if (if_group("superadmin")) {
        if (!$tmp_selected && strlen($var) > 0) {
            echo "<optgroup label='Selected'>\n";
            if (file_exists($_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $var)) {
                echo "\t<option value='" . $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $var . "' selected='selected'>" . $var . "</option>\n";
            } else {
                if (substr($var, -3) == "wav" || substr($var, -3) == "mp3") {
                    echo "\t<option value='" . $var . "' selected='selected'>" . $var . "</option>\n";
                } else {
                    echo "\t<option value='" . $var . "' selected='selected'>" . $var . "</option>\n";
                }
            }
            echo "</optgroup>\n";
        }
        unset($tmp_selected);
    }
    echo "\t</select>\n";
    echo "\t<br />\n";
    echo $text['description-' . $description_name] . "\n";
    echo "</td>\n";
    echo "</tr>\n";
}
Exemple #9
0
	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2015
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
	James Rose <*****@*****.**>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('system_status_sofia_status') || permission_exists('system_status_sofia_status_profile') || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//define variables
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
if ($_GET['a'] == "download") {
    if ($_GET['t'] == "cdrcsv") {
        $tmp = $_SESSION['switch']['log']['dir'] . '/cdr-csv/';
Exemple #10
0
function switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action = '', $onchange = '', $text_append = ' ...')
{
    //select_type can be ivr, dialplan, call_center_contact or bridge
    global $text, $config, $db, $domain_uuid;
    //remove special characters from the name
    $select_id = str_replace("]", "", $select_name);
    $select_id = str_replace("[", "_", $select_id);
    if (if_group("superadmin")) {
        echo "<script>\n";
        echo "var Objs;\n";
        echo "\n";
        echo "function changeToInput" . $select_id . "(obj){\n";
        echo "\ttb=document.createElement('INPUT');\n";
        echo "\ttb.type='text';\n";
        echo "\ttb.name=obj.name;\n";
        echo "\ttb.className='formfld';\n";
        echo "\ttb.setAttribute('id', '" . $select_id . "');\n";
        echo "\ttb.setAttribute('style', '" . $select_style . "');\n";
        if ($onchange != '') {
            echo "\ttb.setAttribute('onchange', \"" . $onchange . "\");\n";
            echo "\ttb.setAttribute('onkeyup', \"" . $onchange . "\");\n";
        }
        echo "\ttb.value=obj.options[obj.selectedIndex].value;\n";
        echo "\tdocument.getElementById('btn_select_to_input_" . $select_id . "').style.visibility = 'hidden';\n";
        echo "\ttbb=document.createElement('INPUT');\n";
        echo "\ttbb.setAttribute('class', 'btn');\n";
        echo "\ttbb.setAttribute('style', 'margin-left: 4px;');\n";
        echo "\ttbb.type='button';\n";
        echo "\ttbb.value=\$('<div />').html('&#9665;').text();\n";
        echo "\ttbb.objs=[obj,tb,tbb];\n";
        echo "\ttbb.onclick=function(){ Replace" . $select_id . "(this.objs); }\n";
        echo "\tobj.parentNode.insertBefore(tb,obj);\n";
        echo "\tobj.parentNode.insertBefore(tbb,obj);\n";
        echo "\tobj.parentNode.removeChild(obj);\n";
        echo "\tReplace" . $select_id . "(this.objs);\n";
        echo "}\n";
        echo "\n";
        echo "function Replace" . $select_id . "(obj){\n";
        echo "\tobj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
        echo "\tobj[0].parentNode.removeChild(obj[1]);\n";
        echo "\tobj[0].parentNode.removeChild(obj[2]);\n";
        echo "\tdocument.getElementById('btn_select_to_input_" . $select_id . "').style.visibility = 'visible';\n";
        if ($onchange != '') {
            echo "\t" . $onchange . ";\n";
        }
        echo "}\n";
        echo "</script>\n";
        echo "\n";
    }
    //default selection found to false
    $selection_found = false;
    echo "\t<select name='" . $select_name . "' id='" . $select_id . "' class='formfld' style='" . $select_style . "' onchange=\"" . $onchange . "\">\n";
    //display a default select label (specified explicitly or from the language file) if no selected value is passed in
    if ($select_value == '' && $select_label != '' && $select_label != ' ') {
        $options[] = "<option value=''>" . $select_label . "</option>";
        $options[] = "<option value='' disabled='disabled'></option>";
    } else {
        if ($select_value == '' && $select_label == '' && $text['label-select_destination'] != '') {
            $options[] = "<option value=''>" . $text['label-select_destination'] . "</option>";
            $options[] = "<option value='' disabled='disabled'></option>";
        } else {
            $options[] = "<option value=''></option>";
        }
    }
    //call center queues
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/call_center/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_call_center_queues ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by queue_name asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Call Center'>";
                $previous_call_center_name = "";
                foreach ($result as &$row) {
                    $queue_name = $row["queue_name"];
                    $queue_name = str_replace('_${domain_name}@default', '', $queue_name);
                    $queue_extension = $row["queue_extension"];
                    if ($previous_call_center_name != $queue_name) {
                        $selected = $select_value == "transfer:" . $queue_extension . " XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer " . $queue_extension . " XML " . $_SESSION["context"] ? true : false;
                        if ($select_type == "ivr") {
                            $options[] = "<option value='menu-exec-app:transfer " . $queue_extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $queue_extension . " " . $queue_name . "</option>";
                        }
                        if ($select_type == "dialplan") {
                            $options[] = "<option value='transfer:" . $queue_extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $queue_extension . " " . $queue_name . "</option>";
                        }
                        if ($selected) {
                            $selection_found = true;
                        }
                        $previous_call_center_name = $queue_name;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement);
        }
    }
    //call flows
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/call_flows/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_call_flows ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by call_flow_extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Call Flows'>";
                foreach ($result as &$row) {
                    $call_flow_name = $row["call_flow_name"];
                    $call_flow_extension = $row["call_flow_extension"];
                    $call_flow_context = $row["call_flow_context"];
                    $selected = $select_value == "transfer " . $call_flow_extension . " XML " . $call_flow_context || $select_value == "transfer:" . $call_flow_extension . " XML " . $call_flow_context || $select_value == "menu-exec-app:transfer " . $call_flow_extension . " XML " . $call_flow_context ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $call_flow_extension . " XML " . $call_flow_context . "' " . ($selected ? "selected='selected'" : null) . ">" . $call_flow_extension . " " . $call_flow_name . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $call_flow_extension . " XML " . $call_flow_context . "' " . ($selected ? "selected='selected'" : null) . ">" . $call_flow_extension . " " . $call_flow_name . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement, $call_flow_extension);
        }
    }
    //call groups
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/extensions/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select distinct(call_group) from v_extensions ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and call_group <> '' ";
            $sql .= "order by call_group asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $x = 0;
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $previous_call_group_name = "";
                $options[] = "<optgroup label='Call Group'>";
                foreach ($result as &$row) {
                    $call_groups = $row["call_group"];
                    $call_group_array = explode(",", $call_groups);
                    foreach ($call_group_array as $call_group) {
                        $call_group = trim($call_group);
                        if ($previous_call_group_name != $call_group) {
                            $selected = $select_value == "bridge:group/" . $call_group . "@" . $_SESSION['domain_name'] || $select_value == "menu-exec-app:bridge group/" . $call_group . "@" . $_SESSION['domain_name'] ? true : false;
                            if ($select_type == "ivr") {
                                $options[] = "<option value='menu-exec-app:bridge group/" . $call_group . "@" . $_SESSION['domain_name'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $call_group . "</option>";
                            }
                            if ($select_type == "dialplan") {
                                $options[] = "<option value='bridge:group/" . $call_group . "@" . $_SESSION['domain_name'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $call_group . "</option>";
                            }
                            if ($selected) {
                                $selection_found = true;
                            }
                            $previous_call_group_name = $call_group;
                        }
                    }
                    $x++;
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement);
        }
    }
    //conference centers
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/conference_centers/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_conference_centers ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by conference_center_name asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Conference Centers'>";
                foreach ($result as &$row) {
                    $name = $row["conference_center_name"];
                    $extension = $row["conference_center_extension"];
                    $description = $row["conference_center_description"];
                    $selected = $select_value == "transfer " . $extension . " XML " . $_SESSION['context'] || $select_value == "transfer:" . $extension . " XML " . $_SESSION['context'] || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $_SESSION['context'] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $_SESSION['context'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $name . " " . $description . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $_SESSION['context'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $name . " " . $description . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
                unset($prep_statement);
            }
        }
    }
    //conferences
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/conferences/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_conferences ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by conference_name asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Conferences'>";
                foreach ($result as &$row) {
                    $name = $row["conference_name"];
                    $extension = $row["conference_extension"];
                    $description = $row["conference_description"];
                    $selected = $select_value == "transfer " . $extension . " XML " . $_SESSION['context'] || $select_value == "transfer:" . $extension . " XML " . $_SESSION['context'] || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $_SESSION['context'] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $_SESSION['context'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $name . " " . $description . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $_SESSION['context'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $name . " " . $description . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement);
        }
    }
    //extensions
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/extensions/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr" || $select_type == "call_center_contact") {
            $sql = "select * from v_extensions ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and enabled = 'true' ";
            $sql .= "order by extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Extensions'>";
                foreach ($result as &$row) {
                    $extension = $row["extension"];
                    $context = $row["user_context"];
                    $description = $row["description"];
                    $selected = $select_value == "user/" . $extension . "@" . $_SESSION['domains'][$domain_uuid]['domain_name'] || $select_value == "transfer:" . $extension . " XML " . $context || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $context ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $context . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $description . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $context . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $description . "</option>";
                    }
                    if ($select_type == "call_center_contact") {
                        $options[] = "<option value='user/" . $extension . "@" . $_SESSION['domains'][$domain_uuid]['domain_name'] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $description . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement, $extension);
        }
    }
    //fax extensions
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/fax/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_fax ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by fax_extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='FAX'>";
                foreach ($result as &$row) {
                    $fax_name = $row["fax_name"];
                    $extension = $row["fax_extension"];
                    $selected = $select_value == "transfer " . $extension . " XML " . $_SESSION["context"] || $select_value == "transfer:" . $extension . " XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $fax_name . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $fax_name . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement, $extension);
        }
    }
    //fifo queues
    /*
    if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/fifo/app_config.php")) {
    	if ($select_type == "dialplan" || $select_type == "ivr") {
    		$sql = "select * from v_dialplan_details ";
    		$sql .= "where domain_uuid = '".$domain_uuid."' ";
    		$sql .= "and dialplan_detail_type = 'fifo' ";
    		$sql .= "and dialplan_detail_data not like '%@${domain_name} in%' ";
    		$sql .= "order by dialplan_detail_data asc ";
    		$prep_statement = $db->prepare(check_sql($sql));
    		$prep_statement->execute();
    		$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
    		if (count($result) > 0) {
    			$options[] = "<optgroup label='Queues (FIFO)'>";
    			foreach ($result as &$row) {
    				$dialplan_uuid = $row["dialplan_uuid"];
    				//get the extension number using the dialplan_uuid
    					$sql = "select dialplan_detail_data as extension_number ";
    					$sql .= "from v_dialplan_details ";
    					$sql .= "where domain_uuid = '".$domain_uuid."' ";
    					$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
    					$sql .= "and dialplan_detail_type = 'destination_number' ";
    					$tmp = $db->query($sql)->fetch(PDO::FETCH_ASSOC);
    					$extension_number = $tmp['extension_number'];
    					$extension_number = ltrim($extension_number, "^");
    					$extension_number = ltrim($extension_number, "\\");
    					$extension_number = rtrim($extension_number, "$");
    					unset($tmp);
    
    				//get the extension number using the dialplan_uuid
    					$sql = "select * ";
    					$sql .= "from v_dialplans ";
    					$sql .= "where domain_uuid = '".$domain_uuid."' ";
    					$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
    					$tmp = $db->query($sql)->fetch(PDO::FETCH_ASSOC);
    					$dialplan_name = $tmp['dialplan_name'];
    					$dialplan_name = str_replace("_", " ", $dialplan_name);
    					unset($tmp);
    
    				$fifo_name = $row["dialplan_detail_data"];
    				$fifo_name = str_replace('@${domain_name} in', '', $fifo_name);
    				$option_label = $extension_number.' '.$dialplan_name;
    				if ($select_type == "ivr") {
    					$selected = ("menu-exec-app:transfer ".$row["dialplan_detail_data"] == $select_value) ? true : false;
    					$options[] = "<option value='menu-exec-app:transfer ".$extension_number." XML ".$_SESSION["context"]."' ".(($selected) ? "selected='selected'" : null).">".$option_label."</option>";
    					if ($selected) { $selection_found = true; }
    				}
    				if ($select_type == "dialplan") {
    					$selected = ("transfer:".$extension_number." XML ".$_SESSION["context"] == $select_value) ? true : false;
    					$options[] = "<option value='transfer:".$extension_number." XML ".$_SESSION["context"]."' ".(($selected) ? "selected='selected'" : null).">".$option_label."</option>";
    					if ($selected) { $selection_found = true; }
    				}
    			}
    			$options[] = "</optgroup>";
    		}
    		unset ($prep_statement);
    	}
    }
    */
    //gateways
    if (if_group("superadmin")) {
        $sql = "select v_gateways.gateway_uuid, v_gateways.gateway, v_domains.domain_name from v_gateways ";
        $sql .= "inner join v_domains on v_gateways.domain_uuid=v_domains.domain_uuid ";
        $sql .= "where enabled = 'true' ";
        $sql .= "order by gateway asc ";
        $prep_statement = $db->prepare(check_sql($sql));
        $prep_statement->execute();
        $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
        $tmp_selected = '';
        if (count($result) > 0) {
            if ($select_type == "dialplan" || $select_type == "ivr" || $select_type == "call_center_contact" || $select_type == "bridge") {
                $options[] = "<optgroup label='Gateways'>";
            }
            foreach ($result as $row) {
                switch ($select_type) {
                    case "dialplan":
                        $default_value = 'bridge:sofia/gateway/' . $row['gateway_uuid'] . '/';
                        $selected = strpos($select_value, $default_value) === 0 ? true : false;
                        $value = $selected ? $select_value : $default_value . $text_append;
                        $flag = $selected && $select_value != $default_value . $text_append ? "*" : null;
                        $options[] = "<option value='" . $value . "' " . ($selected ? "selected='selected'" : null) . ">" . $row['gateway'] . "@" . $row['domain_name'] . " " . $flag . "</option>";
                        break;
                    case "bridge":
                        $default_value = 'sofia/gateway/' . $row['gateway_uuid'] . '/';
                        $selected = strpos($select_value, $default_value) === 0 ? true : false;
                        $value = $selected ? $select_value : $default_value . $text_append;
                        $flag = $selected && $select_value != $default_value . $text_append ? "*" : null;
                        $options[] = "<option value='" . $value . "' " . ($selected ? "selected='selected'" : null) . ">" . $row['gateway'] . "@" . $row['domain_name'] . " " . $flag . "</option>";
                        break;
                    case "ivr":
                        $default_value = 'menu-exec-app:bridge sofia/gateway/' . $row['gateway_uuid'] . '/';
                        $selected = strpos($select_value, $default_value) === 0 ? true : false;
                        $value = $selected ? $select_value : $default_value . $text_append;
                        $flag = $selected && $select_value != $default_value . $text_append ? "*" : null;
                        $options[] = "<option value='" . $value . "' " . ($selected ? "selected='selected'" : null) . ">" . $row['gateway'] . "@" . $row['domain_name'] . " " . $flag . "</option>";
                        break;
                    case "call_center_contact":
                        if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/conference_centers/app_config.php")) {
                            $default_value = 'sofia/gateway/' . $row['gateway_uuid'] . '/';
                            $selected = strpos($select_value, $default_value) === 0 ? true : false;
                            $value = $selected ? $select_value : $default_value . $text_append;
                            $flag = $selected && $select_value != $default_value . $text_append ? "*" : null;
                            $options[] = "<option value='" . $value . "' " . ($selected ? "selected='selected'" : null) . ">" . $row['gateway'] . "@" . $row['domain_name'] . " " . $flag . "</option>";
                        }
                        break;
                }
                if ($selected) {
                    $selection_found = true;
                }
            }
            if ($select_type == "dialplan" || $select_type == "ivr" || $select_type == "call_center_contact") {
                $options[] = "</optgroup>";
            }
        }
        unset($prep_statement, $sql, $result, $value, $default_value, $flag);
    }
    //xmpp
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/xmpp/app_config.php")) {
        if (if_group("superadmin") && $select_type == "bridge") {
            $sql = "select v_xmpp.xmpp_profile_uuid, v_xmpp.profile_name, v_domains.domain_name from v_xmpp ";
            $sql .= "inner join v_domains on v_xmpp.domain_uuid=v_domains.domain_uuid ";
            $sql .= "where enabled = 'true' ";
            $sql .= "order by profile_name asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            unset($prep_statement, $sql);
            $tmp_selected = '';
            if (count($result) > 0) {
                $options[] = "<optgroup label='XMPP Gateways'>";
                foreach ($result as $row) {
                    $selected = 'dingaling/' . $row['profile_name'] . '/' == $select_value ? true : false;
                    $options[] = "<option value='dingaling/" . $row['profile_name'] . "/' " . ($selected ? "selected='selected'" : null) . ">" . $row['profile_name'] . "@" . $row['domain_name'] . "</option>";
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($sql, $result);
        }
    }
    //hunt groups
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/hunt_groups/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_hunt_groups ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and hunt_group_enabled = 'true' ";
            $sql .= "and ( ";
            $sql .= "hunt_group_type = 'simultaneous' ";
            $sql .= "or hunt_group_type = 'sequence' ";
            $sql .= "or hunt_group_type = 'sequentially' ";
            $sql .= ") ";
            $sql .= "order by hunt_group_extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Hunt Groups'>";
                foreach ($result as &$row) {
                    $extension = $row["hunt_group_extension"];
                    $hunt_group_name = $row["hunt_group_name"];
                    $selected = $select_value == "transfer " . $extension . " XML " . $_SESSION["context"] || $select_value == "transfer:" . $extension . " XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $hunt_group_name . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $hunt_group_name . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement, $extension);
        }
    }
    //ivr menus
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/ivr_menu/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_ivr_menus ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and ivr_menu_enabled = 'true' ";
            $sql .= "order by ivr_menu_extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='IVR Menu'>";
                foreach ($result as &$row) {
                    $extension = $row["ivr_menu_extension"];
                    $extension_name = $row["ivr_menu_name"];
                    $extension_label = $row["ivr_menu_name"];
                    $extension_name = str_replace(" ", "_", $extension_name);
                    if (count($_SESSION["domains"]) > 1) {
                        $extension_name = $_SESSION['domains'][$row['domain_uuid']]['domain_name'] . '-' . $extension_name;
                    }
                    $selected = $select_value == "ivr " . $extension_name || $select_value == "ivr:" . $extension_name || $select_value == "menu-exec-app:ivr " . $extension || $select_value == "transfer " . $extension . " XML " . $_SESSION["context"] || $select_value == "transfer:" . $extension . " XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $extension_label . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $extension_label . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement, $extension);
        }
    }
    //languages
    if ($select_type == "dialplan" || $select_type == "ivr") {
        $options[] = "<optgroup label='Language'>";
    }
    $tmp_lang_options = array('nl' => 'Dutch', 'en' => 'English', 'fr' => 'French', 'it' => 'Italian', 'de' => 'German', 'pt-pt' => 'Portuguese (Portugal)', 'pt-br' => 'Portuguese (Brazil)', 'es' => 'Spanish');
    foreach ($tmp_lang_options as $tmp_lang_option_abbr => $tmp_lang_option_name) {
        $selected = $select_value == "menu-exec-app:set default_language=" . $tmp_lang_option_abbr || $select_value == "set:default_language=" . $tmp_lang_option_abbr ? true : false;
        if ($select_type == "ivr") {
            $options[] = "\t<option value='menu-exec-app:set default_language=" . $tmp_lang_option_abbr . "' " . ($selected ? "selected='selected'" : null) . ">" . $tmp_lang_option_name . "</option>";
        }
        if ($select_type == "dialplan") {
            $options[] = "\t<option value='set:default_language=" . $tmp_lang_option_abbr . "' " . ($selected ? "selected='selected'" : null) . ">" . $tmp_lang_option_name . "</option>";
        }
        if ($selected) {
            $selection_found = true;
        }
    }
    if ($select_type == "dialplan" || $select_type == "ivr") {
        $options[] = "</optgroup>";
    }
    unset($tmp_lang_options);
    //recordings
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/recordings/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_recordings ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "order by recording_name asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Recordings'>";
                foreach ($result as &$row) {
                    $recording_name = $row["recording_name"];
                    $recording_filename = $row["recording_filename"];
                    $path_mod = $_SESSION['recordings']['storage_type']['text'] != 'base64' ? $_SESSION['switch']['recordings']['dir'] . "/" : null;
                    if ($select_type == "dialplan") {
                        $execute_method = 'lua:';
                    } else {
                        if ($select_type == "ivr") {
                            $execute_method = 'menu-exec-app:lua ';
                        }
                    }
                    $selected = $select_value == $execute_method . "streamfile.lua " . $_SESSION['switch']['recordings']['dir'] . "/" . $recording_filename || $select_value == $execute_method . "streamfile.lua " . $recording_filename ? true : false;
                    $options[] = "<option value='" . $execute_method . "streamfile.lua " . $path_mod . $recording_filename . "' " . ($selected ? "selected='selected'" : null) . ">" . $recording_name . "</option>";
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
        }
    }
    //phrases
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/phrases/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_phrases where domain_uuid = '" . $domain_uuid . "' ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Phrases'>";
                foreach ($result as &$row) {
                    $selected = $select_value == "phrase:" . $row["phrase_name"] . "." . $domain_uuid ? true : false;
                    $options[] = "<option value='phrase:" . $row["phrase_name"] . "." . $domain_uuid . "' " . ($selected ? "selected='selected'" : null) . ">" . $row["phrase_name"] . "</option>";
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement);
        }
    }
    //ring groups
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/ring_groups/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_ring_groups ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and ring_group_enabled = 'true' ";
            $sql .= "order by ring_group_extension asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Ring Groups'>";
                foreach ($result as &$row) {
                    $extension = $row["ring_group_extension"];
                    $context = $row["ring_group_context"];
                    $description = $row["ring_group_description"];
                    $selected = $select_value == "transfer " . $extension . " XML " . $context || $select_value == "transfer:" . $extension . " XML " . $context || $select_value == "menu-exec-app:transfer " . $extension . " XML " . $context ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer " . $extension . " XML " . $context . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $description . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:" . $extension . " XML " . $context . "' " . ($selected ? "selected='selected'" : null) . ">" . $extension . " " . $description . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
        }
    }
    //time conditions
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/time_conditions/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_dialplan_details ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $x = 0;
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                foreach ($result as &$row) {
                    switch ($row['dialplan_detail_type']) {
                        case "hour":
                        case "minute":
                        case "minute-of-day":
                        case "time-of-day":
                        case "mday":
                        case "mweek":
                        case "mon":
                        case "yday":
                        case "year":
                        case "wday":
                        case "week":
                            $time_array[$row['dialplan_uuid']] = $row['dialplan_detail_type'];
                    }
                }
                $options[] = "<optgroup label='Time Conditions'>";
                foreach ($time_array as $key => $val) {
                    $dialplan_uuid = $key;
                    //get the extension number using the dialplan_uuid
                    $sql = "select dialplan_detail_data as extension_number ";
                    $sql .= "from v_dialplan_details ";
                    $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
                    $sql .= "and dialplan_uuid = '" . $dialplan_uuid . "' ";
                    $sql .= "and dialplan_detail_type = 'destination_number' ";
                    $sql .= "order by extension_number asc ";
                    $tmp = $db->query($sql)->fetch(PDO::FETCH_ASSOC);
                    $extension_number = $tmp['extension_number'];
                    $extension_number = ltrim($extension_number, "^");
                    $extension_number = ltrim($extension_number, "\\");
                    $extension_number = rtrim($extension_number, "\$");
                    unset($tmp);
                    //get the extension number using the dialplan_uuid
                    $sql = "select * ";
                    $sql .= "from v_dialplans ";
                    $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
                    $sql .= "and dialplan_uuid = '" . $dialplan_uuid . "' ";
                    $tmp = $db->query($sql)->fetch(PDO::FETCH_ASSOC);
                    $dialplan_name = $tmp['dialplan_name'];
                    $dialplan_name = str_replace("_", " ", $dialplan_name);
                    unset($tmp);
                    $option_label = $extension_number . ' ' . $dialplan_name;
                    if ($select_type == "ivr") {
                        $selected = "menu-exec-app:transfer " . $extension_number . " XML " . $_SESSION["context"] == $select_value ? true : false;
                        $options[] = "<option value='menu-exec-app:transfer " . $extension_number . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $option_label . "</option>";
                        if ($selected) {
                            $selection_found = true;
                        }
                    }
                    if ($select_type == "dialplan") {
                        $selected = "transfer:" . $extension_number . " XML " . $_SESSION["context"] == $select_value ? true : false;
                        $options[] = "<option value='transfer:" . $extension_number . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $option_label . "</option>";
                        if ($selected) {
                            $selection_found = true;
                        }
                    }
                }
                $options[] = "</optgroup>";
            }
            unset($prep_statement);
        }
    }
    //voicemail
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/voicemails/app_config.php")) {
        if ($select_type == "dialplan" || $select_type == "ivr") {
            $sql = "select * from v_voicemails ";
            $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
            $sql .= "and voicemail_enabled = 'true' ";
            $sql .= "order by voicemail_id asc ";
            $prep_statement = $db->prepare(check_sql($sql));
            $prep_statement->execute();
            $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
            if (count($result) > 0) {
                $options[] = "<optgroup label='Voicemail'>";
                foreach ($result as &$row) {
                    $voicemail_id = $row["voicemail_id"];
                    $description = $row["voicemail_description"];
                    $selected = $select_value == "voicemail default \${domain_name} " . $voicemail_id || $select_value == "voicemail:default \${domain_name} " . $voicemail_id || $select_value == "transfer:*99" . $voicemail_id . " XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer *99" . $voicemail_id . " XML " . $_SESSION["context"] ? true : false;
                    if ($select_type == "ivr") {
                        $options[] = "<option value='menu-exec-app:transfer *99" . $voicemail_id . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $voicemail_id . " " . $description . "</option>";
                    }
                    if ($select_type == "dialplan") {
                        $options[] = "<option value='transfer:*99" . $voicemail_id . " XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">" . $voicemail_id . " " . $description . "</option>";
                    }
                    if ($selected) {
                        $selection_found = true;
                    }
                }
                $options[] = "</optgroup>";
            }
        }
    }
    //other
    if ($select_type == "dialplan" || $select_type == "ivr") {
        $options[] = "<optgroup label='Other'>";
        //set the default value
        $selected = '';
        //check voicemail
        $selected = $select_value == "transfer:*98 XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer *98 XML " . $_SESSION["context"] ? true : false;
        if ($select_type == "dialplan") {
            $options[] = "<option value='transfer:*98 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">check voicemail</option>";
        } else {
            if ($select_type == "ivr") {
                $options[] = "<option value='menu-exec-app:transfer *98 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">check voicemail</option>";
            }
        }
        if ($selected) {
            $selection_found = true;
        }
        //company directory
        $selected = $select_value == "transfer:*411 XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer *411 XML " . $_SESSION["context"] ? true : false;
        if ($select_type == "dialplan") {
            $options[] = "<option value='transfer:*411 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">company directory</option>";
        } else {
            if ($select_type == "ivr") {
                $options[] = "<option value='menu-exec-app:transfer *411 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">company directory</option>";
            }
        }
        if ($selected) {
            $selection_found = true;
        }
        //record
        $selected = $select_value == "transfer:*732 XML " . $_SESSION["context"] || $select_value == "menu-exec-app:transfer *732 XML " . $_SESSION["context"] ? true : false;
        if ($select_type == "dialplan") {
            $options[] = "<option value='transfer:*732 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">record</option>";
        } else {
            if ($select_type == "ivr") {
                $options[] = "<option value='menu-exec-app:transfer *732 XML " . $_SESSION["context"] . "' " . ($selected ? "selected='selected'" : null) . ">record</option>";
            }
        }
        if ($selected) {
            $selection_found = true;
        }
        //advanced
        if (if_group("superadmin")) {
            //answer
            $selected = $select_value == "answer" || $select_value == "menu-exec-app:answer" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='answer' " . ($selected ? "selected='selected'" : null) . ">answer</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:answer' " . ($selected ? "selected='selected'" : null) . ">answer</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //hangup
            $selected = $select_value == "hangup" || $select_value == "menu-exec-app:hangup" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='hangup' " . ($selected ? "selected='selected'" : null) . ">hangup</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:hangup' " . ($selected ? "selected='selected'" : null) . ">hangup</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //info
            $selected = $select_value == "info" || $select_value == "menu-exec-app:info" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='info' " . ($selected ? "selected='selected'" : null) . ">info</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:info' " . ($selected ? "selected='selected'" : null) . ">info</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //bridge
            $selected = $select_value == "bridge" || $select_value == "bridge:" || $select_value == "menu-exec-app:bridge" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='bridge:' " . ($selected ? "selected='selected'" : null) . ">bridge</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:bridge ' " . ($selected ? "selected='selected'" : null) . ">bridge</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //db
            $selected = $select_value == "db" || $select_value == "db:" || $select_value == "menu-exec-app:db" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='db:' " . ($selected ? "selected='selected'" : null) . ">db</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:db ' " . ($selected ? "selected='selected'" : null) . ">db</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //export
            $selected = $select_value == "export" || $select_value == "export:" || $select_value == "menu-exec-app:export" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='export:' " . ($selected ? "selected='selected'" : null) . ">export</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:export ' " . ($selected ? "selected='selected'" : null) . ">export</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //global_set
            $selected = $select_value == "global_set" || $select_value == "global_set:" || $select_value == "menu-exec-app:global_set" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='global_set:' " . ($selected ? "selected='selected'" : null) . ">global_set</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:global_set ' " . ($selected ? "selected='selected'" : null) . ">global_set</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //group
            $selected = $select_value == "group" || $select_value == "group:" || $select_value == "menu-exec-app:group" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='group:' " . ($selected ? "selected='selected'" : null) . ">group</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:group ' " . ($selected ? "selected='selected'" : null) . ">group</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //javascript
            $selected = $select_value == "javascript" || $select_value == "javascript:" || $select_value == "menu-exec-app:javascript" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='javascript:' " . ($selected ? "selected='selected'" : null) . ">javascript</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:javascript ' " . ($selected ? "selected='selected'" : null) . ">javascript</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //lua
            $selected = $select_value == "lua" || $select_value == "lua:" || $select_value == "menu-exec-app:lua" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='lua:' " . ($selected ? "selected='selected'" : null) . ">lua</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:lua ' " . ($selected ? "selected='selected'" : null) . ">lua</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //perl
            $selected = $select_value == "perl" || $select_value == "perl:" || $select_value == "menu-exec-app:perl" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='perl:' " . ($selected ? "selected='selected'" : null) . ">perl</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:perl ' " . ($selected ? "selected='selected'" : null) . ">perl</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //reject
            $selected = $select_value == "reject" || $select_value == "menu-exec-app:reject" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='reject' " . ($selected ? "selected='selected'" : null) . ">reject</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:reject' " . ($selected ? "selected='selected'" : null) . ">reject</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //set
            $selected = $select_value == "set" || $select_value == "set:" || $select_value == "menu-exec-app:set" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='set:' " . ($selected ? "selected='selected'" : null) . ">set</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:set ' " . ($selected ? "selected='selected'" : null) . ">set</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //sleep
            $selected = $select_value == "sleep" || $select_value == "sleep:" || $select_value == "menu-exec-app:sleep" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='sleep:' " . ($selected ? "selected='selected'" : null) . ">sleep</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:sleep ' " . ($selected ? "selected='selected'" : null) . ">sleep</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
            //transfer
            $selected = $select_value == "transfer" || $select_value == "transfer:" || $select_value == "menu-exec-app:transfer" ? true : false;
            if ($select_type == "dialplan") {
                $options[] = "<option value='transfer:' " . ($selected ? "selected='selected'" : null) . ">transfer</option>";
            } else {
                if ($select_type == "ivr") {
                    $options[] = "<option value='menu-exec-app:transfer ' " . ($selected ? "selected='selected'" : null) . ">transfer</option>";
                }
            }
            if ($selected) {
                $selection_found = true;
            }
        }
        $options[] = "</optgroup>";
    }
    //custom
    if (!$selection_found && $select_value != '') {
        array_unshift($options, "<option value='" . $select_value . "' selected='selected'>" . $select_value . "</option>", "<option value='' disabled='disabled'></option>");
    }
    //output options
    if (sizeof($options) > 0) {
        echo implode("\n", $options);
    }
    echo "\t</select>\n";
    if (if_group("superadmin")) {
        echo "<input type='button' id='btn_select_to_input_" . $select_id . "' class='btn' name='' alt='back' onclick='changeToInput" . $select_id . "(document.getElementById(\"" . $select_id . "\"));this.style.visibility = \"hidden\";' value='&#9665;'>";
    }
}
License.

The Original Code is FusionPBX

The Initial Developer of the Original Code is
Mark J Crane <*****@*****.**>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.

Contributor(s):
Mark J Crane <*****@*****.**>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (if_group('superadmin')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
// retrieve software uuid
$sql = "select software_uuid, software_url, software_version from v_software";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
    $prep_statement->execute();
    $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
    foreach ($result as &$row) {
    $sql .= "default_setting_category = 'login' ";
    $sql .= "and default_setting_subcategory = 'message' ";
    $sql .= "and default_setting_name = 'text' ";
    $db->exec(check_sql($sql));
    unset($sql);
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//load header
require_once "resources/header.php";
$document['title'] = $text['title-user_dashboard'];
echo "<b>" . $text['header-user_dashboard'] . "</b><br>";
echo $text['description-user_dashboard'];
//display login message
if (if_group("superadmin") && $_SESSION['login']['message']['text'] != '') {
    echo "<br /><br /><br />";
    echo "<div class='login_message' width='100%'><b>" . $text['login-message_attention'] . "</b>&nbsp;&nbsp;" . $_SESSION['login']['message']['text'] . "&nbsp;&nbsp;(<a href='?msg=dismiss'>" . $text['login-message_dismiss'] . "</a>)</div>";
}
//start the user table
echo "<br />";
echo "<br />";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo "\t<th class='th' colspan='2' align='left'>" . $text['title-user-settings'] . " &nbsp;</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "\t<td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo "\t\t" . $text['label-username'] . "\n";
echo "\t</td>\n";
echo "\t<td class=\"row_style1\">\n";
	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('group_member_delete') || if_group("superadmin")) {
    //access allowed
} else {
    echo "access denied";
    return;
}
//requires a superadmin to delete superadmin group
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
    echo "access denied";
    return;
}
//get the http values and set them as variables
$group_name = check_str($_GET["group_name"]);
$user_uuid = check_str($_GET["user_uuid"]);
$group_uuid = check_str($_GET["group_uuid"]);
//delete the group membership
$sql_delete = "delete from v_group_users ";
$sql_delete .= "where user_uuid = '" . $user_uuid . "' ";
$sql_delete .= "and group_uuid = '" . $group_uuid . "' ";
if (!$db->exec($sql_delete)) {
    $info = $db->errorInfo();
    echo "<pre>" . print_r($info, true) . "</pre>";
    exit;
Exemple #14
0
	License.

	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2014
	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("device_key_add") || permission_exists("device_key_edit") || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//set the variables
$cmd = check_str($_GET['cmd']);
$rdr = check_str($_GET['rdr']);
$profile = check_str($_GET['profile']);
$domain = check_str($_GET['domain']);
$show = check_str($_GET['show']);
$user = check_str($_GET['user']);
	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2016
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('group_permissions') || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//include the header
$document['title'] = $text['title-group_permissions'];
require_once "resources/header.php";
//include paging
require_once "resources/paging.php";
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
Exemple #16
0
     $echo .= "<td class='" . $row_style[$c] . "' nowrap>";
     $echo .= $domain_uuid != '' ? $_SESSION['domains'][$domain_uuid]['domain_name'] : "<i>" . $text['label-global'] . "</i>";
     $echo .= "</td>\n";
 }
 $echo .= "<td class='" . $row_style[$c] . "' nowrap>";
 if (permission_exists('group_edit') && !($domain_uuid == '' && in_array($group_name, $system_groups))) {
     $echo .= "<a href='groupedit.php?id=" . $group_uuid . "'>" . ($domain_uuid == '' && $_GET['showall'] != 'true' ? "<i>" . $group_name . "</i>" : $group_name) . "</a>";
 } else {
     $echo .= $domain_uuid == '' && $_GET['showall'] != 'true' ? "<i>" . $group_name . "</i>" : $group_name;
 }
 $echo .= "</td>\n";
 $echo .= "<td class='" . $row_style[$c] . " tr_link_void' nowrap>\n";
 if (permission_exists('group_add') || if_group("superadmin")) {
     $echo .= "<a class='' href='group_permissions.php?group_uuid=" . $group_uuid . "' title='" . $text['label-group_permissions'] . "'>" . $text['label-group_permissions'] . "</a>&nbsp;&nbsp;&nbsp;";
 }
 if (permission_exists('group_member_view') || if_group("superadmin")) {
     $echo .= "<a class='' href='groupmembers.php?group_uuid=" . $group_uuid . "&group_name=" . $group_name . "' title='" . $text['label-group_members'] . "'>" . $text['label-group_members'] . "</a>";
     if (sizeof($group_counts) > 0 && $group_counts[$group_uuid] > 0) {
         $echo .= " <span style='font-size: 80%;'>(" . $group_counts[$group_uuid] . ")</span>";
     }
 }
 $echo .= "</td>\n";
 $echo .= "<td class='" . $row_style[$c] . " tr_link_void' style='padding: 0px; text-align: center;' align='center' nowrap>\n";
 $echo .= "\t<input type='checkbox' name='group_protected' " . ($group_protected == "true" ? "checked='checked'" : null) . " value='" . ($group_protected == "true" ? 'false' : 'true') . "' onchange=\"window.location='" . PROJECT_PATH . "/core/users/groups.php?change=" . ($group_protected == "true" ? 'false' : 'true') . "&group_uuid=" . $group_uuid . "&group_name=" . $group_name . ($_GET['showall'] == 'true' ? "&showall=true" : null) . "';\">\n";
 $echo .= "</td>\n";
 $echo .= "<td class='row_stylebg' nowrap>" . $group_description . "</td>\n";
 $echo .= "<td class='list_control_icons' style='width: 25px;'>";
 if (permission_exists('group_edit')) {
     if (!($domain_uuid == '' && in_array($group_name, $system_groups))) {
         $echo .= "<a href='groupedit.php?id=" . $group_uuid . "' alt='" . $text['button-edit'] . "'>" . $v_link_label_edit . "</a>";
     } else {
Exemple #17
0
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['extensions']['total'] . "</td>\n";
     $hud[$n]['html'] .= "</tr>\n";
     $c = $c ? 0 : 1;
 }
 //gateways
 if (permission_exists('gateway_view') && file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/gateways/")) {
     $tr_link = "href='" . PROJECT_PATH . "/app/gateways/gateways.php'";
     $hud[$n]['html'] .= "<tr " . $tr_link . ">\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text'><a " . $tr_link . ">" . $text['label-gateways'] . "</a></td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['gateways']['disabled'] . "</td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['gateways']['total'] . "</td>\n";
     $hud[$n]['html'] .= "</tr>\n";
     $c = $c ? 0 : 1;
 }
 //users
 if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/core/users/")) {
     $tr_link = "href='" . PROJECT_PATH . "/core/users/index.php'";
     $hud[$n]['html'] .= "<tr " . $tr_link . ">\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text'><a " . $tr_link . ">" . $text['label-users'] . "</a></td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['users']['disabled'] . "</td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['users']['total'] . "</td>\n";
     $hud[$n]['html'] .= "</tr>\n";
     $c = $c ? 0 : 1;
 }
 //destinations
 if (permission_exists('destination_view') && file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/destinations/")) {
     $tr_link = "href='" . PROJECT_PATH . "/app/destinations/destinations.php'";
     $hud[$n]['html'] .= "<tr " . $tr_link . ">\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text'><a " . $tr_link . ">" . $text['label-destinations'] . "</a></td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['destinations']['disabled'] . "</td>\n";
     $hud[$n]['html'] .= "<td valign='top' class='" . $row_style[$c] . " hud_text' style='text-align: center;'>" . $stats[$scope]['destinations']['total'] . "</td>\n";
             require_once $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/extensions/resources/classes/extension.php";
             $extension = new extension();
             $extension->xml();
         }
         // if single-tenant and variables exist, update variables > domain value to match new domain
         if (count($_SESSION['domains']) == 1 && file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/vars/")) {
             $sql = "update v_vars set ";
             $sql .= "var_value = '" . $domain_name . "' ";
             $sql .= "where var_name = 'domain' ";
             $db->exec(check_sql($sql));
             unset($sql);
         }
     }
 }
 //upgrade the domains
 if (permission_exists('upgrade_apps') || if_group("superadmin")) {
     require_once "core/upgrade/upgrade_domains.php";
 }
 //clear the domains session array to update it
 unset($_SESSION["domains"]);
 unset($_SESSION["domain_uuid"]);
 unset($_SESSION["domain_name"]);
 unset($_SESSION['domain']);
 unset($_SESSION['switch']);
 //redirect the browser
 if ($action == "update") {
     $_SESSION["message"] = $text['message-update'];
 }
 if ($action == "add") {
     $_SESSION["message"] = $text['message-add'];
 }
     $sql = "select * from v_fax ";
     $sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
     $sql .= "and fax_uuid = '{$fax_uuid}' ";
 } else {
     //show only assigned fax extensions
     $sql = "select * from v_fax as f, v_fax_users as u ";
     $sql .= "where f.fax_uuid = u.fax_uuid ";
     $sql .= "and f.domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
     $sql .= "and f.fax_uuid = '{$fax_uuid}' ";
     $sql .= "and u.user_uuid = '" . $_SESSION['user_uuid'] . "' ";
 }
 $prep_statement = $db->prepare(check_sql($sql));
 $prep_statement->execute();
 $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
 if (count($result) == 0) {
     if (!if_group("superadmin") && !if_group("admin")) {
         echo "access denied";
         exit;
     }
 }
 foreach ($result as &$row) {
     $fax_name = $row["fax_name"];
     $fax_extension = $row["fax_extension"];
     $fax_email_connection_type = $row["fax_email_connection_type"];
     $fax_email_connection_host = $row["fax_email_connection_host"];
     $fax_email_connection_port = $row["fax_email_connection_port"];
     $fax_email_connection_security = $row["fax_email_connection_security"];
     $fax_email_connection_validate = $row["fax_email_connection_validate"];
     $fax_email_connection_username = $row["fax_email_connection_username"];
     $fax_email_connection_password = $row["fax_email_connection_password"];
     $fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
 }
 echo "<th>" . $text['label-number'] . "</th>\n";
 echo "<th>" . $text['label-cid-name'] . "</th>\n";
 echo "<th>" . $text['label-cid-number'] . "</th>\n";
 echo "<th>" . $text['label-destination'] . "</th>\n";
 echo "<th>" . $text['label-app'] . "</th>\n";
 echo "<th>" . $text['label-codec'] . "</th>\n";
 echo "<th>" . $text['label-secure'] . "</th>\n";
 echo "<td class='list_control_icon'></td>\n";
 echo "</tr>\n";
 foreach ($rows as &$row) {
     //set the php variables
     foreach ($row as $key => $value) {
         ${$key} = $value;
     }
     if (if_group("superadmin") && isset($_REQUEST['debug'])) {
         echo "<tr><td colspan='20'><pre>" . print_r($row, true) . "</pre></td></tr>";
     }
     //get the sip profile
     $name_array = explode("/", $name);
     $sip_profile = $name_array[1];
     $sip_uri = $name_array[2];
     //get the number
     $temp_array = explode("@", $sip_uri);
     $tmp_number = $temp_array[0];
     $tmp_number = str_replace("sip:", "", $tmp_number);
     //get the domain
     if ($show == 'all') {
         if (substr_count($presence_id, '@') > 0) {
             $presence_id_array = explode('@', $presence_id);
             $domain_name = $presence_id_array[1];
	}

</script>

<?php 
echo "<form method='post' name='frm' action='' onsubmit=\"return check_submit();\">\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "\t<tr>\n";
echo "\t\t<td align='left' valign='top'>\n";
echo "\t\t\t<span class='title'>" . $text['title-time-conditions'] . "</span>";
echo "\t\t\t<br /><br />\n";
echo "\t\t\t" . $text['description-time_conditions'] . "\n";
echo "\t\t</td>\n";
echo "\t\t<td align='right' valign='top'>\n";
echo "\t\t\t<input type='button' class='btn' name='' alt='" . $text['button-back'] . "' onclick=\"window.location='" . PROJECT_PATH . "/app/time_conditions/time_conditions.php?app_uuid=4b821450-926b-175a-af93-a03c441818b1'\" value='" . $text['button-back'] . "'>\n";
if (if_group("superadmin") && $action == 'update') {
    echo "\t\t<input type='button' class='btn' name='' alt='" . $text['button-dialplan'] . "' onclick=\"document.location.href='" . PROJECT_PATH . "/app/dialplan/dialplan_edit.php?id=" . $dialplan_uuid . "&app_uuid=4b821450-926b-175a-af93-a03c441818b1'\" value='" . $text['button-dialplan'] . "'>\n";
}
echo "\t\t\t<input type='submit' name='submit' class='btn' value='" . $text['button-save'] . "'>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
echo "</table>";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='20%' class='vncellreq' valign='top' align='left' nowrap>\n";
echo "    " . $text['label-name'] . "\n";
echo "</td>\n";
echo "<td width='80%' class='vtable' align='left'>\n";
echo "    <input class='formfld' type='text' name='dialplan_name' maxlength='255' value=\"" . $dialplan_name . "\">\n";
echo "\t<br />\n";
    $sql .= "'" . $request['vad'] . "', ";
    $sql .= "'" . $request['avatar'] . "', ";
    $sql .= "'" . $request['candidate_acl'] . "', ";
    $sql .= "'" . $request['local_network_acl'] . "', ";
    $sql .= "'" . $request['description'] . "', ";
    $sql .= "'" . $request['enabled'] . "' ";
    $sql .= ") ";
    $db->exec(check_sql($sql));
} elseif ($action == "update" && permission_exists('xmpp_edit')) {
    $sql = "";
    $sql .= "UPDATE v_xmpp SET ";
    $sql .= "profile_name = '" . $request['profile_name'] . "', ";
    $sql .= "username = '******'profile_username'] . "', ";
    $sql .= "password = '******'profile_password'] . "', ";
    $sql .= "dialplan = '" . $request['dialplan'] . "', ";
    if (if_group("superadmin") && $request['context']) {
        $sql .= "context = '" . $request['context'] . "', ";
    } else {
        $sql .= "context = '" . $_SESSION["context"] . "', ";
    }
    $sql .= "rtp_ip = '" . $request['rtp_ip'] . "', ";
    $sql .= "ext_rtp_ip = '" . $request['ext_rtp_ip'] . "', ";
    $sql .= "auto_login = '******'auto_login'] . "', ";
    $sql .= "sasl_type = '" . $request['sasl_type'] . "', ";
    $sql .= "xmpp_server = '" . $request['xmpp_server'] . "', ";
    $sql .= "tls_enable = '" . $request['tls_enable'] . "', ";
    $sql .= "use_rtp_timer = '" . $request['use_rtp_timer'] . "', ";
    $sql .= "default_exten = '" . $request['default_exten'] . "', ";
    $sql .= "vad = '" . $request['vad'] . "', ";
    $sql .= "avatar = '" . $request['avatar'] . "', ";
    $sql .= "candidate_acl = '" . $request['candidate_acl'] . "', ";
Exemple #23
0
 echo "<tr>\n";
 echo "\t<td align='left' valign='top' width='30%'>\n";
 echo "\t\t<span class='title'>" . $text['header-send'] . "</span>\n";
 echo "\t</td>\n";
 echo "\t<td width='70%' align='right' valign='top'>\n";
 echo "\t\t<input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='" . $text['button-back'] . "'>\n";
 echo "\t\t<input type='submit' name='submit' class='btn' id='preview' value='" . $text['button-preview'] . "'>\n";
 echo "\t\t<input name='submit' type='submit' class='btn' id='upload' value='" . $text['button-send'] . "'>\n";
 echo "\t</td>\n";
 echo "</tr>\n";
 echo "</table>\n";
 echo "<br>\n";
 echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
 echo "\t<tr>\n";
 echo "\t\t<td colspan='2' align='left'>\n";
 echo "\t\t\t" . $text['description-2'] . " " . (if_group('superadmin') ? $text['description-3'] : null) . " \n";
 echo "\t\t\t<br /><br />\n";
 echo "\t\t</td>\n";
 echo "\t</tr>\n";
 echo "<tr>\n";
 echo "<td class='vncell' valign='top' align='left' nowrap>\n";
 echo "\t" . $text['label-fax-header'] . "\n";
 echo "</td>\n";
 echo "<td class='vtable' align='left'>\n";
 echo "\t<input type='text' name='fax_header' class='formfld' style='' value='" . $_SESSION['fax']['cover_header']['text'] . "'>\n";
 echo "\t<br />\n";
 echo "\t" . $text['description-fax-header'] . "\n";
 echo "</td>\n";
 echo "</tr>\n";
 echo "<tr>\n";
 echo "<td class='vncell' valign='top' align='left' nowrap>\n";
	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2016
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
	James Rose <*****@*****.**>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//get the HTTP values and set as variables
$sip_profile_name = trim($_REQUEST["profile"]);
$show = trim($_REQUEST["show"]);
if ($show != "all") {
    $show = '';
}
//define variables
	License.

	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2012
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (if_group("admin") || if_group("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
require_once "resources/header.php";
require_once "resources/paging.php";
$order_by = $_GET["order_by"];
$order = $_GET["order"];
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo "\t<td align=\"center\">\n";
echo "\t\t<br>";
echo "<table width='100%' border='0'>\n";
Exemple #26
0
    } else {
        $content_prep_statement->bindParam(':content', $content);
    }
    $content_prep_statement->execute();
    $content_result = $content_prep_statement->fetchAll(PDO::FETCH_NAMED);
    $page["title"] = '';
    foreach ($content_result as $content_row) {
        $template_rss_sub_category = $content_row['rss_sub_category'];
        if (strlen($content_row['rss_group']) == 0) {
            //content is public
            $content_from_db =& $content_row['rss_description'];
            if (strlen($content_row['rss_title']) > 0) {
                $page["title"] = $content_row['rss_title'];
            }
        } else {
            if (if_group($content_row[rss_group])) {
                //viewable only to designated group
                $content_from_db =& $content_row[rss_description];
                if (strlen($content_row['rss_title']) > 0) {
                    $page["title"] = $content_row['rss_title'];
                }
            }
        }
    }
    //end foreach
    unset($sql, $content_result, $content_row);
}
//start the output buffer
ob_start();
//for translate tool (if available)
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/translate")) {
Exemple #27
0
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
    echo "\t" . $text['label-description'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    echo "\t<input class='formfld' type='text' name='fax_description' maxlength='255' value=\"{$fax_description}\">\n";
    echo "<br />\n";
    echo "" . $text['description-info'] . "\n";
    echo "</td>\n";
    echo "</tr>\n";
}
echo "\t<tr>\n";
echo "\t\t<td colspan='2' align='right'>\n";
echo "\t\t\t<br>";
if ($action == "update") {
    if (if_group("user")) {
        echo "\t<input type='hidden' name='fax_name' value=\"{$fax_name}\">\n";
        echo "\t<input type='hidden' name='fax_extension' value=\"{$fax_extension}\">\n";
        echo "\t<input type='hidden' name='fax_destination_number' value=\"{$fax_destination_number}\">\n";
        echo "\t<input type='hidden' name='fax_caller_id_name' value=\"{$fax_caller_id_name}\">\n";
        echo "\t<input type='hidden' name='fax_caller_id_number' value=\"{$fax_caller_id_number}\">\n";
        echo "\t<input type='hidden' name='fax_forward_number' value=\"" . (is_numeric($fax_forward_number) ? format_phone($fax_forward_number) : $fax_forward_number) . "\">\n";
        echo "\t<input type='hidden' name='fax_description' value=\"{$fax_description}\">\n";
    }
    echo "\t\t<input type='hidden' name='fax_uuid' value='{$fax_uuid}'>\n";
    echo "\t\t<input type='hidden' name='dialplan_uuid' value='{$dialplan_uuid}'>\n";
}
echo "\t\t\t<input type='submit' name='submit' class='btn' value='" . $text['button-save'] . "'>\n";
echo "\t\t</td>\n";
echo "\t</tr>";
echo "</table>";
 /**
  * Get the destination menu
  * @var string $destination_type can be ivr, dialplan, call_center_contact or bridge
  * @var string $destination_name - current name
  * @var string $destination_value - current value
  */
 public function select($destination_type, $destination_name, $destination_value)
 {
     //remove special characters from the name
     $destination_id = str_replace("]", "", $destination_name);
     $destination_id = str_replace("[", "_", $destination_id);
     //add additional
     if (if_group("superadmin")) {
         $response = "<script>\n";
         $response .= "var Objs;\n";
         $response .= "\n";
         $response .= "function changeToInput" . $destination_id . "(obj){\n";
         $response .= "\ttb=document.createElement('INPUT');\n";
         $response .= "\ttb.type='text';\n";
         $response .= "\ttb.name=obj.name;\n";
         $response .= "\ttb.className='formfld';\n";
         $response .= "\ttb.setAttribute('id', '" . $destination_id . "');\n";
         $response .= "\ttb.setAttribute('style', '" . $select_style . "');\n";
         if ($onchange != '') {
             $response .= "\ttb.setAttribute('onchange', \"" . $onchange . "\");\n";
             $response .= "\ttb.setAttribute('onkeyup', \"" . $onchange . "\");\n";
         }
         $response .= "\ttb.value=obj.options[obj.selectedIndex].value;\n";
         $response .= "\tdocument.getElementById('btn_select_to_input_" . $destination_id . "').style.visibility = 'hidden';\n";
         $response .= "\ttbb=document.createElement('INPUT');\n";
         $response .= "\ttbb.setAttribute('class', 'btn');\n";
         $response .= "\ttbb.setAttribute('style', 'margin-left: 4px;');\n";
         $response .= "\ttbb.type='button';\n";
         $response .= "\ttbb.value=\$('<div />').html('&#9665;').text();\n";
         $response .= "\ttbb.objs=[obj,tb,tbb];\n";
         $response .= "\ttbb.onclick=function(){ Replace" . $destination_id . "(this.objs); }\n";
         $response .= "\tobj.parentNode.insertBefore(tb,obj);\n";
         $response .= "\tobj.parentNode.insertBefore(tbb,obj);\n";
         $response .= "\tobj.parentNode.removeChild(obj);\n";
         $response .= "\tReplace" . $destination_id . "(this.objs);\n";
         $response .= "}\n";
         $response .= "\n";
         $response .= "function Replace" . $destination_id . "(obj){\n";
         $response .= "\tobj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
         $response .= "\tobj[0].parentNode.removeChild(obj[1]);\n";
         $response .= "\tobj[0].parentNode.removeChild(obj[2]);\n";
         $response .= "\tdocument.getElementById('btn_select_to_input_" . $destination_id . "').style.visibility = 'visible';\n";
         if ($onchange != '') {
             $response .= "\t" . $onchange . ";\n";
         }
         $response .= "}\n";
         $response .= "</script>\n";
         $response .= "\n";
     }
     //set default to false
     $select_found = false;
     $response .= "\t<select name='" . $destination_name . "' id='" . $destination_id . "' class='formfld' style='" . $select_style . "' onchange=\"" . $onchange . "\">\n";
     $response .= "\t\t\t<option value=''></option>\n";
     foreach ($this->destinations as $row) {
         $name = $row['name'];
         $label = $row['label'];
         $destination = $row['field']['destination'];
         //add multi-lingual support
         if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/" . $name . "/app_languages.php")) {
             $language2 = new text();
             $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/' . $name);
         }
         if (count($row['result']['data']) > 0 and strlen($row['select_value'][$destination_type]) > 0) {
             $response .= "\t\t<optgroup label='" . $text2['title-' . $label] . "'>\n";
             $label2 = $label;
             foreach ($row['result']['data'] as $data) {
                 $select_value = $row['select_value'][$destination_type];
                 $select_label = $row['select_label'];
                 foreach ($row['field'] as $key => $value) {
                     if ($key == 'destination' and is_array($value)) {
                         if ($value['type'] == 'csv') {
                             $array = explode($value['delimiter'], $data[$key]);
                             $select_value = str_replace("\${destination}", $array[0], $select_value);
                             $select_label = str_replace("\${destination}", $array[0], $select_label);
                         }
                     } else {
                         if (strpos($value, ',') !== false) {
                             $keys = explode(",", $value);
                             foreach ($keys as $k) {
                                 if (strlen($data[$k]) > 0) {
                                     $select_value = str_replace("\${" . $key . "}", $data[$k], $select_value);
                                     if (strlen($data['label']) == 0) {
                                         $select_label = str_replace("\${" . $key . "}", $data[$k], $select_label);
                                     } else {
                                         $label = $data['label'];
                                         $select_label = str_replace("\${" . $key . "}", $text2['option-' . $label], $select_label);
                                     }
                                 }
                             }
                         } else {
                             $select_value = str_replace("\${" . $key . "}", $data[$key], $select_value);
                             if (strlen($data['label']) == 0) {
                                 $select_label = str_replace("\${" . $key . "}", $data[$key], $select_label);
                             } else {
                                 $label = $data['label'];
                                 $select_label = str_replace("\${" . $key . "}", $text2['option-' . $label], $select_label);
                             }
                         }
                         //application: hangup
                         if (strlen($data['application']) > 0) {
                             $select_value = str_replace("transfer", $data['application'], $select_value);
                         }
                     }
                 }
                 $select_value = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_value);
                 $select_value = str_replace("\${context}", $_SESSION['context'], $select_value);
                 //to do: context can come from the array
                 $select_label = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_label);
                 $select_label = str_replace("\${context}", $_SESSION['context'], $select_label);
                 $select_label = trim($select_label);
                 if ($select_value == $destination_value) {
                     $selected = "selected='selected' ";
                     $select_found = true;
                 } else {
                     $selected = '';
                 }
                 if ($label2 == 'destinations') {
                     $select_label = format_phone($select_label);
                 }
                 $response .= "\t\t\t<option value='" . $select_value . "' " . $selected . ">" . $select_label . "</option>\n";
             }
             $response .= "\t\t</optgroup>\n";
             unset($text);
         }
     }
     if (!$select_found) {
         $destination_label = str_replace(":", " ", $destination_value);
         $destination_label = str_replace("menu-exec-app:", " ", $destination_label);
         $response .= "\t\t\t<option value='" . $destination_value . "' selected='selected'>" . trim($destination_label) . "</option>\n";
     }
     $response .= "\t</select>\n";
     if (if_group("superadmin")) {
         $response .= "<input type='button' id='btn_select_to_input_" . $destination_id . "' class='btn' name='' alt='back' onclick='changeToInput" . $destination_id . "(document.getElementById(\"" . $destination_id . "\"));this.style.visibility = \"hidden\";' value='&#9665;'>";
     }
     //return the formatted destinations
     return $response;
 }
Exemple #29
0
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
    if (isset($assigned_groups)) {
        echo "<br />\n";
    }
    echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
    echo "\t<option value=''></option>\n";
    foreach ($result as $field) {
        if ($field['group_name'] == "superadmin" && !if_group("superadmin")) {
            continue;
        }
        //only show the superadmin group to other superadmins
        if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin"))) {
            continue;
        }
        //only show the admin group to other admins
        if (!isset($assigned_groups) || isset($assigned_groups) && !in_array($field["group_uuid"], $assigned_groups)) {
            echo "\t<option value='" . $field['group_uuid'] . "|" . $field['group_name'] . "'>" . $field['group_name'] . ($field['domain_uuid'] != '' ? "@" . $_SESSION['domains'][$field['domain_uuid']]['domain_name'] : null) . "</option>\n";
        }
    }
    echo "</select>";
    echo "<input type='button' class='btn' value=\"" . $text['button-add'] . "\" onclick=\"document.getElementById('action').value = '" . $text['button-add'] . "'; submit_form();\">\n";
}
unset($sql, $prep_statement, $result);
echo "\t\t</td>";
echo "\t</tr>";
echo "</table>";
echo "<br>";
	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2015
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
include "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('group_delete') || if_group("superadmin")) {
    //access allowed
} else {
    echo "access denied";
    return;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//get the http value and set as a variable
$group_uuid = check_str($_GET["id"]);
//validate the uuid
if (is_uuid($group_uuid)) {
    //get the group from v_groups
    $sql = "select domain_uuid, group_name from v_groups ";
    $sql .= "where group_uuid = '" . $group_uuid . "' ";