| 1 |
<?php |
|---|
| 2 |
//Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) |
|---|
| 3 |
// |
|---|
| 4 |
//This program is free software; you can redistribute it and/or |
|---|
| 5 |
//modify it under the terms of the GNU General Public License |
|---|
| 6 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 7 |
//of the License, or (at your option) any later version. |
|---|
| 8 |
// |
|---|
| 9 |
//This program is distributed in the hope that it will be useful, |
|---|
| 10 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 |
//GNU General Public License for more details. |
|---|
| 13 |
|
|---|
| 14 |
$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
if ($action == 'editglobals') { |
|---|
| 19 |
$globalfields = array( |
|---|
| 20 |
array($_REQUEST['RINGTIMER'],'RINGTIMER'), |
|---|
| 21 |
array($_REQUEST['FAX_RX'],'FAX_RX'), |
|---|
| 22 |
array($_REQUEST['FAX_RX_EMAIL'],'FAX_RX_EMAIL'), |
|---|
| 23 |
array($_REQUEST['FAX_RX_FROM'],'FAX_RX_FROM'), |
|---|
| 24 |
array($_REQUEST['DIRECTORY'],'DIRECTORY'), |
|---|
| 25 |
array($_REQUEST['VM_PREFIX'],'VM_PREFIX'), |
|---|
| 26 |
array($_REQUEST['VM_DDTYPE'],'VM_DDTYPE'), |
|---|
| 27 |
array($_REQUEST['VM_GAIN'],'VM_GAIN'), |
|---|
| 28 |
array($_REQUEST['DIAL_OPTIONS'],'DIAL_OPTIONS'), |
|---|
| 29 |
array($_REQUEST['TRUNK_OPTIONS'],'TRUNK_OPTIONS'), |
|---|
| 30 |
array($_REQUEST['TONEZONE'], 'TONEZONE'), |
|---|
| 31 |
array($_REQUEST['ALLOW_SIP_ANON'], 'ALLOW_SIP_ANON'), |
|---|
| 32 |
array($_REQUEST['OPERATOR_XTN'], 'OPERATOR_XTN'), |
|---|
| 33 |
array(isset($_REQUEST['DIRECTORY_OPTS']) ? $_REQUEST['DIRECTORY_OPTS'] : "",'DIRECTORY_OPTS'), |
|---|
| 34 |
array(isset($_REQUEST['VM_OPTS']) ? $_REQUEST['VM_OPTS'] : "",'VM_OPTS'), |
|---|
| 35 |
); |
|---|
| 36 |
|
|---|
| 37 |
$compiled = $db->prepare('UPDATE globals SET value = ? WHERE variable = ?'); |
|---|
| 38 |
|
|---|
| 39 |
$result = $db->executeMultiple($compiled,$globalfields); |
|---|
| 40 |
if(DB::IsError($result)) { |
|---|
| 41 |
echo $action.'<br>'; |
|---|
| 42 |
die($result->getMessage()); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
needreload(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
$sql = "SELECT * FROM globals"; |
|---|
| 51 |
$globals = $db->getAll($sql); |
|---|
| 52 |
if(DB::IsError($globals)) { |
|---|
| 53 |
die($globals->getMessage()); |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
foreach ($globals as $global) { |
|---|
| 58 |
${trim($global[0])} = $global[1]; |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
?> |
|---|
| 62 |
|
|---|
| 63 |
<form name="general" action="config.php" method="post" onsubmit="return general_onsubmit();"> |
|---|
| 64 |
<input type="hidden" name="display" value="general"/> |
|---|
| 65 |
<input type="hidden" name="action" value="editglobals"/> |
|---|
| 66 |
|
|---|
| 67 |
<h5><?php echo _("Dialing Options")?></h5> |
|---|
| 68 |
<p> |
|---|
| 69 |
<a href=# class="info"><?php echo _("Asterisk Dial command options:")?><span><br> |
|---|
| 70 |
<?php echo _("t: Allow the called user to transfer the call by hitting #")?><br> |
|---|
| 71 |
<?php echo _("T: Allow the calling user to transfer the call by hitting #")?><br> |
|---|
| 72 |
<?php echo _("r: Generate a ringing tone for the calling party")?><br> |
|---|
| 73 |
<?php echo _("w: Allow the called user to start recording after pressing *1 (Asterisk v1.2)")?><br> |
|---|
| 74 |
<?php echo _("W: Allow the calling user to start recording after pressing *1 (Asterisk v1.2)")?><br> |
|---|
| 75 |
</span></a> |
|---|
| 76 |
<input type="text" size="2" name="DIAL_OPTIONS" value="<?php echo htmlspecialchars($DIAL_OPTIONS)?>"/> |
|---|
| 77 |
<br><br> |
|---|
| 78 |
<a href=# class="info"><?php echo _("Asterisk Outbound Dial command options:")?><span><br> |
|---|
| 79 |
<?php echo _("t: Allow the called user to transfer the call by hitting #")?><br> |
|---|
| 80 |
<?php echo _("T: Allow the calling user to transfer the call by hitting #")?><br> |
|---|
| 81 |
<?php echo _("r: Generate a ringing tone for the calling party")?><br> |
|---|
| 82 |
<?php echo _("w: Allow the called user to start recording after pressing *1 (Asterisk v1.2)")?><br> |
|---|
| 83 |
<?php echo _("W: Allow the calling user to start recording after pressing *1 (Asterisk v1.2)")?><br> |
|---|
| 84 |
</span></a> |
|---|
| 85 |
<input type="text" size="2" name="TRUNK_OPTIONS" value="<?php echo htmlspecialchars($TRUNK_OPTIONS)?>"/> |
|---|
| 86 |
</p> |
|---|
| 87 |
|
|---|
| 88 |
<h5><?php echo _("Voicemail")?></h5> |
|---|
| 89 |
<p> |
|---|
| 90 |
<?php echo _("Number of seconds to ring phones before sending callers to voicemail:")?> |
|---|
| 91 |
<input type="text" size="2" name="RINGTIMER" value="<?php echo htmlspecialchars($RINGTIMER)?>"/> |
|---|
| 92 |
<br><br> |
|---|
| 93 |
<?php echo _("Extension prefix for dialing direct to voicemail:")?> |
|---|
| 94 |
<input type="text" size="2" name="VM_PREFIX" value="<?php echo htmlspecialchars($VM_PREFIX)?>"/> |
|---|
| 95 |
<br><br> |
|---|
| 96 |
<?php echo _("Direct Dial to Voicemail message type:")?> |
|---|
| 97 |
<select name="VM_DDTYPE"> |
|---|
| 98 |
<option value=""><?php echo _("Default"); ?></option> |
|---|
| 99 |
<option value="u"<?php if ($VM_DDTYPE == "u") echo " SELECTED"; ?>><?php echo _("Unavailable"); ?></option> |
|---|
| 100 |
<option value="su"<?php if ($VM_DDTYPE == "su") echo " SELECTED"; ?>><?php echo _("Unavailable")."--"._("no instructions"); ?></option> |
|---|
| 101 |
<option value="b"<?php if ($VM_DDTYPE == "b") echo " SELECTED"; ?>><?php echo _("Busy"); ?></option> |
|---|
| 102 |
<option value="sb"<?php if ($VM_DDTYPE == "sb") echo " SELECTED"; ?>><?php echo _("Busy")."--"._("no instructions"); ?></option> |
|---|
| 103 |
<option value="s"<?php if ($VM_DDTYPE == "s") echo " SELECTED"; ?>><?php echo ("No Message"); ?></option> |
|---|
| 104 |
</select> |
|---|
| 105 |
<br><br> |
|---|
| 106 |
<a href=# class="info"><?php echo _("Use gain when recording the voicemail message (optional):")?><span> |
|---|
| 107 |
<?php echo _("Use the specified amount of gain when recording the voicemail message."); ?><br><br> |
|---|
| 108 |
<?php echo _("The units are whole-number decibels (dB)."); ?></span></a> |
|---|
| 109 |
<input type="text" size="2" name="VM_GAIN" value="<?php echo htmlspecialchars($VM_GAIN)?>"/> |
|---|
| 110 |
<br><br> |
|---|
| 111 |
<input type="checkbox" value="s" name="VM_OPTS" <?php echo ($VM_OPTS ? 'CHECKED' : '')?>> <a href=# class="info"><?php echo _("Do Not Play")?><span><?php echo _("Check this to remove the default message \"Please leave your message after the tone. When done, hang-up, or press the pound key.\" That is played after the voicemail greeting (the s option). This applies globally to all vm boxes.")?></span></a> <?php echo _("please leave message after tone to caller")?> |
|---|
| 112 |
</p> |
|---|
| 113 |
|
|---|
| 114 |
<h5><?php echo _("Company Directory")?></h5> |
|---|
| 115 |
<p> |
|---|
| 116 |
<?php echo _("Find users in the Company Directory by:")?> |
|---|
| 117 |
<select name="DIRECTORY"> |
|---|
| 118 |
<option value="first" <?php echo ($DIRECTORY == 'first' ? 'SELECTED' : '')?>><?php echo _("first name")?> |
|---|
| 119 |
<option value="last" <?php echo ($DIRECTORY == 'last' ? 'SELECTED' : '')?>><?php echo _("last name")?> |
|---|
| 120 |
<option value="both" <?php echo ($DIRECTORY == 'both' ? 'SELECTED' : '')?>><?php echo _("first or last name")?> |
|---|
| 121 |
</select> |
|---|
| 122 |
<br><br> |
|---|
| 123 |
<input type="checkbox" value="e" name="DIRECTORY_OPTS" <?php echo ($DIRECTORY_OPTS ? 'CHECKED' : '')?>> <a href=# class="info"><?php echo _("Play extension number")?><span><?php echo _("Plays a message \"Please hold while I transfer you to extension xxx\" that lets the caller know what extension to use in the future.")?></span></a> <?php echo _("to caller before transferring call")?><br><br> |
|---|
| 124 |
<a href=# class="info"><?php echo _("Operator Extension:")?><span> |
|---|
| 125 |
<?php echo _("When users hit '0' in the directory, they are put through to this number. Note that it"); ?> |
|---|
| 126 |
<?php echo _(" does NOT need to be an extension, it can be a Ring Group, or even an external number."); ?></span></a> |
|---|
| 127 |
<input type="text" size="10" name="OPERATOR_XTN" value="<?php echo htmlspecialchars($OPERATOR_XTN)?>"/> |
|---|
| 128 |
</p> |
|---|
| 129 |
<h5><?php echo _("Fax Machine")?></h5> |
|---|
| 130 |
<p> |
|---|
| 131 |
<?php echo _("Extension of")?> <a class="info" href="#"><?php echo _("fax machine")?><span><?php echo _("Select 'system' to have the system receive and email faxes.<br>Selecting 'disabled' will result in incoming calls being answered more quickly.")?></span></a> <?php echo _("for receiving faxes:")?> |
|---|
| 132 |
<!--<input type="text" size="8" name="FAX_RX" value="<?php echo $FAX_RX?>"/>--> |
|---|
| 133 |
<select name="FAX_RX"> |
|---|
| 134 |
<option value="disabled" <?php echo ($FAX_RX == 'disabled' ? 'SELECTED' : '')?>><?php echo _("disabled")?> |
|---|
| 135 |
<option value="system" <?php echo ($FAX_RX == 'system' ? 'SELECTED' : '')?>><?php echo _("system")?> |
|---|
| 136 |
<?php |
|---|
| 137 |
|
|---|
| 138 |
$devices = core_devices_list(); |
|---|
| 139 |
if (isset($devices)) { |
|---|
| 140 |
foreach ($devices as $device) { |
|---|
| 141 |
echo '<option value="'.$device[0].'" '.($FAX_RX == $device[0] ? 'SELECTED' : '').'>'.$device[1].' <'.$device[0].'>'; |
|---|
| 142 |
} |
|---|
| 143 |
} |
|---|
| 144 |
?> |
|---|
| 145 |
</select> |
|---|
| 146 |
|
|---|
| 147 |
</p> |
|---|
| 148 |
<p> |
|---|
| 149 |
<a class="info" href="#"><?php echo _("Email address")?><span><?php echo _("Email address used if 'system' has been chosen for the fax extension above.")?></span></a> <?php echo _("to have faxes emailed to:")?> |
|---|
| 150 |
<input type="text" size="20" name="FAX_RX_EMAIL" value="<?php echo htmlspecialchars($FAX_RX_EMAIL)?>"/> |
|---|
| 151 |
</p> |
|---|
| 152 |
<p> |
|---|
| 153 |
<a class="info" href="#"><?php echo _("Email address")?><span><?php echo _("Email address that faxes appear to come from if 'system' has been chosen for the fax extension above.")?></span></a> <?php echo _("that faxes appear to come from:")?> |
|---|
| 154 |
<input type="text" size="20" name="FAX_RX_FROM" value="<?php echo htmlspecialchars($FAX_RX_FROM)?>"/> |
|---|
| 155 |
</p> |
|---|
| 156 |
<h5><?php echo _("International Settings")?></h5> |
|---|
| 157 |
<p> |
|---|
| 158 |
<?php echo _("Country")?> <a class="info" href="#"><?php echo _("Indications")?><span><?php echo _("Select which country you are in")?></span></a> |
|---|
| 159 |
<?php if (isset($TONEZONE) && strlen($TONEZONE)) |
|---|
| 160 |
general_display_zones($TONEZONE); |
|---|
| 161 |
else |
|---|
| 162 |
general_display_zones('us'); |
|---|
| 163 |
?> |
|---|
| 164 |
</p> |
|---|
| 165 |
<h5><?php echo _("Security Settings")?></h5> |
|---|
| 166 |
<p> |
|---|
| 167 |
<a href=# class="info"><?php echo _("Allow Anonymous Inbound SIP Calls?")?><span><br> |
|---|
| 168 |
<?php echo _("** WARNING **")?><br><br> |
|---|
| 169 |
<?php echo _("Setting this to 'yes' will potentially allow ANYBODY to call into your Asterisk server using the SIP protocol")?><br><br> |
|---|
| 170 |
<?php echo _("It should only be used if you fully understand the impact of allowing anonymous calls into your server")?><br> |
|---|
| 171 |
</span></a> |
|---|
| 172 |
<select name="ALLOW_SIP_ANON"> |
|---|
| 173 |
<option value="no"><?php echo _("no"); ?></option> |
|---|
| 174 |
<option <?php if ($ALLOW_SIP_ANON == "yes") echo "SELECTED "?>value="yes"><?php echo _("yes"); ?></option> |
|---|
| 175 |
</select> |
|---|
| 176 |
</p> |
|---|
| 177 |
<h6> |
|---|
| 178 |
<input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"> |
|---|
| 179 |
</h6> |
|---|
| 180 |
<script language="javascript"> |
|---|
| 181 |
<!-- |
|---|
| 182 |
|
|---|
| 183 |
var theForm = document.general; |
|---|
| 184 |
|
|---|
| 185 |
function general_onsubmit() { |
|---|
| 186 |
var msgInvalidSeconds = "<?php echo _('Please enter a valid Number of Seconds'); ?>"; |
|---|
| 187 |
var msgInvalidDefaultFaxEmail = "<?php echo _('Please enter a valid Fax Email'); ?>"; |
|---|
| 188 |
|
|---|
| 189 |
defaultEmptyOK = false; |
|---|
| 190 |
if (!isInteger(theForm.RINGTIMER.value)) |
|---|
| 191 |
return warnInvalid(theForm.RINGTIMER, msgInvalidSeconds); |
|---|
| 192 |
|
|---|
| 193 |
// Fax email must be present if selected 'system', otherwise optional |
|---|
| 194 |
if (theForm.FAX_RX.value == "system") { |
|---|
| 195 |
defaultEmptyOK = false; |
|---|
| 196 |
} else { |
|---|
| 197 |
defaultEmptyOK = true; |
|---|
| 198 |
} |
|---|
| 199 |
if (!isEmail(theForm.FAX_RX_EMAIL.value)) |
|---|
| 200 |
return warnInvalid(theForm.FAX_RX_EMAIL, msgInvalidDefaultFaxEmail); |
|---|
| 201 |
|
|---|
| 202 |
return true; |
|---|
| 203 |
} |
|---|
| 204 |
|
|---|
| 205 |
//--> |
|---|
| 206 |
</script> |
|---|
| 207 |
</form> |
|---|
| 208 |
|
|---|
| 209 |
|
|---|