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-2010 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ include "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; if (ifgroup("superadmin")) { //access granted } else { echo "access denied"; exit; } if (count($_POST) > 0) { $shellcmd = trim($_POST["shellcmd"]); $phpcmd = trim($_POST["phpcmd"]); $switchcmd = trim($_POST["switchcmd"]); } require_once "includes/header.php"; //--- Begin: Edit Area ----------------------------------------------------- echo " <script language=\"javascript\" type=\"text/javascript\" src=\"" . PROJECT_PATH . "/includes/edit_area/edit_area_full.js\"></script>\n"; echo " <!-- -->\n"; echo "\t<script language=\"Javascript\" type=\"text/javascript\">\n";
the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ include "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; if (ifgroup("admin") || ifgroup("superadmin")) { //access allowed } else { echo "access denied"; return; } //requires a superadmin to add a user to the superadmin group if (!ifgroup("superadmin") && $_GET["groupid"] == "superadmin") { echo "access denied"; return; } //HTTP GET set to a variable $groupid = check_str($_POST["groupid"]); $username = check_str($_POST["username"]); if (strlen($username) > 0 && strlen($groupid) > 0) { $sqlinsert = "insert into v_group_members "; $sqlinsert .= "("; $sqlinsert .= "v_id, "; $sqlinsert .= "groupid, "; $sqlinsert .= "username "; $sqlinsert .= ")"; $sqlinsert .= "values "; $sqlinsert .= "(";
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-2010 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ include "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; if (ifgroup("admin")) { //access granted } else { echo "access denied"; exit; } require_once "config.php"; require_once "header.php"; function isfile($filename) { if (@filesize($filename) > 0) { return true; } else { return false; } }
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-2010 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ require "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; if (ifgroup("admin") || ifgroup("tenant")) { //access granted } else { echo "access denied"; exit; } if (count($_GET) > 0) { $id = $_GET["id"]; } if (strlen($id) > 0) { $sql = ""; $sql .= "delete from v_call_broadcast "; $sql .= "where call_broadcast_id = '{$id}' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); unset($sql);
if (strlen($accountcode) > 0) { $sqlwhere .= "and accountcode like '%{$accountcode}%' "; } if (strlen($read_codec) > 0) { $sqlwhere .= "and read_codec like '%{$read_codec}%' "; } if (strlen($write_codec) > 0) { $sqlwhere .= "and write_codec like '%{$write_codec}%' "; } if (strlen($remote_media_ip) > 0) { $sqlwhere .= "and remote_media_ip like '%{$remote_media_ip}%' "; } if (strlen($network_addr) > 0) { $sqlwhere .= "and network_addr like '%{$network_addr}%' "; } if (!ifgroup("admin") || !ifgroup("superadmin")) { if (trim($sqlwhere) == "where") { $sqlwhere = ""; } //echo $sqlwhere; //disable member search //$sqlwhereorig = $sqlwhere; $sqlwhere = "where "; if (count($extension_array) > 0) { foreach ($extension_array as $value) { if ($value['extension'] > 0) { $sqlwhere .= "or caller_id_number = '" . $value['extension'] . "' " . $sqlwhereorig; } //source if ($value['extension'] > 0) { $sqlwhere .= "or destination_number = '" . $value['extension'] . "' " . $sqlwhereorig;
$strlist .= "</tr>\n"; //$strlist .= "<tr><td colspan='7'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>"; $count = 0; $result = $prepstatement->fetchAll(); foreach ($result as &$row) { $id = $row["id"]; $groupid = $row["groupid"]; $groupdesc = $row["groupdesc"]; if (strlen($groupid) == 0) { $groupid = " "; } if (strlen($groupdesc) == 0) { $groupdesc = " "; } $groupdesc = wordwrap($groupdesc, 50, "<br />\n"); if (!ifgroup("superadmin") && $groupid == "superadmin") { //hide the superadmin group from non superadmin's } else { $strlist .= "<tr>"; $strlist .= "<td class='" . $rowstyle[$c] . "' align=\"left\" class='' nowrap> {$groupid} </td>\n"; $strlist .= "<td class='" . $rowstyle[$c] . "' align=\"left\" class='' nowrap> {$groupdesc} </td>\n"; //if (ifpermission("add")) { $strlist .= "<td class='" . $rowstyle[$c] . "' align=\"center\" nowrap>\n"; $strlist .= " <a class='' href='groupmembers.php?groupid={$groupid}' title='Group Members'>Members</a> "; $strlist .= "</td>\n"; //$strlist .= "<td align=\"center\" nowrap>\n"; //$strlist .= " <a class='' href='grouppermissions.php?groupid=$groupid' title='Group Permissions'>P</a> "; //$strlist .= "</td>\n"; //} $strlist .= "<td align=\"right\" nowrap>\n"; //echo " <a href='v_gateways_edit.php?id=".$id."' alt='edit'><img src='".$v_icon_edit."' width='17' height='17' border='0' alt='edit'></a>\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-2010 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ include "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; require_once "config.php"; if (!ifgroup("admin")) { header("Location: /index.php"); return; } if (count($_POST) > 0) { $rsssubcategory = check_str($_POST["rsssubcategory"]); $rsstitle = check_str($_POST["rsstitle"]); $rsslink = check_str($_POST["rsslink"]); $rssdesc = check_str($_POST["rssdesc"]); $rssimg = check_str($_POST["rssimg"]); $rssoptional1 = check_str($_POST["rssoptional1"]); $rssoptional2 = check_str($_POST["rssoptional2"]); $rssoptional3 = check_str($_POST["rssoptional3"]); $rssoptional4 = check_str($_POST["rssoptional4"]); $rssoptional5 = check_str($_POST["rssoptional5"]); $rssgroup = check_str($_POST["rssgroup"]);
function builddbchildmenu($db, $menulevel, $menuid) { global $v_id; $menulevel = $menulevel + 1; //--- Begin check for children ----------------------------------------- $sql = "select * from v_menu "; $sql .= "where v_id = '{$v_id}' "; $sql .= "and menuparentid = '{$menuid}' "; $sql .= "order by menuorder asc "; //echo "sqlchild: ".$sql."<br>\n"; $prepstatement2 = $db->prepare($sql); $prepstatement2->execute(); $result2 = $prepstatement2->fetchAll(); //echo "resultcount: --".count($result2)."--<br><br>"; if (count($result2) > 0) { //echo "resultcount: --".count($result2)."--<br>"; //child menu found $dbmenusub .= "<ul>\n"; //$dbmenusub .= "<li><a href=\"#\" title=\"\" class='blank'><img src='/images/blank.gif' height='4' border='0'/></a></li>\n"; foreach ($result2 as $row) { $menuid = $row[menuid]; $menutitle = $row[menutitle]; $menustr = $row[menustr]; $menucategory = $row[menucategory]; $menugroup = $row[menugroup]; $menuparentid = $row[menuparentid]; $menuatags = ''; switch ($menucategory) { case "internal": $menutags = "href='" . PROJECT_PATH . "{$menustr}'"; break; case "external": $menustr = str_replace("<!--{project_path}-->", PROJECT_PATH, $menustr); $menutags = "href='{$menustr}' target='_blank'"; break; case "email": $menutags = "href='mailto:{$menustr}'"; break; } if (strlen($menugroup) == 0) { //public $dbmenusub .= "<li>"; $strchildmenu = builddbchildmenu($db, $menulevel, $menuid); //get sub menu for children if (strlen($strchildmenu) > 1) { //$dbmenusub .= "<table cellpadding='0' cellspacing='0' width='100%'><tr><td>"; $dbmenusub .= "<a {$menutags}>{$menutitle}</a>"; //$dbmenusub .= "</td><td align='right'><a $menutags> >> </a></td></tr></table>"; $dbmenusub .= $strchildmenu; unset($strchildmenu); } else { $dbmenusub .= "<a {$menutags}>{$menutitle}</a>"; } $dbmenusub .= "</li>\n"; } else { if (ifgroup($menugroup)) { //viewable only to designated group $dbmenusub .= "<li>"; $strchildmenu = builddbchildmenu($db, $menulevel, $menuid); //get sub menu for children if (strlen($strchildmenu) > 1) { //$dbmenusub .= "<table cellpadding='0' cellspacing='0' width='100%'><tr><td>"; $dbmenusub .= "<a {$menutags}>{$menutitle}</a>"; //$dbmenusub .= "</td><td align='right'><a $menutags> >> </a></td></tr></table>"; $dbmenusub .= $strchildmenu; unset($strchildmenu); } else { $dbmenusub .= "<a {$menutags}>{$menutitle}</a>"; } $dbmenusub .= "</li>\n"; } else { //not authorized do not add to menu } } //echo "menuid ".$menuid."<br>\n"; } unset($sql, $result2); $dbmenusub .= "</ul>\n"; //echo "--".$dbmenusub."--"; return $dbmenusub; } unset($prepstatement2, $sql); //--- End check for children ----------------------------------------- }
$sql .= "and rssdeldate is null "; $sql .= "order by rssorder asc "; //echo $sql; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); $resultcount = count($result); $customtitle = ''; foreach ($result as $row) { $template_rsssubcategory = $row[rsssubcategory]; if (strlen($row[rssgroup]) == 0) { //content is public $content_from_db =& $row[rssdesc]; $customtitle = $row[rsstitle]; } else { if (ifgroup($row[rssgroup])) { //viewable only to designated group $content_from_db =& $row[rssdesc]; $customtitle = $row[rsstitle]; } } } //end foreach unset($sql, $result, $rowcount); //get the template information $sql = ""; $sql .= "select * from v_templates "; if (strlen($template_rsssubcategory) > 0) { $sql .= "where v_id = '{$v_id}' "; $sql .= "and templatename = '{$template_rsssubcategory}' "; } else {
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-2010 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ include "root.php"; require "includes/config.php"; require_once "includes/checkauth.php"; if (ifgroup("admin") || ifgroup("superadmin") || ifgroup("member")) { //access granted } else { echo "access denied"; exit; } require_once "includes/header.php"; require_once "includes/paging.php"; $orderby = $_GET["orderby"]; $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\" cellpadding=\"6\" cellspacing=\"0\">\n";
{ global $inserted; //printf("<pre>%s</pre>\n", print_r($inserted, true)); $inserted[$table]++; $query = generate_insert_query($line, $places, $table, $db, $v_ids); //print "QUERY: $query<br>\n"; if (empty($query)) { return; } $affected_rows = $db->exec($query); //printf("we affected %s rows<br>\n", $affected_rows); } include "root.php"; require_once "includes/config.php"; require_once "includes/checkauth.php"; if (!ifgroup("admin") && !ifgroup("superadmin")) { printf("access denied"); exit; } require_once "includes/header.php"; require_once "includes/paging.php"; $inserted = array('v_users' => 0, 'v_extensions' => 0, 'v_group_members' => 0); if (is_array($_FILES) && array_key_exists('users_file', $_FILES)) { $v_ids = get_v_ids($db); $user_fields = get_db_field_names($db, 'v_users'); //printf("<pre>users => %s<br></pre>\n", print_r($user_fields, true)); $extension_fields = get_db_field_names($db, 'v_extensions'); //printf("<pre>exts => %s<br></pre>\n", print_r($extension_fields, true)); $all_fields = array_merge($user_fields, $extension_fields); //printf("<pre>all => %s</pre>\n", print_r($all_fields, true)); $fh = fopen($_FILES['users_file']['tmp_name'], 'r');
function switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action = '') { //$select_type = "ivr"; //$select_type='dialplan' global $config, $db, $v_id; $v_settings_array = v_settings(); foreach ($v_settings_array as $name => $value) { ${$name} = $value; } if (ifgroup("superadmin")) { echo "<script>\n"; echo "var Objs;\n"; echo "\n"; echo "function changeToInput(obj){\n"; echo "\ttb=document.createElement('INPUT');\n"; echo "\ttb.type='text';\n"; echo "\ttb.name=obj.name;\n"; echo "\ttb.setAttribute('class', 'formfld');\n"; echo "\ttb.setAttribute('style', '" . $select_style . "');\n"; echo "\ttb.value=obj.options[obj.selectedIndex].value;\n"; echo "\ttbb=document.createElement('INPUT');\n"; echo "\ttbb.setAttribute('class', 'btn');\n"; echo "\ttbb.type='button';\n"; echo "\ttbb.value='<';\n"; echo "\ttbb.objs=[obj,tb,tbb];\n"; echo "\ttbb.onclick=function(){ Replace(this.objs); }\n"; echo "\tobj.parentNode.insertBefore(tb,obj);\n"; echo "\tobj.parentNode.insertBefore(tbb,obj);\n"; echo "\tobj.parentNode.removeChild(obj);\n"; echo "}\n"; echo "\n"; echo "function Replace(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 "}\n"; echo "</script>\n"; echo "\n"; } //default selection found to false $selection_found = false; if (ifgroup("superadmin")) { echo "\t\t<select name='" . $select_name . "' class='formfld' style='" . $select_style . "' onchange='changeToInput(this);'>\n"; if (strlen($select_value) > 0) { echo "\t\t<option value='" . $action . ":" . $select_value . "' selected='selected'>" . $select_label . "</option>\n"; } } else { echo "\t\t<select name='select_value' class='formfld' style='" . $select_style . "'>\n"; } echo "\t\t<option></option>\n"; //list extensions $sql = ""; $sql .= "select * from v_extensions "; $sql .= "where v_id = '{$v_id}' "; $sql .= "and enabled = 'true' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='Extensions'>\n"; foreach ($result as &$row) { $extension = $row["extension"]; if ("transfer " . $extension . " XML default" == $select_value || "transfer:" . $extension . " XML default" == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default'>" . $extension . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement, $extension); //list conferences $sql = ""; $sql .= "select * from v_dialplan_includes_details "; $sql .= "where v_id = {$v_id} "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $x = 0; $result = $prepstatement->fetchAll(); echo "<optgroup label='Conferences'>\n"; $previous_conference_name = ""; foreach ($result as &$row) { //$tag = $row["tag"]; if ($row["fieldtype"] == "conference") { $conference_name = $row["fielddata"]; $conference_name = str_replace('_${domain_name}@default', '', $conference_name); if ($previous_conference_name != $conference_name) { if ("voicemail default \${domain} {$extension}" == $select_value || "voicemail:default \${domain} {$extension}" == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:conference " . $row["fielddata"] . "' selected='selected'>" . $conference_name . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='conference:" . $row["fielddata"] . "' selected='selected'>" . $conference_name . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:conference " . $row["fielddata"] . "'>" . $conference_name . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='conference:" . $row["fielddata"] . "'>" . $conference_name . "</option>\n"; } } $previous_conference_name = $conference_name; } $x++; } } echo "</optgroup>\n"; unset($prepstatement); //list fax extensions $sql = ""; $sql .= "select * from v_fax "; $sql .= "where v_id = '{$v_id}' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='FAX'>\n"; foreach ($result as &$row) { $extension = $row["faxextension"]; if ("transfer {$extension} XML default" == $select_value || "transfer:" . $extension . " XML default" == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default'>" . $extension . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement, $extension); //list fifo queues $sql = ""; $sql .= "select * from v_dialplan_includes_details "; $sql .= "where v_id = {$v_id} "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $x = 0; $result = $prepstatement->fetchAll(); echo "<optgroup label='FIFO'>\n"; foreach ($result as &$row) { //$tag = $row["tag"]; if ($row["fieldtype"] == "fifo") { if (strpos($row["fielddata"], '@${domain_name} in') !== false) { $dialplan_include_id = $row["dialplan_include_id"]; //get the extension number using the dialplan_include_id $sql = "select fielddata as extension_number "; $sql .= "from v_dialplan_includes_details "; $sql .= "where v_id = {$v_id} "; $sql .= "and dialplan_include_id = '{$dialplan_include_id}' "; $sql .= "and fieldtype = 'destination_number' "; $tmp = $db->query($sql)->fetch(); $extension_number = $tmp['extension_number']; $extension_number = ltrim($extension_number, "^"); $extension_number = ltrim($extension_number, "\\"); $extension_number = rtrim($extension_number, "\$"); unset($tmp); $fifo_name = $row["fielddata"]; $fifo_name = str_replace('@${domain_name} in', '', $fifo_name); $option_label = $extension_number; if ($select_type == "ivr") { if ("menu-exec-app:transfer " . $row["fielddata"] == $select_value) { echo "\t\t<option value='menu-exec-app:transfer " . $extension_number . "' selected='selected'>" . $option_label . "</option>\n"; $selection_found = true; } else { echo "\t\t<option value='menu-exec-app:transfer " . $extension_number . "'>" . $option_label . "</option>\n"; } } if ($select_type == "dialplan") { if ("transfer:" . $row["fielddata"] == $select_value) { echo "\t\t<option value='transfer:" . $extension_number . "' selected='selected'>" . $option_label . "</option>\n"; $selection_found = true; } else { echo "\t\t<option value='transfer:" . $extension_number . "'>" . $option_label . "</option>\n"; } } } } } echo "</optgroup>\n"; unset($prepstatement); //list hunt groups $sql = ""; $sql .= "select * from v_hunt_group "; $sql .= "where v_id = '{$v_id}' "; //$sql .= "and enabled = 'true' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='Hunt Groups'>\n"; foreach ($result as &$row) { //$v_id = $row["v_id"]; $extension = $row["huntgroupextension"]; if ("transfer {$extension} XML default" == $select_value || "transfer:" . $extension . " XML default" == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default'>" . $extension . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement, $extension); //list ivr menus $sql = ""; $sql .= "select * from v_ivr_menu "; $sql .= "where v_id = '{$v_id}' "; $sql .= "and ivr_menu_enabled = 'true' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='IVR Menu'>\n"; foreach ($result as &$row) { $extension = $row["ivr_menu_extension"]; if ("transfer {$extension} XML default" == $select_value || "transfer:" . $extension . " XML default" == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='transfer:{$extension} XML default' selected='selected'>" . $extension . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='menu-exec-app:transfer {$extension} XML default'>" . $extension . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement, $extension); //list ivr menus if ($select_type == "ivr") { //list sub ivr menu $sql = ""; $sql .= "select * from v_ivr_menu "; $sql .= "where v_id = '{$v_id}' "; $sql .= "and ivr_menu_enabled = 'true' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='IVR Sub'>\n"; foreach ($result as &$row) { $extension_name = $row["ivr_menu_name"]; $extension_name = str_replace(" ", "_", $extension_name); if ($extension_name == $select_value) { echo "\t\t<option value='menu-sub:{$extension_name}' selected='selected'>" . $extension_name . "</option>\n"; $selection_found = true; } else { echo "\t\t<option value='menu-sub:{$extension_name}'>" . $extension_name . "</option>\n"; } } echo "</optgroup>\n"; unset($prepstatement, $extension_name); //list ivr misc echo "<optgroup label='IVR Misc'>\n"; if ($ivr_menu_options_action == "menu-top") { echo "\t\t<option value='menu-top:' selected='selected'>Top</option>\n"; $selection_found = true; } else { echo "\t\t<option value='menu-top:'>Top</option>\n"; } if ($ivr_menu_options_action == "menu-exit") { echo "\t\t<option value='menu-exit:' selected='selected'>Exit</option>\n"; $selection_found = true; } else { echo "\t\t<option value='menu-exit:'>Exit</option>\n"; } if (strlen($select_value) > 0) { if (!$selection_found) { echo "\t\t<option value='{$select_value}' selected='selected'>" . $select_value . "</option>\n"; } } echo "</optgroup>\n"; } //list the languages echo "<optgroup label='Language'>\n"; //dutch if ("menu-exec-app:set default_language=nl" == $select_value || "set:default_language=nl" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=nl' selected='selected'>Dutch</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=nl' selected='selected'>Dutch</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=nl'>Dutch</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=nl'>Dutch</option>\n"; } } //english if ("menu-exec-app:set default_language=en" == $select_value || "set:default_language=en" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=en' selected='selected'>English</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=en' selected='selected'>English</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=en'>English</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=en'>English</option>\n"; } } //french if ("menu-exec-app:set default_language=fr" == $select_value || "set:default_language=fr" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=fr' selected='selected'>French</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=fr' selected='selected'>French</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=fr'>French</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=fr'>French</option>\n"; } } //italian if ("menu-exec-app:set default_language=it" == $select_value || "set:default_language=it" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=it' selected='selected'>Italian</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=it' selected='selected'>Italian</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=it'>Italian</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=it'>Italian</option>\n"; } } //german if ("menu-exec-app:set default_language=de" == $select_value || "set:default_language=de" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=de' selected='selected'>German</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=de' selected='selected'>German</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=de'>German</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=de'>German</option>\n"; } } //spanish if ("menu-exec-app:set default_language=es" == $select_value || "set:default_language=es" == $select_value) { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=es' selected='selected'>Spanish</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=es' selected='selected'>Spanish</option>\n"; } } else { if ($select_type == "ivr") { echo "\t<option value='menu-exec-app:set default_language=es'>Spanish</option>\n"; } if ($select_type == "dialplan") { echo "\t<option value='set:default_language=es'>Spanish</option>\n"; } } echo "</optgroup>\n"; //list time conditions $sql = ""; $sql .= "select * from v_dialplan_includes_details "; $sql .= "where v_id = {$v_id} "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $x = 0; $result = $prepstatement->fetchAll(); foreach ($result as &$row) { //$tag = $row["tag"]; switch ($row['fieldtype']) { case "hour": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "minute": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "minute-of-day": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "mday": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "mweek": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "mon": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "yday": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "year": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "wday": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; case "week": $time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; default: //$time_array[$row['dialplan_include_id']] = $row['fieldtype']; break; } } echo "<optgroup label='Time Conditions'>\n"; foreach ($time_array as $key => $val) { $dialplan_include_id = $key; //get the extension number using the dialplan_include_id $sql = "select fielddata as extension_number "; $sql .= "from v_dialplan_includes_details "; $sql .= "where v_id = {$v_id} "; $sql .= "and dialplan_include_id = '{$dialplan_include_id}' "; $sql .= "and fieldtype = 'destination_number' "; echo $sql . "<br />\n"; $tmp = $db->query($sql)->fetch(); $extension_number = $tmp['extension_number']; $extension_number = ltrim($extension_number, "^"); $extension_number = ltrim($extension_number, "\\"); $extension_number = rtrim($extension_number, "\$"); unset($tmp); $option_label = $extension_number; if ($select_type == "ivr") { if ("menu-exec-app:transfer " . $row["fielddata"] == $select_value) { echo "\t\t<option value='menu-exec-app:transfer " . $extension_number . "' selected='selected'>" . $option_label . "</option>\n"; $selection_found = true; } else { echo "\t\t<option value='menu-exec-app:transfer " . $extension_number . "'>" . $option_label . "</option>\n"; } } if ($select_type == "dialplan") { if ("transfer:" . $row["fielddata"] == $select_value) { echo "\t\t<option value='transfer:" . $extension_number . "' selected='selected'>" . $option_label . "</option>\n"; $selection_found = true; } else { echo "\t\t<option value='transfer:" . $extension_number . "'>" . $option_label . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement); //list voicemail $sql = ""; $sql .= "select * from v_extensions "; $sql .= "where v_id = '{$v_id}' "; $sql .= "and enabled = 'true' "; $prepstatement = $db->prepare(check_sql($sql)); $prepstatement->execute(); $result = $prepstatement->fetchAll(); echo "<optgroup label='Voicemail'>\n"; foreach ($result as &$row) { $extension = $row["extension"]; //default ${domain_name} if ("voicemail default \${domain} " . $extension == $select_value || "voicemail:default \${domain} " . $extension == $select_value) { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:voicemail default \${domain} {$extension}' selected='selected'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='voicemail:default \${domain} {$extension}' selected='selected'>" . $extension . "</option>\n"; } $selection_found = true; } else { if ($select_type == "ivr") { echo "\t\t<option value='menu-exec-app:voicemail default \${domain} {$extension}'>" . $extension . "</option>\n"; } if ($select_type == "dialplan") { echo "\t\t<option value='voicemail:default \${domain} {$extension}'>" . $extension . "</option>\n"; } } } echo "</optgroup>\n"; unset($prepstatement, $extension); echo "\t\t</select>\n"; }