mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Added sample code for QR code generation in remote provisioning
This commit is contained in:
parent
cb7e03b68e
commit
128c3230b9
1 changed files with 25 additions and 1 deletions
|
|
@ -19,10 +19,34 @@
|
|||
*/
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Content-Type: application/xml; charset=UTF-8");
|
||||
|
||||
include_once __DIR__ . '/../misc/utilities.php';
|
||||
|
||||
if (isset($_GET['qrcode']) && $_GET['qrcode'] == 1) {
|
||||
$query = $_GET;
|
||||
$query['qrcode'] = 0;
|
||||
$query_result = http_build_query($query);
|
||||
$data = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?" . $query_result;
|
||||
|
||||
// https://github.com/tecnickcom/tc-lib-barcode GPLv3
|
||||
require __DIR__ . '/../vendor/tecnickcom/tc-lib-barcode/resources/autoload.php';
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$bobj = $barcode->getBarcodeObj(
|
||||
'QRCODE,H', // barcode type and additional comma-separated parameters
|
||||
$data, // data string to encode
|
||||
-4, // bar width (use absolute or negative value as multiplication factor)
|
||||
-4, // bar height (use absolute or negative value as multiplication factor)
|
||||
'black', // foreground color
|
||||
array(-2, -2, -2, -2) // padding (use absolute or negative values as multiplication factors)
|
||||
)->setBackgroundColor('white'); // background color
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
echo $bobj->getHtmlDiv();
|
||||
return;
|
||||
}
|
||||
|
||||
header("Content-Type: application/xml; charset=UTF-8");
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
$xml = $xml . '<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue