Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('gswave_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //verify the id is as uuid then set as a variable if (is_uuid($_GET['id'])) { $extension_uuid = $_GET['id']; } //get the extension(s) if (permission_exists('extension_edit')) { //admin user $sql = "select * from v_extensions "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and enabled = 'true' "; $sql .= "order by extension asc "; } else { //normal user $sql = "select e.* "; $sql .= "from v_extensions as e, "; $sql .= "v_extension_users as eu "; $sql .= "where e.extension_uuid = eu.extension_uuid "; $sql .= "and eu.user_uuid = :user_uuid "; $sql .= "and e.domain_uuid = :domain_uuid "; $sql .= "and e.enabled = 'true' "; $sql .= "order by e.extension asc "; $parameters['user_uuid'] = $_SESSION['user']['user_uuid']; } $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $extensions = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); if (is_uuid($extension_uuid) && is_array($extensions) && @sizeof($extensions) != 0) { //loop through get selected extension if (is_array($extensions) && @sizeof($extensions) != 0) { foreach ($extensions as $extension) { if ($extension['extension_uuid'] == $extension_uuid) { $field = $extension; break; } } } //get the username $username = $field['extension']; if (isset($field['number_alias']) && strlen($field['number_alias']) > 0) { $username = $field['number_alias']; } //build the xml $xml = ""; $xml .= ""; $xml .= ""; $xml .= "".$_SESSION['domain_name'].""; //$xml .= "".$_SESSION['domain_name'].""; //$xml .= "".$_SESSION['domain_name'].""; $xml .= "".$_SESSION['domain_name'].":".$_SESSION['provision']['line_sip_port']['numeric'].""; $xml .= "".$_SESSION['domain_name'].":".$_SESSION['provision']['line_sip_port']['numeric'].""; $xml .= "".$username.""; $xml .= "".$username.""; $xml .= "".$field['password'].""; $xml .= "".$username.""; $xml .= "".$username.""; $xml .= "{x+|*x+|*++}"; $xml .= "0"; $xml .= "*97"; $xml .= ""; $xml .= ""; } //debian //apt install qrencode //additional includes $document['title'] = $text['title-gswave']; require_once "resources/header.php"; //show the content echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['title-gswave']."\n"; //echo " "; echo "
\n"; echo "
".$text['title_description-gswave']."

\n"; echo "
\n"; //show the content echo "
\n"; echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "
\n"; //echo "
\n"; //echo "
\n"; echo " ".$text['label-extension']."\n"; echo "\n"; echo " \n"; //echo "
\n"; //echo $text['description-extension']."\n"; echo "
".$text['title-message']."

\n"; echo "
\n"; echo " "; echo " "; echo "
"; echo "
"; echo "
"; //stream the file if (is_uuid($extension_uuid)) { $include_path = get_include_path(); $xml = html_entity_decode( $xml, ENT_QUOTES, 'UTF-8' ); set_include_path ($_SERVER["PROJECT_ROOT"].'/resources/qr_code'); require_once 'QRErrorCorrectLevel.php'; require_once 'QRCode.php'; require_once 'QRCodeImage.php'; try { $code = new QRCode (- 1, QRErrorCorrectLevel::H); $code->addData($xml); $code->make(); $img = new QRCodeImage ($code, $width=420, $height=420, $quality=50); $img->draw(); $image = $img->getImage(); $img->finish(); //if ($image) { // header ( 'Content-Type: image/jpeg' ); // header ( 'Content-Length: ' . strlen ( $imgdata ) ); // echo $image; //} } catch (Exception $error) { echo $error; } } //html image if (is_uuid($extension_uuid)) { echo "\n"; } //add the footer set_include_path ($include_path); require_once "resources/footer.php"; ?>