function ConferenceSetup() { global $mysqli; $session =& $_SESSION['ConferenceSetup']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init form data (Extension) if (@$_REQUEST['submit'] == 'save') { $Conference = formdata_from_post(); $Errors = formdata_validate($Conference); if (count($Errors) == 0) { formdata_save($Conference); asterisk_UpdateConf('confbridge.conf'); asterisk_Reload(); header("Location: ConferenceSetup.php?msg=MODIFY_CONFERENCE"); die; } } else { $Conference = formdata_from_db($_SESSION['_USER']['PK_Extension']); } // Init Available Accounts (Accounts) $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension,\n\t\t\tExtension,\n Name\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tExtensions.Type IN ('Virtual', 'SipPhone')\n\t\tORDER BY Extension\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Accounts = array(); while ($row = $result->fetch_assoc()) { $Accounts[] = $row; } $smarty->assign('Conference', $Conference); $smarty->assign('Accounts', $Accounts); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); return $smarty->fetch('ConferenceSetup.tpl'); }
function NetworkSettings() { $session =& $_SESSION['NetworkSettings']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (!empty($_REQUEST['submit'])) { $Settings = formdata_from_post(); $Errors = formdata_validate($Settings, $variables); if (count($Errors) == 0) { $Message = 'SAVED_NETWORK_SETTINGS'; formdata_save($Settings); set_network_interfaces($Settings); asterisk_UpdateConf('sip.conf'); //asterisk_Reload(); } $OldSettings = array_merge(formdata_from_db(), get_network_interfaces()); foreach ($OldSettings as $variable => $value) { if (!isset($Settings[$variable])) { $Settings[$variable] = $value; } } } else { $Settings = formdata_from_db(); } $Interface = get_network_interfaces(); $smarty->assign('Errors', $Errors); $smarty->assign('Message', $Message); $smarty->assign('Settings', array_merge($Settings, $Interface)); return $smarty->fetch('NetworkSettings.tpl'); }
function Extensions_DialTone_Modify() { global $mysqli; $session =& $_SESSION['Extensions_SimpleConf_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $Extension = formdata_from_post(); $Errors = formdata_validate($Extension); if (count($Errors) == 0) { if ($Extension['PK_Extension'] != '') { $msg = 'MODIFY_DIALTONE_EXTENSION'; } else { $msg = 'ADD_DIALTONE_EXTENSION'; } $id = formdata_save($Extension); header("Location: Extensions_List.php?hilight={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $Extension = formdata_from_db($_REQUEST['PK_Extension']); } else { $Extension = formdata_from_default(); } $smarty->assign('Extension', $Extension); $smarty->assign('Errors', $Errors); return $smarty->fetch('Extensions_DialTone_Modify.tpl'); }
function SystemClockSettings() { $session =& $_SESSION['SystemClockSettings']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (!empty($_REQUEST['submit'])) { $Settings = formdata_from_post(); $Settings['Current_TimeZone'] = $Settings['TimeZones'][0]; $Settings['DisableNTP'] = $Settings['DisableNTPLast']; $Errors = formdata_validate($Settings, $variables); if (count($Errors) == 0) { $Message = 'SAVED_SYSTEMCLOCK_SETTINGS'; formdata_save($Settings); } $OldSettings = formdata_from_db(); foreach ($OldSettings as $variable => $value) { if (!isset($Settings[$variable])) { $Settings[$variable] = $value; } } } else { $Settings = formdata_from_db(); } $TimeZones = get_timezone_list(); $smarty->assign('Errors', $Errors); $smarty->assign('Message', $Message); $smarty->assign('Settings', $Settings); $smarty->assign('TimeZones', $TimeZones); $smarty->assign('CurrentTime', date("F j, Y, g:i a")); return $smarty->fetch('SystemClockSettings.tpl'); }
function Extensions_Queue_Modify() { global $mysqli; $session =& $_SESSION['Extensions_Queue_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init Available ringing strategies (RingStrategies) $query = "SELECT PK_RingStrategy, Name, Description FROM RingStrategies"; $result = $mysqli->query($query) or die($mysqli->error . $query); $RingStrategies = array(); while ($row = $result->fetch_assoc()) { $RingStrategies[] = $row; } // Init Available Members (Members) $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension,\n\t\t\tExtension,\n Name\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tExtensions.Type IN ('Virtual', 'SipPhone')\n\t\tORDER BY Extension\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Members = array(); while ($row = $result->fetch_assoc()) { $Members[] = $row; } // Init available Sounds (SoundsFiles) $query = "\n\t\tSELECT\n\t\t\tPK_SoundFile,\n\t\t\tSoundFiles.Name,\n\t\t\tSoundFiles.Description,\n\t\t\tSoundLanguages.Name AS Language\n\t\tFROM\n\t\t\tSoundFiles\n\t\t\tINNER JOIN SoundEntries ON FK_SoundEntry = PK_SoundEntry\n\t\t\tINNER JOIN SoundFolders ON FK_SoundFolder = PK_SoundFolder\n\t\t\tINNER JOIN SoundLanguages ON FK_SoundLanguage = PK_SoundLanguage\n\t\tWHERE\n\t\t\tSoundFolders.Name = 'Call Queues'\n\t\tORDER BY\n\t\t\tSoundLanguages.Name ASC,\n\t\t\tSoundFiles.Name ASC\n\t"; $result = $mysqli->query($query) or die($mysqli->error); $SoundFiles = array(); while ($row = $result->fetch_assoc()) { $SoundFiles[$row['Language']][$row['PK_SoundFile']] = $row['Name']; } // Init available moh groups $query = "SELECT * FROM Moh_Groups ORDER BY Name ASC"; $result = $mysqli->query($query) or die($mysqli->error); $MohGroups = array(); while ($row = $result->fetch_assoc()) { $MohGroups[] = $row; } // Init form data (Queue) if (@$_REQUEST['submit'] == 'save') { $Queue = formdata_from_post(); $Errors = formdata_validate($Queue); if (count($Errors) == 0) { $id = formdata_save($Queue); asterisk_UpdateConf('queues.conf'); asterisk_Reload(); header("Location: Extensions_List.php?msg=MODIFY_QUEUE_EXTENSION&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $Queue = formdata_from_db($_REQUEST['PK_Extension']); } else { $Queue = array('MemberRingTime' => '16', 'NextWaitTime' => '5', 'WrapUpTime' => '30', 'PlayMohInQueue' => '1', 'AnnounceFrequency' => '90', 'FK_Sound_PickupAnnouncement' => '4552', 'FK_Sound_YouAreNext' => '4401', 'FK_Sound_ThereAre' => '4249', 'FK_Sound_CallsWaiting' => '4394', 'FK_Sound_HoldTime' => '4351', 'FK_Sound_Minutes' => '4361', 'FK_Sound_ThankYou' => '4243'); } $smarty->assign('Queue', $Queue); $smarty->assign('RingStrategies', $RingStrategies); $smarty->assign('SoundFiles', $SoundFiles); $smarty->assign('MohGroups', $MohGroups); $smarty->assign('Members', $Members); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); return $smarty->fetch('Extensions_Queue_Modify.tpl'); }
function Extensions_Action_Modify() { global $mysqli; $session =& $_SESSION['IVR_Action_Modify_record_digits']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Action = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { $id = formdata_save($Action); header("Location: IVR_Actions.php?PK_Menu={$Action['FK_Menu']}&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Action'] != "") { $Action = formdata_from_db($_REQUEST['PK_Action']); } else { $Action = formdata_from_default(); } // Get available vars $query = "SELECT DISTINCT(Variable) FROM IVR_Action_Params"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_row()) { if (!empty($row[0])) { $Variables[] = $row[0]; } } $smarty->assign('Action', $Action); $smarty->assign('Variables', $Variables); return $smarty->fetch('IVR_Actions_Modify.record_digits.tpl'); }
function Groups_Popup_Create() { global $mysqli; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init form data (Group, Errors) if (@$_REQUEST['submit'] == 'save') { $Group = formdata_from_post(); $Errors = formdata_validate($Group); if (count($Errors) == 0) { $id = formdata_save($Group); return ' <script type="text/javascript" src="../script/jquery.selectboxes.js"></script> <script> $("#Groups", opener.document).addOption("' . $id . '", "' . $Group['Name'] . '"); window.close(); </script> '; } } else { if ($_REQUEST['PK_Group'] != "") { $Group = formdata_from_db($_REQUEST['PK_Group']); } } // Init Availabe Extensions $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension AS PK_Extension,\n\t\t\tExtension,\n\t\t\tName\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tType IN ('Virtual','SipPhone')\n\t\tORDER BY\n\t\t\tExtension ASC\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Extensions = array(); while ($row = $result->fetch_assoc()) { $Extensions[] = $row; } $smarty->assign('Errors', $Errors); $smarty->assign('Group', $Group); $smarty->assign('Extensions', $Extensions); return $smarty->fetch('Groups_Popup_Create.tpl'); }
function Groups_Modify() { global $mysqli; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init form data (Group, Errors) if (@$_REQUEST['submit'] == 'save') { $Group = formdata_from_post(); $Errors = formdata_validate($Group); if (count($Errors) == 0) { $id = formdata_save($Group); header("Location: Groups_List.php?msg=MODIFY_GROUP&hilight={$id}"); die; } } else { if ($_REQUEST['PK_Group'] != "") { $Group = formdata_from_db($_REQUEST['PK_Group']); } } // Init Availabe Extensions $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension AS PK_Extension,\n\t\t\tExtension,\n Name\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tType IN ('Virtual','SipPhone')\n\t\tORDER BY\n\t\t\tExtension ASC\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Extensions = array(); while ($row = $result->fetch_assoc()) { $Extensions[] = $row; } $smarty->assign('Errors', $Errors); $smarty->assign('Group', $Group); $smarty->assign('Extensions', $Extensions); return $smarty->fetch('Groups_Modify.tpl'); }
function IVR_Menus_Modify() { global $mysqli; $session =& $_SESSION['IVR_Menus_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Menu = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { if ($Menu['PK_Menu'] != '') { $msg = 'MODIFY_MENU'; } else { $msg = 'ADD_MENU'; } $id = formdata_save($Menu); header("Location: IVR_Menus.php?PK_Menu={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Menu'] != "") { $Menu = formdata_from_db($_REQUEST['PK_Menu']); } else { $Menu = formdata_from_default(); } $smarty->assign('Menu', $Menu); $smarty->assign('Errors', $Errors); return $smarty->fetch('IVR_Menus_Modify.tpl'); }
function MOH_Groups_Modify() { global $mysqli; $session =& $_SESSION['MOH_Groups_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $Group = formdata_from_post(); $Errors = formdata_validate($Group); if (count($Errors) == 0) { if ($Group['PK_Group'] != '') { $msg = 'MODIFY_MOH_GROUP'; } else { $msg = 'ADD_MOH_GROUP'; } $id = formdata_save($Group); asterisk_UpdateConf('musiconhold.conf'); asterisk_Reload(); header("Location: MOH_Groups_List.php?hilight={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Group'] != "") { $Group = formdata_from_db($_REQUEST['PK_Group']); } else { $Group = formdata_from_default(); } $smarty->assign('Group', $Group); $smarty->assign('Errors', $Errors); return $smarty->fetch('MOH_Groups_Modify.tpl'); }
function Account_Modify() { $session =& $_SESSION['Account_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init form data (Extension) if (@$_REQUEST['submit'] == 'save') { $Extension = formdata_from_post(); $Errors = formdata_validate($Extension); if (count($Errors) == 0) { $id = formdata_save($Extension); asterisk_UpdateConf('sip.conf'); asterisk_UpdateConf('voicemail.conf'); asterisk_Reload(); header("Location: Account_Modify.php?msg=MODIFY_EXTENSION&hilight={$id}"); die; } } else { $Extension = formdata_from_db($_SESSION['_USER']['PK_Extension']); } $smarty->assign('Extension', $Extension); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); return $smarty->fetch('Account_Modify.tpl'); }
function SoundLanguages_Modify() { $session =& $_SESSION['Templates_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $SoundLanguage = formdata_from_post(); $Errors = formdata_validate($Rule); if (count($Errors) == 0) { if ($SoundLanguage['PK_SoundLanguage'] == '') { $id = formdata_save($SoundLanguage); header("Location: SoundLanguages_List.php?msg=CREATE_LANGUAGE&hilight={$id}"); die; } else { $id = formdata_save($SoundLanguage); header("Location: SoundLanguages_List.php?msg=MODIFY_LANGUAGE&hilight={$id}"); die; } } } elseif ($_REQUEST['PK_SoundLanguage'] != "") { $SoundLanguage = formdata_from_db($_REQUEST['PK_SoundLanguage']); } $smarty->assign('SoundLanguage', $SoundLanguage); $smarty->assign('Message', $Message); return $smarty->fetch('SoundLanguages_Modify.tpl'); }
function IVR_Options_Modify() { global $mysqli; $session =& $_SESSION['IVR_Options_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Option = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { if ($Option['PK_Option'] != '') { $msg = 'MODIFY_OPTION'; } else { $msg = 'ADD_OPTION'; } $id = formdata_save($Option); header("Location: IVR_Options_List.php?PK_Menu={$Option['FK_Menu']}&hilight={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Option'] != "") { $Option = formdata_from_db($_REQUEST['PK_Option']); } else { $Option = formdata_from_default(); } // Get available menus $Menus = array(); $query = "SELECT PK_Menu, Name FROM IVR_Menus ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $menu = $row; $query2 = "SELECT * FROM IVR_Actions WHERE FK_Menu = '{$menu['PK_Menu']}' ORDER BY `Order`"; $result2 = $mysqli->query($query2) or die($mysqli->error . $query2); while ($row2 = $result2->fetch_assoc()) { $action = $row2; $query3 = "SELECT * FROM IVR_Action_Params WHERE FK_Action = {$action['PK_Action']}"; $result3 = $mysqli->query($query3) or die($mysqli->error . $query3); while ($row3 = $result3->fetch_assoc()) { $action['Param'][$row3['Name']] = $row3['Value']; $action['Var'][$row3['Name']] = $row3['Variable']; } $menu['Actions'][] = $action; } $Menus[] = $menu; } // Get used keys $UsedKeys = array(); $query = "SELECT `Key` FROM IVR_Options WHERE PK_Option != '{$Option['PK_Option']}' AND FK_Menu={$Option['FK_Menu']}"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $UsedKeys[] = $row['Key']; } $smarty->assign('Menus', $Menus); $smarty->assign('Option', $Option); $smarty->assign('UsedKeys', $UsedKeys); return $smarty->fetch('IVR_Options_Modify.tpl'); }
function SoundFiles_Modify() { global $mysqli; $session =& $_SESSION['SoundFiles_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $SoundFile = formdata_from_post(); $Errors = formdata_validate($SoundFile); if (count($Errors) == 0) { $id = formdata_save($SoundFile); header("Location: SoundEntries_List.php?msg=MODIFY_ENTRY&hilight={$SoundFile['FK_SoundEntry']}"); die; } } elseif ($_REQUEST['PK_SoundFile'] != "") { $SoundFile = formdata_from_db($_REQUEST['PK_SoundFile']); } $query = "SELECT PK_SoundFolder, Name FROM SoundFolders ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $SoundFolders[] = $row; } $query = "SELECT PK_SoundLanguage, Name FROM SoundLanguages ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $SoundLanguages[] = $row; } if ($_REQUEST['PK_SoundEntry'] != "") { $PK_SoundEntry = $_REQUEST['PK_SoundEntry']; } elseif ($SoundFile['PK_SoundFile'] != "") { $PK_SoundEntry = $SoundFile['FK_SoundEntry']; } if ($_REQUEST['PK_SoundLanguage'] != "") { $PK_SoundLanguage = $_REQUEST['PK_SoundLanguage']; } elseif ($SoundFile['PK_SoundFile'] != "") { $PK_SoundLanguage = $SoundFile['FK_SoundLanguage']; } if ($PK_SoundEntry != "") { $query = "SELECT FK_SoundFolder FROM SoundEntries WHERE PK_SoundEntry = {$PK_SoundEntry} LIMIT 1"; $result = $mysqli->query($query) or die($mysqli->error . $query); $row = $result->fetch_array(); $PK_SoundFolder = $row[0]; } $smarty->assign('SoundFile', $SoundFile); $smarty->assign('SoundFolders', $SoundFolders); $smarty->assign('SoundLanguages', $SoundLanguages); $smarty->assign('PK_SoundEntry', $PK_SoundEntry); $smarty->assign('PK_SoundLanguage', $PK_SoundLanguage); $smarty->assign('PK_SoundFolder', $PK_SoundFolder); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); return $smarty->fetch('SoundFiles_Modify.tpl'); }
function VoipProviders_Modify() { global $mysqli; $session =& $_SESSION['VoipProviders_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // myprint($_REQUEST); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init Available DTMF Modes (DTMFModes) $query = "SELECT PK_DTMFMode, Name, Description FROM DTMFModes"; $result = $mysqli->query($query) or die($mysqli->errno()); $DTMFModes = array(); while ($row = $result->fetch_assoc()) { $DTMFModes[] = $row; } // Init available codecs (Codecs) $query = "SELECT PK_Codec, Name, Description, Recomended FROM Codecs"; $result = $mysqli->query($query) or die($mysqli->error); $Codecs = array(); while ($row = $result->fetch_assoc()) { $Codecs[] = $row; } // Init available outgoing rules (Rules) $query = "SELECT * FROM OutgoingRules ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->errno()); $Rules = array(); while ($row = $result->fetch_assoc()) { $Rules[] = $row; } // Init form data (Providers) if ($_REQUEST['submit'] == 'save') { $Provider = formdata_from_post(); $Errors = formdata_validate($Provider); if (count($Errors) == 0) { $id = formdata_save($Provider); asterisk_UpdateConf('sip.conf'); asterisk_UpdateConf('extensions.conf'); asterisk_Reload(); header("Location: VoipProviders_List.php?msg=MODIFY_SIP_PROVIDER&hilight={$id}"); die; } } elseif ($_REQUEST['PK_SipProvider'] != "") { $Provider = formdata_from_db($_REQUEST['PK_SipProvider']); } else { $Provider = formdata_from_default(); } $smarty->assign('Provider', $Provider); $smarty->assign('DTMFModes', $DTMFModes); $smarty->assign('Codecs', $Codecs); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); $smarty->assign('Rules', $Rules); return $smarty->fetch('VoipProviders_Modify.tpl'); }
function Recordings_ModifyRule() { global $mysqli; $session =& $_SESSION['Recordings_ModifyRule']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $Rule = formdata_from_post(); $Errors = formdata_validate($Rule); if (count($Errors) == 0) { if ($Rule['PK_Rule'] != '') { $msg = 'MODIFY_REC_RULE'; } else { $msg = 'ADD_REC_RULE'; } $id = formdata_save($Rule); header("Location: Recordings_List.php?hilight={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Rule'] != "") { $Rule = formdata_from_db($_REQUEST['PK_Rule']); } else { $Rule = formdata_from_default(); } // Geting a list of phone extension (Phones) $Phones = array(); $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension AS PK_Extension,\n\t\t\tExtension,\n\t\t\tName\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tType IN ('Virtual','SipPhone')\n\t\tORDER BY\n\t\t\tExtension ASC\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $Phones[] = $row; } // Geting a list of extension groups (Groups) $Groups = array(); $query = "SELECT * FROM Groups ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $Groups[] = $row; } // Geting a list of queues (Queues) $Queues = array(); $query = "SELECT * FROM Ext_Queues INNER JOIN Extensions ON Ext_Queues.PK_Extension = Extensions.PK_Extension ORDER BY Extension ASC"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $Queues[] = $row; } $smarty->assign('Groups', $Groups); $smarty->assign('Queues', $Queues); $smarty->assign('Phones', $Phones); $smarty->assign('Rule', $Rule); $smarty->assign('Errors', $Errors); return $smarty->fetch('Recordings_ModifyRule.tpl'); }
function Extensions_Agent_Modify() { global $mysqli; $session =& $_SESSION['Extensions_Agent_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init available extension groups (Groups) $query = "SELECT PK_Group, Name FROM Groups"; $result = $mysqli->query($query) or die($mysqli->errno()); $Groups = array(); while ($row = $result->fetch_assoc()) { $Groups[] = $row; } // Init available outgoing rules (Rules) $query = "SELECT * FROM OutgoingRules ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->errno()); $Rules = array(); while ($row = $result->fetch_assoc()) { $Rules[] = $row; } // Init available extension groups (Features) $query = "SELECT PK_Feature, Name FROM Features"; $result = $mysqli->query($query) or die($mysqli->errno()); $Features = array(); while ($row = $result->fetch_assoc()) { $Features[] = $row; } // Init form data (Extension) if (@$_REQUEST['submit'] == 'save') { $Extension = formdata_from_post(); $Errors = formdata_validate($Extension); if (count($Errors) == 0) { $id = formdata_save($Extension); asterisk_UpdateConf('sip.conf'); asterisk_UpdateConf('voicemail.conf'); asterisk_Reload(); header("Location: Extensions_List.php?msg=MODIFY_AGENT_EXTENSION&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $Extension = formdata_from_db($_REQUEST['PK_Extension']); } else { $Extension = formdata_from_template($_REQUEST['FK_Template']); } $smarty->assign('Extension', $Extension); $smarty->assign('Features', $Features); $smarty->assign('Groups', $Groups); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); $smarty->assign('Rules', $Rules); return $smarty->fetch('Extensions_Agent_Modify.tpl'); }
function Dongles_Modify() { global $mysqli; $session =& $_SESSION['Dongles_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // myprint($_REQUEST); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init available outgoing rules (Rules) $query = "SELECT * FROM OutgoingRules ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->errno()); $Rules = array(); while ($row = $result->fetch_assoc()) { $Rules[] = $row; } $discovery_response = explode("\n", asterisk_Cmd('dongle discovery')); $discovered_dongles = array(); $discovered_i = -1; for ($i = 0; $i < sizeof($discovery_response); $i++) { if (substr($discovery_response[$i], 0, 1) == "[") { $discovered_i++; $discovered_dongles[$discovered_i] = array(); } elseif (substr($discovery_response[$i], 0, 4) == "imsi") { $discovered_dongles[$discovered_i]["IMSI"] = substr($discovery_response[$i], 5); } elseif (substr($discovery_response[$i], 0, 4) == "imei") { $discovered_dongles[$discovered_i]["IMEI"] = substr($discovery_response[$i], 5); } } // Init form data (Providers) if ($_REQUEST['submit'] == 'save') { $Dongle = formdata_from_post(); $Errors = formdata_validate($Dongle); if (count($Errors) == 0) { $id = formdata_save($Dongle); asterisk_UpdateConf('dongle.conf'); asterisk_UpdateConf('extensions.conf'); asterisk_Reload(); header("Location: Dongles_List.php?msg=MODIFY_DONGLE&hilight={$id}"); die; } } elseif ($_REQUEST['PK_Dongle'] != "") { $Dongle = formdata_from_db($_REQUEST['PK_Dongle']); } else { $Dongle = formdata_from_default(); } $smarty->assign('Dongle', $Dongle); $smarty->assign('DiscoveredDongles', $discovered_dongles); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); $smarty->assign('Rules', $Rules); return $smarty->fetch('Dongles_Modify.tpl'); }
function Extensions_Action_Modify() { global $mysqli; $session =& $_SESSION['IVR_Action_Modify_conditional_clause']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Action = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { $id = formdata_save($Action); header("Location: IVR_Actions.php?PK_Menu={$Action['FK_Menu']}&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Action'] != "") { $Action = formdata_from_db($_REQUEST['PK_Action']); } else { $Action = formdata_from_default(); } // Get available vars $Variables = array(); $query = "SELECT DISTINCT(Variable) FROM IVR_Action_Params"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_row()) { if (!empty($row[0])) { $Variables[] = $row[0]; } } // Get available menus $Menus = array(); $query = "SELECT PK_Menu, Name FROM IVR_Menus ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $menu = $row; $query2 = "SELECT * FROM IVR_Actions WHERE FK_Menu = '{$menu['PK_Menu']}' ORDER BY `Order`"; $result2 = $mysqli->query($query2) or die($mysqli->error . $query2); while ($row2 = $result2->fetch_assoc()) { $action = $row2; $query3 = "SELECT * FROM IVR_Action_Params WHERE FK_Action = {$action['PK_Action']}"; $result3 = $mysqli->query($query3) or die($mysqli->error . $query3); while ($row3 = $result3->fetch_assoc()) { $action['Param'][$row3['Name']] = $row3['Value']; $action['Var'][$row3['Name']] = $row3['Variable']; } $menu['Actions'][] = $action; } $Menus[] = $menu; } $smarty->assign('Menus', $Menus); $smarty->assign('Action', $Action); $smarty->assign('Variables', $Variables); return $smarty->fetch('IVR_Actions_Modify.conditional_clause.tpl'); }
function OutgoingCalls_Rule_Modify() { global $mysqli; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init form data (Rule, Errors) if (@$_REQUEST['submit'] == 'save') { $Rule = formdata_from_post(); $Errors = formdata_validate($Rule); if (count($Errors) == 0) { $id = formdata_save($Rule); asterisk_UpdateConf('extensions.conf'); asterisk_Reload(); if ($Rule['PK_OutgoingRule'] == '') { header("Location: OutgoingCalls.php?msg=CREATE_RULE&hilight={$id}"); die; } else { header("Location: OutgoingCalls.php?msg=MODIFY_RULE&hilight={$id}"); die; } } } else { if ($_REQUEST['PK_OutgoingRule'] != "") { $Rule = formdata_from_db($_REQUEST['PK_OutgoingRule']); } else { $Rule['Allow'] = '1'; $Rule['Final'] = '1'; } } // SipProviders $SipProviders = array(); $query = "SELECT * FROM SipProviders ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $SipProviders[] = $row; } // IaxProviders $Dongles = array(); $query = "SELECT * FROM Dongles ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $Dongles[] = $row; } $smarty->assign('SipProviders', $SipProviders); $smarty->assign('Dongles', $Dongles); $smarty->assign('Rule', $Rule); $smarty->assign('Errors', $Errors); return $smarty->fetch('OutgoingCalls_Rule_Modify.tpl'); }
function AgentSettings() { $session =& $_SESSION['AgentSettings']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (@$_REQUEST['submit'] == 'save') { $Settings = formdata_from_post(); $Errors = formdata_validate($Settings); if (count($Errors) == 0) { formdata_save($Settings); } } else { $Settings = formdata_from_db(); } $smarty->assign('Errors', $Errors); $smarty->assign('Settings', $Settings); return $smarty->fetch('AgentSettings.tpl'); }
function Extensions_GroupPickup_Modify() { global $mysqli; $session =& $_SESSION['Extensions_GroupPickup_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); /////myprint($_REQUEST); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Groups $query = "SELECT PK_Group, Name FROM Groups"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Groups = array(); while ($row = $result->fetch_assoc()) { $Groups[] = $row; } // Init Available Accounts (Accounts) $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension,\n\t\t\tExtension,\n\t\t\tName\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tExtensions.Type IN ('Virtual', 'SipPhone')\n\t\tORDER BY Extension\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Accounts = array(); while ($row = $result->fetch_assoc()) { $Accounts[] = $row; } // Init form data (GroupPickup) if (@$_REQUEST['submit'] == 'save') { $GroupPickup = formdata_from_post(); $Errors = formdata_validate($GroupPickup); if (count($Errors) == 0) { $id = formdata_save($GroupPickup); header("Location: Extensions_List.php?msg=MODIFY_GroupPickup_EXTENSION&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $GroupPickup = formdata_from_db($_REQUEST['PK_Extension']); } else { $GroupPickup = array(); } $smarty->assign('GroupPickup', $GroupPickup); $smarty->assign('Groups', $Groups); $smarty->assign('Accounts', $Accounts); $smarty->assign('Message', $Message); $smarty->assign('Errors', $Errors); return $smarty->fetch('Extensions_GroupPickup_Modify.tpl'); }
function Backup_Setup() { $session =& $_SESSION['Backup_Setup']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if ($_REQUEST['submit']) { $Settings = formdata_from_post(); $Errors = formdata_validate($Settings); if (count($Errors) == 0) { formdata_save($Settings); header("Location: Backup.php?msg=BACKUP_SETTINGS_SAVED"); die; } } $Settings = formdata_from_db(); $smarty->assign('Message', $Message); $smarty->assign('Settings', $Settings); $smarty->assign('Errors', $Errors); return $smarty->fetch('Backup_Setup.tpl'); }
function Extensions_Action_Modify() { $session =& $_SESSION['IVR_Action_Modify_wait']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Action = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { $id = formdata_save($Action); header("Location: IVR_Actions.php?PK_Menu={$Action['FK_Menu']}&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Action'] != "") { $Action = formdata_from_db($_REQUEST['PK_Action']); } else { $Action = formdata_from_default(); } $smarty->assign('Action', $Action); return $smarty->fetch('IVR_Actions_Modify.wait.tpl'); }
function Extensions_AgentLogin_Modify() { $session =& $_SESSION['Extensions_AgentLogin_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init form data (AgentLogin) if (@$_REQUEST['submit'] == 'save') { $AgentLogin = formdata_from_post(); $Errors = formdata_validate($AgentLogin); if (count($Errors) == 0) { $id = formdata_save($AgentLogin); header("Location: Extensions_List.php?msg=MODIFY_AGENTLOGIN_EXTENSION&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $AgentLogin = formdata_from_db($_REQUEST['PK_Extension']); } else { } $smarty->assign('AgentLogin', $AgentLogin); $smarty->assign('Errors', $Errors); return $smarty->fetch('Extensions_AgentLogin_Modify.tpl'); }
function IVR_Options_List() { global $mysqli; $session =& $_SESSION['IVR_Options_List']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $PK_Menu = $_REQUEST['PK_Menu']; $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; if (!empty($_REQUEST['submit'])) { $IVR_Menu = formdata_from_post(); $Errors = formdata_validate($IVR_Menu); if (count($Errors) == 0) { $id = formdata_save($IVR_Menu); } } else { $IVR_Menu = formdata_from_db($_REQUEST['PK_Menu']); } // Init available options $IVR_Options = array(); $query = "\n\t\tSELECT\n\t\t\tPK_Option AS `PK_Option`,\n\t\t\t`Key` AS `Key`,\n\t\t\tIVR_Menus.Name AS `Menu`,\n\t\t\tIVR_Actions.Type AS `Action_Type`,\n\t\t\tIVR_Actions.Order AS `Action_Order`\n\t\tFROM\n\t\t\tIVR_Options\n\t\t\tLEFT JOIN IVR_Menus ON FK_Menu_Entry = PK_Menu\n\t\t\tLEFT JOIN IVR_Actions ON FK_Action_Entry = PK_Action\n\t\tWHERE\n\t\t\tIVR_Options.FK_Menu = {$PK_Menu}\n\t\tORDER BY\n\t\t\t`Key`\n\t"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $IVR_Options[] = $row; } // Init Folders (SoundFolders) $SoundFolders = array(); $query = "\n\t\tSELECT\n\t\t\tPK_SoundFolder,\n\t\t\tName\n\t\tFROM\n\t\t\tSoundFolders\n\t\tORDER BY Name\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundFolders[] = $row; } // Init SoundLanguages $SoundLanguages = array(); $query = "\n\t\tSELECT\n\t\t\tPK_SoundLanguage,\n\t\t\t`Default`,\n\t\t\tName\n\t\tFROM\n\t\t\tSoundLanguages\n\t\tORDER BY Name\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundLanguages[] = $row; if ($row['Default']) { $SoundLanguage_Default = $row; } } // Init SoundEntries $SoundEntries = array(); $query_select = ""; $query_from = ""; foreach ($SoundLanguages as $SoundLanguage) { $lid = $SoundLanguage['PK_SoundLanguage']; $query_select .= "\n\t\t\tSoundFiles_{$lid}.Name AS Name_{$lid} ,\n\t\t\tSoundFiles_{$lid}.Description AS Description_{$lid},\n\t\t"; $query_from .= "\n\t\t\tLEFT JOIN SoundFiles SoundFiles_{$lid} ON SoundFiles_{$lid}.FK_SoundEntry = PK_SoundEntry AND SoundFiles_{$lid}.FK_SoundLanguage = {$lid}\n\t\t"; } $query = "\n\t\tSELECT\n\t\t\t{$query_select}\n\t\t\tPK_SoundEntry,\n\t\t\tFK_SoundFolder\n\t\tFROM\n\t\t\tSoundEntries\n\t\t\t{$query_from}\n\t\tORDER BY\n\t\t\tPK_SoundEntry\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundEntry = $row; foreach ($SoundLanguages as $SoundLanguage) { $lid = $SoundLanguage['PK_SoundLanguage']; $SoundEntry['Name'][$lid] = $SoundEntry["Name_{$lid}"]; $SoundEntry['Description'][$lid] = $SoundEntry["Description_{$lid}"]; if ($SoundEntry["Name_{$lid}"] != "") { $SoundEntry['Name']['Default'] = "{$SoundEntry['Name'][$SoundLanguage['PK_SoundLanguage']]}"; } } if ($SoundEntry['Name'][$SoundLanguage_Default['PK_SoundLanguage']] != "") { $SoundEntry['Name']['Default'] = "{$SoundEntry['Name'][$SoundLanguage_Default['PK_SoundLanguage']]}"; } $SoundEntries[] = $SoundEntry; } // Get available menus $Menus = array(); $query = "SELECT PK_Menu, Name FROM IVR_Menus ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $menu = $row; $query2 = "SELECT * FROM IVR_Actions WHERE FK_Menu = '{$menu['PK_Menu']}' ORDER BY `Order`"; $result2 = $mysqli->query($query2) or die($mysqli->error . $query2); while ($row2 = $result2->fetch_assoc()) { $action = $row2; $query3 = "SELECT * FROM IVR_Action_Params WHERE FK_Action = {$action['PK_Action']}"; $result3 = $mysqli->query($query3) or die($mysqli->error . $query3); while ($row3 = $result3->fetch_assoc()) { $action['Param'][$row3['Name']] = $row3['Value']; $action['Var'][$row3['Name']] = $row3['Variable']; } $menu['Actions'][] = $action; } $Menus[] = $menu; } $smarty->assign('IVR_Menu', $IVR_Menu); $smarty->assign('IVR_Options', $IVR_Options); $smarty->assign('PK_Menu', $PK_Menu); $smarty->assign('Message', $Message); $smarty->assign('Hilight', isset($_REQUEST['hilight']) ? $_REQUEST['hilight'] : ""); $smarty->assign('History', $_SESSION['IVR_HISTORY']); $smarty->assign('SoundEntries', $SoundEntries); $smarty->assign('SoundFolders', $SoundFolders); $smarty->assign('SoundLanguages', $SoundLanguages); $smarty->assign('SoundLanugage_Default', $SoundLanguage_Default); $smarty->assign('Menus', $Menus); return $smarty->fetch('IVR_Options_List.tpl'); }
function Templates_Modify() { global $mysqli; $session =& $_SESSION['Templates_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Init Available DTMF Modes (DTMFModes) $query = "SELECT PK_DTMFMode, Name, Description FROM DTMFModes"; $result = $mysqli->query($query) or die($mysqli->errno()); $DTMFModes = array(); while ($row = $result->fetch_assoc()) { $DTMFModes[] = $row; } // Init available codecs (Codecs) $query = "SELECT PK_Codec, Name, Description, Recomended FROM Codecs"; $result = $mysqli->query($query) or die($mysqli->error); $Codecs = array(); while ($row = $result->fetch_assoc()) { $Codecs[] = $row; } // Init available nat types (NATTypes) $query = "SELECT PK_NATType, Name, Description FROM NATTypes"; $result = $mysqli->query($query) or die($mysqli->errno()); $NATTypes = array(); while ($row = $result->fetch_assoc()) { $NATTypes[] = $row; } // Init available extension groups (Groups) $query = "SELECT PK_Group, Name FROM Groups"; $result = $mysqli->query($query) or die($mysqli->errno()); $Groups = array(); while ($row = $result->fetch_assoc()) { $Groups[] = $row; } // Init available outgoing rules (Rules) $query = "SELECT * FROM OutgoingRules ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->errno()); $Rules = array(); while ($row = $result->fetch_assoc()) { $Rules[] = $row; } // Init available extension groups (Features) $query = "SELECT PK_Feature, Name FROM Features"; $result = $mysqli->query($query) or die($mysqli->errno()); $Features = array(); while ($row = $result->fetch_assoc()) { $Features[] = $row; } // Init form data (Template) if (@$_REQUEST['submit'] == 'save') { $Template = formdata_from_post(); formdata_save($Template); header("Location: Templates_List.php?msg=MODIFY_TEMPLATE&hilight={$_REQUEST['PK_Template']}"); die; } else { $Template = formdata_from_db($_REQUEST['PK_Template']); } $smarty->assign('Template', $Template); $smarty->assign('DTMFModes', $DTMFModes); $smarty->assign('Codecs', $Codecs); $smarty->assign('Features', $Features); $smarty->assign('NATTypes', $NATTypes); $smarty->assign('Groups', $Groups); $smarty->assign('Rules', $Rules); $smarty->assign('Message', $Message); return $smarty->fetch('Templates_Modify.tpl'); }
function Extensions_Action_Modify() { global $mysqli; $session =& $_SESSION['IVR_Action_Modify_play_sound']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); if (@$_REQUEST['submit'] == 'save') { $Action = formdata_from_post(); $Errors = formdata_validate($Action); if (count($Errors) == 0) { $id = formdata_save($Action); header("Location: IVR_Actions.php?PK_Menu={$Action['FK_Menu']}&hilight={$id}"); die; } } elseif (@$_REQUEST['PK_Action'] != "") { $Action = formdata_from_db($_REQUEST['PK_Action']); } else { $Action = formdata_from_default(); } // Init Folders (SoundFolders) $SoundFolders = array(); $query = "\n\t\tSELECT\n\t\t\tPK_SoundFolder,\n\t\t\tName\n\t\tFROM\n\t\t\tSoundFolders\n\t\tORDER BY Name\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundFolders[] = $row; } // Init SoundLanguages $SoundLanguages = array(); $query = "\n\t\tSELECT\n\t\t\tPK_SoundLanguage,\n\t\t\t`Default`,\n\t\t\tName\n\t\tFROM\n\t\t\tSoundLanguages\n\t\tORDER BY Name\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundLanguages[] = $row; if ($row['Default']) { $SoundLanguage_Default = $row; } } // Init SoundEntries $SoundEntries = array(); foreach ($SoundLanguages as $SoundLanguage) { $lid = $SoundLanguage['PK_SoundLanguage']; $query_select .= "\n\t\t\tSoundFiles_{$lid}.Name AS Name_{$lid} ,\n\t\t\tSoundFiles_{$lid}.Description AS Description_{$lid},\n\t\t"; $query_from .= "\n\t\t\tLEFT JOIN SoundFiles SoundFiles_{$lid} ON SoundFiles_{$lid}.FK_SoundEntry = PK_SoundEntry AND SoundFiles_{$lid}.FK_SoundLanguage = {$lid}\n\t\t"; } $query = "\n\t\tSELECT\n\t\t\t{$query_select}\n\t\t\tPK_SoundEntry,\n\t\t\tFK_SoundFolder\n\t\tFROM\n\t\t\tSoundEntries\n\t\t\t{$query_from}\n\t\tORDER BY\n\t\t\tPK_SoundEntry\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); while ($row = $result->fetch_assoc()) { $SoundEntry = $row; foreach ($SoundLanguages as $SoundLanguage) { $lid = $SoundLanguage['PK_SoundLanguage']; $SoundEntry['Name'][$lid] = $SoundEntry["Name_{$lid}"]; $SoundEntry['Description'][$lid] = $SoundEntry["Description_{$lid}"]; if ($SoundEntry["Name_{$lid}"] != "") { $SoundEntry['Name']['Default'] = "{$SoundEntry['Name'][$SoundLanguage['PK_SoundLanguage']]}"; } } if ($SoundEntry['Name'][$SoundLanguage_Default['PK_SoundLanguage']] != "") { $SoundEntry['Name']['Default'] = "{$SoundEntry['Name'][$SoundLanguage_Default['PK_SoundLanguage']]}"; } $SoundEntries[] = $SoundEntry; } $smarty->assign('Action', $Action); $smarty->assign('SoundEntries', $SoundEntries); $smarty->assign('SoundFolders', $SoundFolders); $smarty->assign('SoundLanguages', $SoundLanguages); $smarty->assign('SoundLanugage_Default', $SoundLanguage_Default); return $smarty->fetch('IVR_Actions_Modify.play_sound.tpl'); }
function VoicemailSettings() { global $mysqli; $session =& $_SESSION['AgentSettings']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // SipProviders $SipProviders = array(); $query = "SELECT * FROM SipProviders ORDER BY Name"; $result = $mysqli->query($query) or die($mysqli->error); while ($row = $result->fetch_assoc()) { $SipProviders[] = $row; } if (!empty($_REQUEST['submit'])) { $Settings = formdata_from_post(); // Save Email Settings if ($_REQUEST['submit'] == 'save_email_settings') { $variables = array('Voicemail_From', 'Voicemail_SMTP_Server', 'Voicemail_SMTP_User', 'Voicemail_SMTP_Pass'); $Message = 'SAVED_EMAIL_SETTINGS'; } // Save Routing Settings if ($_REQUEST['submit'] == 'save_routing_settings') { $variables = array('Voicemail_AllowLogin', 'Voicemail_OperatorExtension'); $Message = 'SAVED_ROUTING_SETTINGS'; } // Save Voicemail Template if ($_REQUEST['submit'] == 'save_voicemail_template') { $variables = array('Voicemail_EmailTemplate'); $Message = 'SAVED_EMAIL_TEMPLATE'; } // Save Voicemail Template if ($_REQUEST['submit'] == 'save_external_settings') { $variables = array('Voicemail_UseExternal', 'Voicemail_PK_SipProvider'); $Message = 'SAVED_EXTERNAL_SETTINGS'; } // Restore original email template if requested if ($_REQUEST['submit'] == 'restore_original_template') { $variables = array(); $OldSettings = formdata_from_db(); $Settings['Voicemail_EmailTemplate'] = $OldSettings['Voicemail_EmailTemplate_Original']; $Message = 'RESTORE_EMAIL_TEMPLATE'; } $Errors = formdata_validate($Settings, $variables); if (count($Errors) == 0) { formdata_save($Settings, $variables); } else { $Message = ""; } $OldSettings = formdata_from_db(); foreach ($OldSettings as $variable => $value) { if (!isset($Settings[$variable])) { $Settings[$variable] = $value; } } } else { $Settings = formdata_from_db(); } $smarty->assign('Errors', $Errors); $smarty->assign('Message', $Message); $smarty->assign('Settings', $Settings); $smarty->assign('SipProviders', $SipProviders); return $smarty->fetch('VoicemailSettings.tpl'); }
function Extensions_FC_DirectedPickup_Modify() { global $mysqli; $session =& $_SESSION['Extensions_FC_DirectedPickup_Modify']; $smarty = smarty_init(dirname(__FILE__) . '/templates'); //myprint($_REQUEST); if ($_REQUEST['PK_Extension']) { $pk_ext = $_REQUEST['PK_Extension']; //Preexisted Members $query = " SELECT\n\t\t\t\t\t\tFK_Ext_Member, ConnectionID, FK_Ext_Group\n\t\t\t\t\tFROM\n\t\t\t\t\t\tFC_DirectedPickup_Members\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tFK_Extension = '" . $mysqli->escape_string($pk_ext) . "' ORDER BY FK_Ext_Member, FK_Ext_Group"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Members = array(); while ($row = $result->fetch_assoc()) { $Members[] = $row; } //Preexisted Admins $query = " SELECT\n\t\t\t\t\t\tFK_Ext_Admin, ConnectionID, FK_Ext_Group\n\t\t\t\t\tFROM\n\t\t\t\t\t\tFC_DirectedPickup_Admins\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tFK_Extension = '" . $mysqli->escape_string($pk_ext) . "' ORDER BY FK_Ext_Admin, FK_Ext_Group"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Admins = array(); while ($row = $result->fetch_assoc()) { $Admins[] = $row; } //Preexisted ConnectionIDs $query = " SELECT DISTINCT\n\t\t\t\t\t\tConnectionID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tFC_DirectedPickup_Admins\n\t\t\t\t\tORDER BY ConnectionID"; $result = $mysqli->query($query) or die($mysqli->error . $query); $IDs = array(); while ($row = $result->fetch_assoc()) { $IDs[] = $row['ConnectionID']; } } $Rows = @data_rows($Admins, $Members, $IDs); // Init message (Message) $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ""; // Groups $query = "SELECT PK_Group, Name FROM Groups"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Groups = array(); while ($row = $result->fetch_assoc()) { $Groups[] = $row; } // Init Available Accounts (Accounts) $query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension,\n\t\t\tExtension,\n\t\t\tCONCAT(IFNULL(Ext_SipPhones.FirstName,''),IFNULL(Ext_Virtual.FirstName,'')) AS FirstName,\n\t\t\tCONCAT(IFNULL(Ext_SipPhones.LastName ,''),IFNULL(Ext_Virtual.LastName,'')) AS LastName\n\t\tFROM\n\t\t\tExtensions\n\t\t\tLEFT JOIN Ext_SipPhones ON Ext_SipPhones.PK_Extension = Extensions.PK_Extension\n\t\t\tLEFT JOIN Ext_Virtual ON Ext_Virtual.PK_Extension = Extensions.PK_Extension\n\t\tWHERE\n\t\t\tExtensions.Type IN ('Virtual', 'SipPhone')\n\t\tORDER BY Extension\n\t"; $result = $mysqli->query($query) or die($mysqli->error . $query); $Accounts = array(); while ($row = $result->fetch_assoc()) { $Accounts[] = $row; } if (@$_REQUEST['submit'] == 'save') { $Extension = formdata_from_post(); $Errors = formdata_validate($Extension); if (count($Errors) == 0) { if ($Extension['PK_Extension'] != '') { $msg = 'MODIFY_FC_DIRECTEDPICKUP_EXTENSION'; } else { $msg = 'ADD_FC_DIRECTEDPICKUP_EXTENSION'; } $id = @formdata_save($Extension); header("Location: Extensions_List.php?hilight={$id}&msg={$msg}"); die; } } elseif (@$_REQUEST['PK_Extension'] != "") { $Extension = formdata_from_db($_REQUEST['PK_Extension']); } else { $Extension = formdata_from_default(); } $smarty->assign('Groups', $Groups); $smarty->assign('Accounts', $Accounts); $smarty->assign('Rows', $Rows); $smarty->assign('FC_DirectedPickup', $Extension); $smarty->assign('Errors', $Errors); return $smarty->fetch('Extensions_FC_DirectedPickup_Modify.tpl'); }