當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FreePBX::Certman方法代碼示例

本文整理匯總了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;
    }
}
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:26,代碼來源:hook_core.php

示例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));
    }
}
開發者ID:ozererik,項目名稱:webrtc,代碼行數:34,代碼來源:hook_core.php

示例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>";
}
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:31,代碼來源:le.php

示例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>
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:31,代碼來源:chansip.page.php

示例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 != '') {
//.........這裏部分代碼省略.........
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:101,代碼來源:functions.inc.php

示例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']);
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:10,代碼來源:page.certman.php


注:本文中的FreePBX::Certman方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。