Update device_edit.php

This commit is contained in:
FusionPBX
2018-03-22 00:45:43 -06:00
committed by GitHub
parent 7b12a1ea6c
commit e08055ecc3

View File

@@ -601,6 +601,96 @@
echo "</script>";
}
//add the QR code
if (permission_exists("device_line_password") && $device_template == "grandstream/wave") {
//set the mode
if (isset($_SESSION['theme']['qr_image'])) {
if (strlen($_SESSION['theme']['qr_image']) > 0) {
$mode = '4';
}
else {
$mode = '0';
}
}
else {
$mode = '4';
}
//build the xml
$row = $device_lines[0];
$xml = "<?xml version='1.0' encoding='utf-8'?>";
$xml .= "<AccountConfig version='1'>";
$xml .= "<Account>";
$xml .= "<RegisterServer>".$row['server_address']."</RegisterServer>";
$xml .= "<OutboundServer>".$row['outbound_proxy_primary']."</OutboundServer>";
$xml .= "<SecOutboundServer>".$row['outbound_proxy_secondary']."</SecOutboundServer>";
$xml .= "<UserID>".$row['user_id']."</UserID>";
$xml .= "<AuthID>".$row['auth_id']."</AuthID>";
$xml .= "<AuthPass>".$row['password']."</AuthPass>";
$xml .= "<AccountName>".$row['user_id']."</AccountName>";
$xml .= "<DisplayName>".$row['display_name']."</DisplayName>";
$xml .= "<Dialplan>{x+|*x+|*++}</Dialplan>";
$xml .= "<RandomPort>0</RandomPort>";
$xml .= "<Voicemail>*97</Voicemail>";
$xml .= "</Account>";
$xml .= "</AccountConfig>";
//qr code generation
$_GET['type'] = "text";
$qr_vcard = true;
include "contacts_vcard.php";
echo "<input type='hidden' id='qr_vcard' value=\"".$xml."\">";
echo "<style>";
echo " #qr_code_container {";
echo " z-index: 999999; ";
echo " position: absolute; ";
echo " left: 0px; ";
echo " top: 0px; ";
echo " right: 0px; ";
echo " bottom: 0px; ";
echo " text-align: center; ";
echo " vertical-align: middle;";
echo " }";
echo " #qr_code {";
echo " display: block; ";
echo " width: 650px; ";
echo " height: 650px; ";
echo " -webkit-box-shadow: 0px 1px 20px #888; ";
echo " -moz-box-shadow: 0px 1px 20px #888; ";
echo " box-shadow: 0px 1px 20px #888;";
echo " }";
echo "</style>";
echo "<script src='".PROJECT_PATH."/resources/jquery/jquery.qrcode-0.8.0.min.js'></script>";
echo "<script language='JavaScript' type='text/javascript'>";
echo " $(document).ready(function() {";
echo " $(window).load(function() {";
echo " $('#qr_code').qrcode({ ";
echo " render: 'canvas', ";
echo " minVersion: 6, ";
echo " maxVersion: 40, ";
echo " ecLevel: 'H', ";
echo " size: 650, ";
echo " radius: 0.2, ";
echo " quiet: 6, ";
echo " background: '#fff', ";
echo " mode: ".$mode.", ";
echo " mSize: 0.2, ";
echo " mPosX: 0.5, ";
echo " mPosY: 0.5, ";
echo " image: $('#img-buffer')[0], ";
echo " text: document.getElementById('qr_vcard').value ";
echo " });";
echo " });";
echo " });";
echo "</script>";
if (isset($_SESSION['theme']['qr_image'])) {
echo "<img id='img-buffer' src='".$_SESSION["theme"]["qr_image"]["text"]."' style='display: none;'>";
}
else {
echo "<img id='img-buffer' src='".PROJECT_PATH."/themes/".$_SESSION["domain"]["template"]["name"]."/images/qr_code.png' style='display: none;'>";
}
}
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<input type='hidden' name='file_action' id='file_action' value='' />\n";
@@ -611,6 +701,9 @@
echo "</td>\n";
echo "<td align='right' valign='top'>\n";
echo " <input type='button' class='btn' id='button_back_location' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'/>\n";
if (permission_exists("device_line_password") && $device_template == "grandstream/wave") {
echo " <input type='button' class='btn' name='' alt='".$text['button-qr_code']."' onclick=\"$('#qr_code_container').fadeIn(400);\" value='".$text['button-qr_code']."'>\n";
}
echo " <input type='button' class='btn' value='".$text['button-provision']."' onclick=\"document.location.href='".PROJECT_PATH."/app/devices/cmd.php?cmd=check_sync&profile=".$sip_profile_name."&user=".$user_id."@".$server_address."&domain=".$server_address."&agent=".$device_vendor."';\">&nbsp;\n";
if (permission_exists("device_files")) {
//get the template directory