本文整理汇总了PHP中FreePBX::Certman方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Certman方法的具体用法?PHP FreePBX::Certman怎么用?PHP FreePBX::Certman使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreePBX
的用法示例。
在下文中一共展示了FreePBX::Certman方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: certman_devices_configprocess
function certman_devices_configprocess()
{
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$extension = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
$tech = isset($_POST['tech']) ? $_POST['tech'] : null;
switch ($action) {
case 'add':
$extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
case 'edit':
if ($_POST['dtls_enable'] == 'yes') {
$settings = array();
foreach ($_POST as $key => $value) {
if (preg_match('/^dtls_(.*)/', $key, $matches)) {
$settings[$matches[1]] = $value;
}
}
FreePBX::Certman()->addDTLSOptions($extension, $settings);
} else {
FreePBX::Certman()->removeDTLSOptions($extension);
}
break;
case 'del':
FreePBX::Certman()->removeDTLSOptions($extension);
break;
}
}
示例2: webrtc_configpageload
function webrtc_configpageload($mode)
{
global $currentcomponent;
$webrtc = FreePBX::Webrtc();
$certman = FreePBX::Certman();
$extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
$webrtc_select = $currentcomponent->getoptlist('webrtc_enable');
$webrtc_value = $webrtc->checkEnabled($extdisplay) ? 'yes' : 'no';
$mcerts = $certman->getAllManagedCertificates();
$status = $webrtc->validVersion();
$mode = $webrtc->getSocketMode();
if ($status === true) {
if (!empty($mcerts)) {
if ($mode == 'pjsip') {
$currentcomponent->addguielem('WebRTC Phone', new gui_label('webrtc_message', _('The WebSockets Interface is running through PJSIP, PJSIP is not supported at this time. Please enable the chan_sip driver (along with pjsip or by itself) or alert the FreePBX Developers')));
$currentcomponent->addguielem('Device Options', new gui_hidden('webrtc_enable', $webrtc_value));
} else {
$currentcomponent->addguielem('WebRTC Phone', new gui_selectbox('webrtc_enable', $webrtc_select, $webrtc_value, _('Enable WebRTC Old ARI Phone'), sprintf(_('Enables WebRTC for this %s in the Asterisk Recording Interface (ARI). Note: ARI is depreciated in favor of UCP'), $mode), false));
$certs = array();
foreach ($mcerts as $cert) {
$certs[] = array("text" => $cert['basename'], "value" => $cert['cid']);
}
$settings = $webrtc->getClientSettingsByUser($extdisplay);
$cert = !empty($settings['certid']) ? $settings['certid'] : '';
$currentcomponent->addguielem('WebRTC Phone', new gui_selectbox('webrtc_dtls_certificate', $certs, $cert, _('Use Certificate'), _("The Certificate to use from Certificate Manager"), false));
}
} else {
$currentcomponent->addguielem('WebRTC Phone', new gui_label('webrtc_message', sprintf(_('To utilize WebRTC in ARI you must add at least one certificate %s through Certificate Manager'), $mode)));
$currentcomponent->addguielem('Device Options', new gui_hidden('webrtc_enable', $webrtc_value));
}
} else {
$currentcomponent->addguielem('Device Options', new gui_hidden('webrtc_enable', $webrtc_value));
}
}
示例3: sprintf
<?php
if (!empty($message)) {
$messagehtml = '<div class="alert alert-' . $message['type'] . '">' . $message['message'] . '</div>';
}
$fwapi = \FreePBX::Certman()->getFirewallAPI();
$letext = sprintf(_("LetsEncrypt requires the following hosts to be permitted for inbound http access:<br /> <tt>%s</tt>"), join(", ", $fwapi->getRequiredHosts()));
// Is firewall enabled and available?
if ($fwapi->isAvailable()) {
// Are our hosts already set up?
if (!$fwapi->hostsConfigured()) {
// They're not. Add a warning and a button
$alert = "<form class='fpbx-submit' name='frm_fixfirewall' id='updatefw' method='post'>";
$alert .= "<div class='alert alert-warning'><h3>" . _("Firewall Warning") . "</h3>";
$alert .= "<p class='col-sm-12'>{$letext}</p>";
// Adding col-sm-12 fixes the padding in the alert
$alert .= "<div class='clearfix'><p class='col-sm-9'>" . _("These hosts <strong>are not configured in the System Firewall</strong>. LetsEncrypt will not be able to validate this host, and certificate issueance will fail. To automatically add these hosts, please click on the 'Update Firewall' button.") . "</p>";
$alert .= "<p class='col-sm-3'><button class='btn btn-default pull-right' type='submit' name='updatefw' value='updatefw'>" . _("Update Firewall") . "</button></p></div>";
$alert .= "</div></form>";
} else {
$alert = "<div class='alert alert-success'><h3>" . _("Firewall Validated") . "</h3>";
$alert .= "<p>{$letext}</p>";
$alert .= "<p>" . _("These entries are correctly set up in the Firewall module. However, it's possible that other external firewalls may block access. If you are having problems validating your certificate, this could be the issue.") . "</p>";
$alert .= "</div>";
}
} else {
$alert = "<div class='alert alert-info'><h3>" . _("Firewall Warning") . "</h3>";
$alert .= "<p>{$letext}</p>";
$alert .= "<p>" . _("PBX System Firewall is not in use so this can not be verified. Please manually verify inbound connectivity.") . "</p>";
$alert .= "</div>";
}
示例4: _
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="csipcalistfile"><?php
echo _("Certificate Manager");
?>
</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="csipcalistfile"></i>
</div>
<div class="col-md-9">
<select class="form-control" id="csipcalistfile" name="csipcertid">
<option value=""><?php
echo "--" . _("Select a Certificate") . "--";
?>
</option>
<?php
foreach (\FreePBX::Certman()->getAllManagedCertificates() as $cert) {
?>
<option value="<?php
echo $cert['cid'];
?>
" <?php
echo $csipcertid == $cert['cid'] ? 'selected' : '';
?>
><?php
echo $cert['basename'];
?>
</option>
<?php
}
?>
</select>
示例5: sipsettings_hookGet_config
function sipsettings_hookGet_config($engine)
{
global $core_conf;
global $ext;
// is this the best way to pass this?
switch ($engine) {
case "asterisk":
if (isset($core_conf) && is_a($core_conf, "core_conf")) {
$raw_settings = sipsettings_get(true);
/* TODO: This is example concept code
The only real conflicts are codecs (mainly cause
it will look ugly. So we should strip those but
leave the rest. If we overrite it, oh well
*/
$idx = 0;
foreach ($core_conf->_sip_general as $entry) {
switch (strtolower($entry['key'])) {
case 'allow':
case 'disallow':
unset($core_conf->_sip_general[$idx]);
break;
default:
// do nothing
}
$idx++;
}
$interim_settings = array();
foreach ($raw_settings as $var) {
switch ($var['type']) {
case SIP_NORMAL:
$interim_settings[$var['keyword']] = $var['data'];
break;
case SIP_CUSTOM:
$sip_settings[] = array($var['keyword'], $var['data']);
break;
default:
// Error should be above
}
}
unset($raw_settings);
// Add any defaults that should be in there
$def = FreePBX::Sipsettings()->getChanSipDefaults();
foreach ($def as $k => $v) {
if (!isset($interim_settings[$k]) && $v) {
$interim_settings[$k] = $v;
}
}
/* Codecs First */
$core_conf->addSipGeneral('disallow', 'all');
foreach (FreePBX::Sipsettings()->getCodecs('audio') as $codec => $enabled) {
if ($enabled != '') {
$core_conf->addSipGeneral('allow', $codec);
}
}
unset($codecs);
if ($interim_settings['videosupport'] == 'yes') {
foreach (FreePBX::Sipsettings()->getCodecs('video') as $codec => $enabled) {
if ($enabled != '') {
$core_conf->addSipGeneral('allow', $codec);
}
}
}
unset($video_codecs);
/* next figure out what we need to write out (deal with things like nat combos, etc. */
$nat_mode = $interim_settings['nat_mode'];
$jbenable = $interim_settings['jbenable'];
$foundexternip = false;
// Ensure default TLS Settings for chansip are available
if (empty($interim_settings['tlsbindport'])) {
// Note - this is TCP, not UDP.
$interim_settings['tlsbindport'] = 5061;
}
if (!empty($interim_settings['tlsbindaddr'])) {
$interim_settings['tlsbindaddr'] = $interim_settings['tlsbindaddr'] . ":" . $interim_settings['tlsbindport'];
} else {
// [::] means 'listen on all interfaces, both ipv4 and ipv6' when in sipsettings.
$interim_settings['tlsbindaddr'] = "[::]:" . $interim_settings['tlsbindport'];
}
// There is no sip setting 'tlsbindport', so make sure we remove it before writing the file.
unset($interim_settings['tlsbindport']);
foreach ($interim_settings as $key => $value) {
switch ($key) {
case 'csipcertid':
if (!empty($value) && $interim_settings['tlsenable'] == 'yes' && FreePBX::Modules()->moduleHasMethod("certman", "getDefaultCertDetails")) {
$cert = FreePBX::Certman()->getCertificateDetails($value);
if (!empty($cert['files']['crt']) && !empty($cert['files']['key'])) {
$sip_settings[] = array('tlsprivatekey', $cert['files']['key']);
$sip_settings[] = array('tlscertfile', $cert['files']['crt']);
if (isset($cert['files']['ca-bundle'])) {
$sip_settings[] = array('tlscafile', $cert['files']['ca-bundle']);
}
}
}
break;
case 'nat_mode':
break;
case 'externhost_val':
if ($nat_mode == 'externhost' && $value != '') {
//.........这里部分代码省略.........
示例6: array
<?php
// License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2014 Schmooze Com Inc.
//
$request = $_REQUEST;
$certman = FreePBX::Certman();
$message = array();
$request['action'] = !empty($request['action']) ? $request['action'] : "";
echo $certman->myShowPage($request['action']);