public function showPage()
 {
     $media = $this->FreePBX->Media();
     $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : "";
     switch ($action) {
         case "edit":
             $data = $this->getRecordingById($_REQUEST['id']);
             $fcc = new \featurecode("recordings", 'edit-recording-' . $_REQUEST['id']);
             $rec_code = $fcc->getCode();
             $data['rec_code'] = $rec_code != '' ? $rec_code : $this->fcbase . $_REQUEST['id'];
         case "add":
             $data = isset($data) ? $data : array();
             $supported = $media->getSupportedFormats();
             ksort($supported['in']);
             ksort($supported['out']);
             $langs = $this->FreePBX->Soundlang->getLanguages();
             $default = $this->FreePBX->Soundlang->getLanguage();
             $sysrecs = $this->getSystemRecordings();
             $jsonsysrecs = json_encode($sysrecs);
             $message = '';
             if (json_last_error() !== JSON_ERROR_NONE) {
                 $message = sprintf(_("There was an error reading system recordings (%s)"), json_last_error_msg());
                 freepbx_log(FPBX_LOG_WARNING, "JSON decode error: " . json_last_error_msg());
                 $jsonsysrecs = array();
                 $sysrecs = array();
             }
             $supportedHTML5 = $media->getSupportedHTML5Formats();
             $convertto = array_intersect($supported['out'], $this->convert);
             $html = load_view(__DIR__ . "/views/form.php", array("message" => $message, "jsonsysrecs" => $jsonsysrecs, "convertto" => $convertto, "supportedHTML5" => implode(",", $supportedHTML5), "data" => $data, "default" => $default, "supported" => $supported, "langs" => $langs, "sysrecs" => $sysrecs));
             break;
         case "delete":
             $this->delRecording($_REQUEST['id']);
         default:
             $html = load_view(__DIR__ . "/views/grid.php", array());
             break;
     }
     return $html;
 }
function voicemail_configpageload()
{
    global $currentcomponent;
    global $amp_conf;
    global $astman;
    // Init vars from $_REQUEST[]
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $ext = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $extn = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
    $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null;
    if ($ext === '') {
        $extdisplay = $extn;
    } else {
        $extdisplay = $ext;
    }
    if ($action != 'del') {
        $vmbox = voicemail_mailbox_get($extdisplay);
        if ($vmbox == null) {
            $vm = false;
            $incontext = 'default';
            $vmpwd = null;
            $name = null;
            $email = null;
            $pager = null;
            $vmoptions = null;
        } else {
            $incontext = isset($vmbox['vmcontext']) ? $vmbox['vmcontext'] : 'default';
            $vmpwd = $vmbox['pwd'];
            $name = $vmbox['name'];
            $email = $vmbox['email'];
            $pager = $vmbox['pager'];
            $vmoptions = $vmbox['options'];
            $vm = true;
        }
        //loop through all options
        $options = "";
        if (isset($vmoptions) && is_array($vmoptions)) {
            $alloptions = array_keys($vmoptions);
            if (isset($alloptions)) {
                foreach ($alloptions as $option) {
                    if ($option != "attach" && $option != "envelope" && $option != "passlogin" && $option != "novmstar" && $option != "saycid" && $option != "delete" && $option != "imapuser" && $option != "imappassword" && $option != '') {
                        $options .= $option . '=' . $vmoptions[$option] . '|';
                    }
                }
                $options = rtrim($options, '|');
                // remove the = sign if there are no options set
                $options = rtrim($options, '=');
            }
            extract($vmoptions, EXTR_PREFIX_ALL, "vmops");
        } else {
            $vmops_novmstar = 'no';
            $vmops_passlogin = '******';
            $vmops_attach = 'no';
            $vmops_saycid = 'no';
            $vmops_envelope = 'no';
            $vmops_delete = 'no';
            $vmops_imapuser = null;
            $vmops_imappassword = null;
        }
        if (empty($vmcontext)) {
            $vmcontext = isset($_REQUEST['vmcontext']) ? $_REQUEST['vmcontext'] : $incontext;
        }
        if (empty($vmcontext)) {
            $vmcontext = 'default';
        }
        if ($vm == true) {
            $vmselect = "enabled";
        } else {
            $vmselect = "disabled";
        }
        $fc_vm = featurecodes_getFeatureCode('voicemail', 'dialvoicemail');
        $msgInvalidVmPwd = _("Please enter a valid Voicemail Password, using digits only");
        $msgInvalidEmail = _("Please enter a valid Email Address");
        $msgInvalidPager = _("Please enter a valid Pager Email Address");
        $msgInvalidVMContext = _("VM Context cannot be blank");
        $vmops_imapuser = isset($vmops_imapuser) ? $vmops_imapuser : '';
        $vmops_imappassword = isset($vmops_imappassword) ? $vmops_imappassword : '';
        $section = _("Voicemail");
        $class = "fpbx-voicemail";
        $category = "voicemail";
        $guidefaults = array("elemname" => "", "prompttext" => "", "helptext" => "", "currentvalue" => "", "valarray" => array(), "jsonclick" => '', "jsvalidation" => "", "failvalidationmsg" => "", "canbeempty" => true, "maxchars" => 0, "disable" => false, "inputgroup" => false, "class" => "");
        $el = array("elemname" => "vm", "prompttext" => _('Enabled'), "currentvalue" => $vmselect, "valarray" => $currentcomponent->getoptlist('vmena'), "jsonclick" => "frm_{$display}_voicemailEnabled() && frm_{$display}_vmxEnabled()", "pairedvalues" => false);
        $currentcomponent->addguielem($section, new gui_radio(array_merge($guidefaults, $el)), $category);
        $disable = $vmselect == 'disabled';
        $el = array("elemname" => "vmpwd", "prompttext" => _('Voicemail Password'), "helptext" => sprintf(_("This is the password used to access the Voicemail system.%sThis password can only contain numbers.%sA user can change the password you enter here after logging into the Voicemail system (%s) with a phone."), "<br /><br />", "<br /><br />", $fc_vm), "currentvalue" => $vmpwd, "jsvalidation" => "frm_{$display}_isVoiceMailEnabled() && !frm_{$display}_isValidVoicemailPass()", "failvalidationmsg" => $msgInvalidVmPwd, "canbeempty" => false, "class" => $class, "disable" => $disable, "passwordToggle" => true);
        $currentcomponent->addguielem($section, new gui_password(array_merge($guidefaults, $el)), $category);
        //for passwordless voicemail we need to check some settings
        //first lets see if there is an entry in the asteriskDB for this device
        //no entry in the db is the same as yes, meaning we need a voicemail password
        $passlogin = !empty($extdisplay) ? $astman->connected() && $astman->database_get("AMPUSER", $extdisplay . "/novmpw") : 'yes';
        $passlogin = !empty($passlogin) ? 'no' : 'yes';
        //now lets get our featurecodes for helptext display niceties
        $mvm = new featurecode('voicemail', 'myvoicemail');
        $dvm = new featurecode('voicemail', 'dialvoicemail');
        $extword = $display == 'extensions' ? _('Extension') : _('Device');
        $display_mode = "advanced";
        $mode = \FreePBX::Config()->get("FPBXOPMODE");
        if (!empty($mode)) {
            $display_mode = $mode;
        }
        if ($display_mode == "basic") {
            $tb = $rb = "gui_hidden";
        } else {
            $tb = "gui_textbox";
            $rb = "gui_radio";
        }
        $el = array("elemname" => "passlogin", "prompttext" => sprintf(_('Require From Same %s'), $extword), "helptext" => sprintf(_("If set to \"no\" then when the user dials %s to access their own voicemail, they will not be asked to enter a password. This does not apply to %s calls, which will always prompt for a password. For security reasons, this should probably be set to \"yes\" in an environment where other users will have physical access to this extension."), $mvm->getCode(), $dvm->getCode()), "currentvalue" => $passlogin, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        $novmstar = !empty($extdisplay) ? $astman->connected() && $astman->database_get("AMPUSER", $extdisplay . "/novmstar") : 'yes';
        $novmstar = !empty($novmstar) ? 'yes' : 'no';
        $el = array("elemname" => "novmstar", "prompttext" => _("Disable (*) in Voicemail Menu"), "helptext" => sprintf(_("If set to \"yes\" then when someone dials this voicemail box they will not be able to access the voicemail menu by pressing (*). If you have no plans to access your mailbox remotely set this to \"yes\""), $mvm->getCode(), $dvm->getCode()), "currentvalue" => $novmstar, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "email", "prompttext" => _('Email Address'), "helptext" => _("The email address that Voicemails are sent to."), "currentvalue" => $email, "jsvalidation" => "frm_{$display}_isVoiceMailEnabled() && frm_{$display}_isEmailAttachment() && !isEmail()", "failvalidationmsg" => $msgInvalidEmail, "canbeempty" => false, "class" => $class, "disable" => $disable);
        $currentcomponent->addguielem($section, new gui_textbox(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "pager", "prompttext" => _('Pager Email Address'), "helptext" => _("Pager/mobile email address that short Voicemail notifications are sent to."), "currentvalue" => $pager, "jsvalidation" => "frm_{$display}_isVoiceMailEnabled() && !isEmpty() && !isEmail()", "failvalidationmsg" => $msgInvalidEmail, "canbeempty" => false, "class" => $class, "disable" => $disable);
        $currentcomponent->addguielem($section, new $tb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "attach", "prompttext" => _('Email Attachment'), "helptext" => _("Option to attach Voicemails to email."), "currentvalue" => $vmops_attach, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "saycid", "prompttext" => _('Play CID'), "helptext" => _("Read back caller's telephone number prior to playing the incoming message, and just after announcing the date and time the message was left."), "currentvalue" => $vmops_saycid, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "envelope", "prompttext" => _('Play Envelope'), "helptext" => _("Envelope controls whether or not the Voicemail system will play the message envelope (date/time) before playing the Voicemail message. This setting does not affect the operation of the envelope option in the advanced Voicemail menu."), "currentvalue" => $vmops_envelope, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "vmdelete", "prompttext" => _('Delete Voicemail'), "helptext" => _("If set to \"yes\" the message will be deleted from the Voicemailbox (after having been emailed). Provides functionality that allows a user to receive their Voicemail via email alone, rather than having the Voicemail able to be retrieved from the Webinterface or the Extension handset.  CAUTION: MUST HAVE attach Voicemail to email SET TO YES OTHERWISE YOUR MESSAGES WILL BE LOST FOREVER."), "currentvalue" => $vmops_delete, "valarray" => $currentcomponent->getoptlist('vmyn'), "disable" => $disable, "class" => $class);
        $currentcomponent->addguielem($section, new $rb(array_merge($guidefaults, $el)), $category);
        if ($amp_conf['VM_SHOW_IMAP'] || $vmops_imapuser || $vmops_imappassword) {
            $el = array("elemname" => "imapuser", "prompttext" => _('IMAP Username'), "helptext" => sprintf(_("This is the IMAP username, if using IMAP storage"), "<br /><br />"), "currentvalue" => $vmops_imapuser, "class" => $class, "disable" => $disable);
            $currentcomponent->addguielem($section, new $tb(array_merge($guidefaults, $el)), $category);
            $el = array("elemname" => "imappassword", "prompttext" => _('IMAP Password'), "helptext" => sprintf(_("This is the IMAP password, if using IMAP storage"), "<br /><br />"), "currentvalue" => $vmops_imapuser, "class" => $class, "disable" => $disable);
            $currentcomponent->addguielem($section, new $tb(array_merge($guidefaults, $el)), $category);
        }
        $el = array("elemname" => "options", "prompttext" => _('VM Options'), "helptext" => sprintf(_("Separate options with pipe ( | )%sie: review=yes|maxmessage=60"), "<br /><br />"), "currentvalue" => $options, "class" => $class, "disable" => $disable);
        $currentcomponent->addguielem($section, new $tb(array_merge($guidefaults, $el)), $category);
        $el = array("elemname" => "vmcontext", "prompttext" => _('VM Context'), "helptext" => _("This is the Voicemail Context which is normally set to default. Do not change unless you understand the implications."), "currentvalue" => $incontext, "class" => $class, "disable" => $disable, "jsvalidation" => "frm_{$display}_isVoiceMailEnabled() && isEmpty()", "failvalidationmsg" => $msgInvalidVMContext);
        $currentcomponent->addguielem($section, new $tb(array_merge($guidefaults, $el)), $category);
        voicemail_draw_vmxgui($extdisplay, $disable);
    }
}
 public function showPage()
 {
     if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "delete" && !empty($_REQUEST['id']) && !empty($_REQUEST['ext'])) {
         $file = $this->FreePBX->Config->get('ASTSPOOLDIR') . "/outgoing/wuc." . $_REQUEST['id'] . ".ext." . $_REQUEST['ext'] . ".call";
         if (file_exists($file)) {
             unlink($file);
         }
     }
     $action = !empty($_POST['action']) ? $_POST['action'] : '';
     $fcc = new \featurecode('hotelwakeup', 'hotelwakeup');
     $code = $fcc->getCode();
     switch ($action) {
         case "settings":
             preg_match('/"(.*)" <(.*)>/', $_POST['callerid'], $matches);
             $this->saveConfig(array("operator_mode" => $_POST['operator_mode'], "extensionlength" => $_POST['extensionlength'], "operator_extensions" => $_POST['operator_extensions'], "waittime" => $_POST['waittime'], "retrytime" => $_POST['retrytime'], "maxretries" => $_POST['maxretries'], "cid" => !empty($matches[2]) ? $matches[2] : $code, "cnam" => !empty($matches[1]) ? $matches[1] : _("Wake Up Calls")));
             break;
     }
     $content = load_view(__DIR__ . "/views/grid.php", array("code" => $code, "config" => $this->getConfig()));
     return load_view(__DIR__ . "/views/main.php", array("pageContent" => $content));
 }
Example #4
0
<div class="rnav"><ul>
    <li><a id="<?php 
echo $itemid == '' ? 'current' : '';
?>
" href="config.php?display=<?php 
echo urlencode($dispnum);
?>
&action=add"><?php 
echo _("Add Day/Night Code");
?>
</a></li>
<?php 
if (isset($daynightcodes)) {
    foreach ($daynightcodes as $code) {
        $fcc = new featurecode('daynight', 'toggle-mode-' . $code['ext']);
        $fc = $fcc->getCode();
        unset($fcc);
        $dnobj = daynight_get_obj($code['ext']);
        $color = $dnobj['state'] == 'DAY' ? "style='color:green'" : "style='color:red'";
        echo "<li><a {$color} id=\"" . ($itemid == $code['ext'] ? 'current' : '') . "\" href=\"config.php?display=" . urlencode($dispnum) . "&itemid=" . urlencode($code['ext']) . "&action=edit\">({$fc}) {$code['dest']}</a></li>";
    }
}
?>
</ul></div>
<?php 
switch ($action) {
    case "add":
        daynight_show_edit($_POST, 'add');
        break;
    case "edit":
        daynight_show_edit($_POST);
Example #5
0
    function outn($text)
    {
        echo $text;
    }
}
$sql = "CREATE TABLE IF NOT EXISTS daynight \n        (\n\t\t\t\text varchar(10) NOT NULL default '',\n\t\t\t\tdmode varchar(40) NOT NULL default '',\n\t\t\t  dest varchar(255) NOT NULL default '',\n\t\t\t\tPRIMARY KEY (ext, dmode, dest)\n\t\t\t  );\n\t\t\t ";
$check = $db->query($sql);
if (DB::IsError($check)) {
    die_freepbx("Can not create daynight table");
}
// Get the old feature code if it existed to determine
// if it had been changed and if it was enabled
//
$delete_old = false;
$fcc = new featurecode('daynight', 'toggle-mode');
$code = $fcc->getCode();
if ($code != '') {
    $delete_old = true;
    $enabled = $fcc->isEnabled();
    $fcc->delete();
}
unset($fcc);
// If we found the old one then we must create all the new ones
//
if ($delete_old) {
    $list = daynight_list();
    foreach ($list as $item) {
        $id = $item['ext'];
        $fc_description = $item['dest'];
        $fcc = new featurecode('daynight', 'toggle-mode-' . $id);
        if ($fc_description) {
 public function getTimeCondition($id)
 {
     $sql = "SELECT * FROM timeconditions WHERE timeconditions_id = :id LIMIT 1";
     $stmt = $this->db->prepare($sql);
     $stmt->execute(array(':id' => $id));
     $results = $stmt->fetch();
     $fcc = new \featurecode('timeconditions', 'toggle-mode-' . $id);
     $c = $fcc->getCodeActive();
     $results['tcval'] = $fcc->getCode();
     unset($fcc);
     if ($c == '') {
         $results['tcstate'] = false;
         $results['tccode'] = false;
     } else {
         $results['tccode'] = $c;
         if ($this->astman != null) {
             $results['tcstate'] = $this->getState($id);
         } else {
             die_freepbx("No manager connection, can't get Time Condition State");
         }
     }
     return $results;
 }
Example #7
0
if (!defined('FREEPBX_IS_AUTH')) {
    die('No direct script access allowed');
}
//for translation only
if (false) {
    _("Info Services");
    _("Directory");
    _("Call Trace");
    _("Echo Test");
    _("Speaking Clock");
    _("Speak Your Exten Number");
}
//removed # to call directory in 2.10, this doesnt make sense with the current directory module
$fcc = new featurecode('infoservices', 'directory');
if ($fcc->getCode()) {
    $fcc->delete();
}
unset($fcc);
$fcc = new featurecode('infoservices', 'calltrace');
$fcc->setDescription('Call Trace');
$fcc->setDefault('*69');
$fcc->update();
unset($fcc);
$fcc = new featurecode('infoservices', 'echotest');
$fcc->setDescription('Echo Test');
$fcc->setDefault('*43');
$fcc->setProvideDest();
$fcc->update();
unset($fcc);
$fcc = new featurecode('infoservices', 'speakingclock');
Example #8
0
function recording_editpage($id, $num)
{
    global $fcbase;
    global $default_pos;
    global $fcode;
    global $fcode_pass;
    global $recordings_astsnd_path;
    ?>
	<div class="content">
	<h2><?php 
    echo _("System Recordings");
    ?>
</h2>
	<h3><?php 
    echo _("Edit Recording");
    ?>
</h3>
	<?php 
    $this_recording = recordings_get($id);
    if (!$this_recording) {
        echo "<tr><td colspan=2><h2>Error reading Recording ID {$id} - Aborting</h2></td></tr></table>";
        return;
    }
    ?>
	<?php 
    $usage_list = recordings_list_usage($id);
    if (count($usage_list)) {
        ?>
		<a href="#" class="info"><?php 
        echo _("Usage List");
        ?>
<span><?php 
        echo _("This recording is being used in the following instances. You can not remove this recording while being used. To re-record, you can enable and use the feature code below if allowed.");
        ?>
</span></a>
<?php 
        $count = 0;
        foreach ($usage_list as $link) {
            $label = '<span><img width="16" height="16" border="0" title="' . $link['description'] . '" alt="" src="images/application_link.png"/>&nbsp;' . $link['description'] . '</span>';
            echo "<br /><a href=" . $link['url_query'] . ">" . $label . "</a>";
        }
    } else {
        $delURL = "config.php?display=recordings&amp;action=delete&amp;usersnum=" . urlencode($num) . "&amp;id={$id}";
        $tlabel = _("Remove Recording");
        $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/sound_delete.png"/>&nbsp;' . $tlabel . '</span>';
        echo "<a href=" . $delURL . ">" . $label . "</a>";
        echo "<i style='font-size: x-small'>&nbsp;(";
        echo _("Note, does not delete file from computer");
        echo ")</i>";
    }
    ?>
	<form name="prompt"  action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post" onsubmit="return rec_onsubmit();">
	<input type="hidden" name="action" value="edited">
	<input type="hidden" name="display" value="recordings">
	<input type="hidden" name="usersnum" value="<?php 
    echo $num;
    ?>
">
	<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
	<table>
	<tr><td colspan=2><hr></td></tr>
	<tr>
		<td><a href="#" class="info"><?php 
    echo _("Change Name");
    ?>
<span><?php 
    echo _("This changes the short name, visible on the right, of this recording");
    ?>
</span></a></td>
		<td><input type="text" name="rname" value="<?php 
    echo $this_recording['displayname'];
    ?>
" tabindex="<?php 
    echo ++$tabindex;
    ?>
"></td>
	</tr>
	<tr>
	    	<td><a href="#" class="info"><?php 
    echo _("Descriptive Name");
    ?>
<span><?php 
    echo _("This is displayed, as a hint, when selecting this recording in Queues, Digital Receptionist, etc");
    ?>
</span></a></td>
	    	<td>&nbsp;<textarea name="notes" rows="3" cols="40" tabindex="<?php 
    echo ++$tabindex;
    ?>
"><?php 
    echo $this_recording['description'];
    ?>
</textarea></td>
	</tr>

<?php 
    // This was being called twice: $rec = recordings_get($id);
    $rec = $this_recording;
    $fn = $rec['filename'];
    $files = explode('&', $fn);
    $counter = 0;
    $arraymax = count($files) - 1;
    $sndfile_html = "";
    $jq_autofill = "";
    foreach ($files as $item) {
        $sndfile_html .= recordings_display_sndfile($item, $counter, $arraymax, $recordings_astsnd_path, $rec['fcode']);
        $counter++;
        // create the jquery autofill statements in advance of the next iteration or the blank one at the end
        // on mouseover to the <td> element (since select doesn't have mouseover event), we clone the populated
        // select options and put them into this one which is created just with the selected tag. Then set the
        // selected value based on what is in the hidden tag. (we skip the hidden tag but for now ...)
        //
        $jq_autofill .= '
		$("#sysrec' . $counter . '").parent().one("mouseover", function(){
			$selectload = $("#selectload' . $counter . '").show(80,function(){
				$("#sysrec' . $counter . '").empty().append($optlist.clone()).val($("#sysrecval' . $counter . '").val());
				$(this).hide();
			});
		});
		';
    }
    $sndfile_html .= recordings_display_sndfile('', $counter, $arraymax, $recordings_astsnd_path, $rec['fcode']);
    if ($arraymax == 0 && isset($files[0]) && substr($files[0], 0, 7) == 'custom/') {
        if ($rec['fcode']) {
            $fcc = new featurecode("recordings", 'edit-recording-' . $id);
            $rec_code = $fcc->getCode();
            unset($fcc);
            if ($rec_code == '') {
                $rec_code = $fcbase . $id;
            }
        } else {
            $rec_code = $fcbase . $id;
        }
        ?>
	<tr>
		<td><a class="info" href="#"><?php 
        echo _("Link to Feature Code");
        ?>
<span><?php 
        echo _("Check this box to create an options feature code that will allow this recording to be changed directly.");
        ?>
</span></a>:
		</td>
		<td>
	<input type='checkbox' tabindex="<?php 
        echo ++$tabindex;
        ?>
"name='fcode' id="fcode" <?php 
        if ($rec['fcode'] == "1") {
            echo 'CHECKED';
        }
        ?>
 OnClick="resetDefaultSound();"; return true;'><?php 
        echo sprintf(_("Optional Feature Code %s"), $rec_code);
        ?>
		</td>
	</tr>
	<tr>
		<td><a href="#" class="info"><?php 
        echo _("Feature Code Password");
        ?>
<span><?php 
        echo _("Optional password to protect access to this feature code which allows a user to re-record it.");
        ?>
</span></a></td>
		<td><input type="text" name="fcode_pass" id="fcode_pass" value="<?php 
        echo $rec['fcode_pass'];
        ?>
" tabindex="<?php 
        echo ++$tabindex;
        ?>
"></td>
	</tr>
<?php 
    } else {
        ?>
	<tr>
    <td colspan="2"><a class="info" href="#"><?php 
        echo _("Direct Access Feature Code Not Available");
        ?>
<span><?php 
        echo _("Direct Access Feature Codes for recordings are not available for built in system recordings or compound recordings made of multiple individual ones.");
        ?>
</span></a>:
    </td>
	</tr>
<?php 
    }
    ?>

	<tr><td colspan="2"><hr /></td></tr>
	</table>
	<?php 
    echo _("Files");
    ?>
:<br />
	<table>
	<?php 
    // globals seem to busted in PHP5 define here for now
    $recordings_astsnd_path = isset($asterisk_conf['astvarlibdir']) ? $asterisk_conf['astvarlibdir'] : '/var/lib/asterisk';
    $recordings_astsnd_path .= "/sounds/";
    // recordings_display_sndfile functions need to be run above so we have $default_pos set
    //
    echo $sndfile_html;
    ?>
	</table>
	<input name="Submit" type="submit" value="<?php 
    echo _("Save");
    ?>
" tabindex="<?php 
    echo ++$tabindex;
    ?>
"></h6>
	<?php 
    recordings_popup_jscript();
    ?>
	
	<?php 
    recordings_form_jscript();
    ?>
	
	<script language="javascript">
	<!-- Begin
	var sysrec0_idx;
	function initPage() {
		sysrec0_idx = document.getElementById("sysrec0").selectedIndex;
		alert('Got here with sysrec0_idx as:'.sysrec0_idx);
	}
	function resetDefaultSound() {
		if (document.getElementById('fcode').checked) {
			document.getElementById('sysrec0').selectedIndex=<?php 
    echo $default_pos;
    ?>
;
			document.getElementById('sysrec1').selectedIndex=0;

			document.getElementById('sysrec0').disabled=true;
			document.getElementById('sysrec1').disabled=true;
			document.getElementById('play1').style.visibility='hidden';
			document.getElementById('down0').style.visibility='hidden';
			document.getElementById('up1').style.visibility='hidden';
			document.getElementById('del0').style.visibility='hidden';
			document.getElementById('del1').style.visibility='hidden';
		} else {
			document.getElementById('sysrec0').disabled=false;
			document.getElementById('sysrec1').disabled=false;
			document.getElementById('play1').style.visibility='visible';
			document.getElementById('down0').style.visibility='visible';
			document.getElementById('up1').style.visibility='visible';
			document.getElementById('del0').style.visibility='visible';
			document.getElementById('del1').style.visibility='visible';
		}
	}

	$(document).ready(function(){
		var $reclist = $("#sysrec0");
		var $optlist = $("#sysrec0 option");
		//$(".slclass").css({ visibility: "visible" }).hide();
		$(".slclass").css("visibility", "visible").hide();
		$(".autofill").width($reclist.width());
		<?php 
    echo $jq_autofill;
    ?>
	});


	// End -->
	</script>
	</form>
	</div>
<?php 
}
Example #9
0
function voicemail_configpageload()
{
    global $currentcomponent;
    global $amp_conf;
    global $astman;
    // Init vars from $_REQUEST[]
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $ext = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $extn = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
    $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null;
    if ($ext === '') {
        $extdisplay = $extn;
    } else {
        $extdisplay = $ext;
    }
    if ($action != 'del') {
        $vmbox = voicemail_mailbox_get($extdisplay);
        if ($vmbox == null) {
            $vm = false;
            $incontext = 'default';
            $vmpwd = null;
            $name = null;
            $email = null;
            $pager = null;
            $vmoptions = null;
            $vmx_state = '';
        } else {
            $incontext = isset($vmbox['vmcontext']) ? $vmbox['vmcontext'] : 'default';
            $vmpwd = $vmbox['pwd'];
            $name = $vmbox['name'];
            $email = $vmbox['email'];
            $pager = $vmbox['pager'];
            $vmoptions = $vmbox['options'];
            $vm = true;
            $vmxobj = new vmxObject($extdisplay);
            $vmx_state = $vmxobj->isEnabled() ? 'checked' : '';
            unset($vmxobj);
        }
        //loop through all options
        $options = "";
        if (isset($vmoptions) && is_array($vmoptions)) {
            $alloptions = array_keys($vmoptions);
            if (isset($alloptions)) {
                foreach ($alloptions as $option) {
                    if ($option != "attach" && $option != "envelope" && $option != "passlogin" && $option != "saycid" && $option != "delete" && $option != "imapuser" && $option != "imappassword" && $option != '') {
                        $options .= $option . '=' . $vmoptions[$option] . '|';
                    }
                }
                $options = rtrim($options, '|');
                // remove the = sign if there are no options set
                $options = rtrim($options, '=');
            }
            extract($vmoptions, EXTR_PREFIX_ALL, "vmops");
        } else {
            $vmops_passlogin = '******';
            $vmops_attach = 'no';
            $vmops_saycid = 'no';
            $vmops_envelope = 'no';
            $vmops_delete = 'no';
            $vmops_imapuser = null;
            $vmops_imappassword = null;
        }
        if (empty($vmcontext)) {
            $vmcontext = isset($_REQUEST['vmcontext']) ? $_REQUEST['vmcontext'] : $incontext;
        }
        if (empty($vmcontext)) {
            $vmcontext = 'default';
        }
        if ($vm == true) {
            $vmselect = "enabled";
        } else {
            $vmselect = "disabled";
        }
        $fc_vm = featurecodes_getFeatureCode('voicemail', 'dialvoicemail');
        $msgInvalidVmPwd = _("Please enter a valid Voicemail Password, using digits only");
        $msgInvalidEmail = _("Please enter a valid Email Address");
        $msgInvalidPager = _("Please enter a valid Pager Email Address");
        $msgInvalidVMContext = _("VM Context cannot be blank");
        $vmops_imapuser = isset($vmops_imapuser) ? $vmops_imapuser : '';
        $vmops_imappassword = isset($vmops_imappassword) ? $vmops_imappassword : '';
        $section = _("Voicemail");
        $currentcomponent->addguielem($section, new gui_selectbox('vm', $currentcomponent->getoptlist('vmena'), $vmselect, _('Status'), '', false, "frm_{$display}_voicemailEnabled() && frm_{$display}_vmx_disable_fields()"));
        $disable = $vmselect == 'disabled';
        $currentcomponent->addguielem($section, new gui_textbox('vmpwd', $vmpwd, _('Voicemail Password'), sprintf(_("This is the password used to access the Voicemail system.%sThis password can only contain numbers.%sA user can change the password you enter here after logging into the Voicemail system (%s) with a phone."), "<br /><br />", "<br /><br />", $fc_vm), "frm_{$display}_isVoiceMailEnabled() && !frm_{$display}_verifyEmptyVoiceMailPassword() && !frm_{$display}_isValidVoicemailPass()", $msgInvalidVmPwd, false, 0, $disable));
        //for passwordless voicemail we need to check some settings
        //first lets see if there is an entry in the asteriskDB for this device
        //no entry in the db is the same as yes, meaning we need a voicemail password
        $passlogin = !empty($extdisplay) ? $astman->database_get("AMPUSER", $extdisplay . "/novmpw") : 'yes';
        $passlogin = !empty($passlogin) ? 'no' : 'yes';
        //now lets get our featurecodes for helptext display niceties
        $mvm = new featurecode('voicemail', 'myvoicemail');
        $dvm = new featurecode('voicemail', 'dialvoicemail');
        $extword = $display == 'extensions' ? _('Extension') : _('Device');
        $currentcomponent->addguielem($section, new gui_radio('passlogin', $currentcomponent->getoptlist('vmyn'), $passlogin, sprintf(_('Require From Same %s'), $extword), sprintf(_("If set to \"no\" then when the user dials %s to access their own voicemail, they will not be asked to enter a password. This does not apply to %s calls, which will always prompt for a password. For security reasons, this should probably be set to \"yes\" in an environment where other users will have physical access to this extension."), $mvm->getCode(), $dvm->getCode()), $disable));
        $currentcomponent->addguielem($section, new gui_textbox('email', $email, _('Email Address'), _("The email address that Voicemails are sent to."), "frm_{$display}_isVoiceMailEnabled() && !isEmail()", $msgInvalidEmail, true, 0, $disable));
        $currentcomponent->addguielem($section, new gui_textbox('pager', $pager, _('Pager Email Address'), _("Pager/mobile email address that short Voicemail notifications are sent to."), "frm_{$display}_isVoiceMailEnabled() && !isEmail()", $msgInvalidEmail, true, 0, $disable));
        $currentcomponent->addguielem($section, new gui_radio('attach', $currentcomponent->getoptlist('vmyn'), $vmops_attach, _('Email Attachment'), _("Option to attach Voicemails to email."), $disable));
        $currentcomponent->addguielem($section, new gui_radio('saycid', $currentcomponent->getoptlist('vmyn'), $vmops_saycid, _('Play CID'), _("Read back caller's telephone number prior to playing the incoming message, and just after announcing the date and time the message was left."), $disable));
        $currentcomponent->addguielem($section, new gui_radio('envelope', $currentcomponent->getoptlist('vmyn'), $vmops_envelope, _('Play Envelope'), _("Envelope controls whether or not the Voicemail system will play the message envelope (date/time) before playing the Voicemail message. This setting does not affect the operation of the envelope option in the advanced Voicemail menu."), $disable));
        $currentcomponent->addguielem($section, new gui_radio('delete', $currentcomponent->getoptlist('vmyn'), $vmops_delete, _('Delete Voicemail'), _("If set to \"yes\" the message will be deleted from the Voicemailbox (after having been emailed). Provides functionality that allows a user to receive their Voicemail via email alone, rather than having the Voicemail able to be retrieved from the Webinterface or the Extension handset.  CAUTION: MUST HAVE attach Voicemail to email SET TO YES OTHERWISE YOUR MESSAGES WILL BE LOST FOREVER."), $disable));
        if ($amp_conf['VM_SHOW_IMAP'] || $vmops_imapuser || $vmops_imappassword) {
            $currentcomponent->addguielem($section, new gui_textbox('imapuser', $vmops_imapuser, _('IMAP Username'), sprintf(_("This is the IMAP username, if using IMAP storage"), "<br /><br />"), '', '', true, 0, $disable));
            $currentcomponent->addguielem($section, new gui_textbox('imappassword', $vmops_imappassword, _('IMAP Password'), sprintf(_("This is the IMAP password, if using IMAP storage"), "<br /><br />"), '', '', true, 0, $disable));
        }
        $currentcomponent->addguielem($section, new gui_textbox('options', $options, _('VM Options'), sprintf(_("Separate options with pipe ( | )%sie: review=yes|maxmessage=60"), "<br /><br />"), '', '', true, 0, $disable));
        $currentcomponent->addguielem($section, new gui_textbox('vmcontext', $vmcontext, _('VM Context'), _("This is the Voicemail Context which is normally set to default. Do not change unless you understand the implications."), "frm_{$display}_isVoiceMailEnabled() && isEmpty()", $msgInvalidVMContext, false, 0, $disable));
        $section = _("VmX Locater");
        $currentcomponent->addguielem($section, new gui_selectbox('vmx_state', $currentcomponent->getoptlist('vmxena'), $vmx_state, _('VmX Locater&trade;'), _("Enable/Disable the VmX Locater feature for this user. When enabled all settings are controlled by the user in the User Portal (ARI). Disabling will not delete any existing user settings but will disable access to the feature"), false, "frm_{$display}_vmx_disable_fields()", $disable), 5, 6);
        $vmxhtml = voicemail_draw_vmxgui($extdisplay, $disable);
        $vmxhtml = '<tr class="VmXLocater"><td colspan="2"><table>' . $vmxhtml . '</table></td></tr>';
        $msgValidNumber = _("Please enter a valid phone number using number digits only");
        $vmxcustom_validate = "\n\t\tdefaultEmptyOK = true;\n\t\tif (!theForm.vmx_option_0_system_default.checked && !isInteger(theForm.vmx_option_0_number.value))\n\t\t\treturn warnInvalid(theForm.vmx_option_0_number, '{$msgValidNumber}');\n\t\tif (theForm.vmx_option_1_system_default != undefined && !theForm.vmx_option_1_system_default.checked && !isInteger(theForm.vmx_option_1_number.value))\n\t\t\treturn warnInvalid(theForm.vmx_option_1_number, '{$msgValidNumber}');\n\t\tif (!isInteger(theForm.vmx_option_2_number.value))\n\t\t\treturn warnInvalid(theForm.vmx_option_2_number, '{$msgValidNumber}');\n\t\t";
        $currentcomponent->addguielem($section, new guielement('vmxcustom', $vmxhtml, "{$vmxcustom_validate}"), 6, 6);
    }
}
Example #10
0
</th>
		<th data-sortable="true"><?php 
echo _("State");
?>
</th>
		<th><?php 
echo _("Actions");
?>
</th>
	</tr>
</thead>
<tbody>
	<?php 
foreach ($daynightcodes as $row) {
    $fcc = new featurecode('daynight', 'toggle-mode-' . $row['ext']);
    $fc = $fcc->getCode();
    $dnobj = daynight_get_obj($row['ext']);
    ?>
		<tr>
			<td><?php 
    echo $fcc->getCode();
    ?>
</td>
			<td><?php 
    echo $row['dest'];
    ?>
</td>
			<td><span class="label label-<?php 
    echo $dnobj['state'] == 'DAY' ? "success" : "danger";
    ?>
"><?php