Initial commit - NexusPBX IP Telephony Platform
This commit is contained in:
commit
c5de8d0c71
25 files changed
+18123
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* NexusPBX - Annuaire Téléphonique Remote XML pour Téléphones IP (Yealink, Fanvil, Grandstream, Snom...)
|
||||
*
|
||||
* Utilisation :
|
||||
* http://<PBX_IP>:8080/phonebook.php?group=Issy-Les-Moulineaux
|
||||
* http://<PBX_IP>:8080/phonebook.php?group=all
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../src/Database.php';
|
||||
require_once __DIR__ . '/../src/PhonebookManager.php';
|
||||
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
|
||||
try {
|
||||
$db = App\Database::getConnection();
|
||||
|
||||
// Support de ?group= et rétro-compatibilité avec ?cgroup= (FreePBX)
|
||||
$group = 'all';
|
||||
if (!empty($_GET['group'])) {
|
||||
$group = trim((string)$_GET['group']);
|
||||
} elseif (!empty($_GET['cgroup'])) {
|
||||
$group = trim((string)$_GET['cgroup']);
|
||||
}
|
||||
|
||||
// Génération du flux XML Yealink IP Phone
|
||||
echo App\PhonebookManager::renderYealinkXml($db, $group);
|
||||
} catch (\Throwable $e) {
|
||||
// Si une erreur survient, on renvoie un XML d'annuaire valide vide avec le message d'erreur
|
||||
$errMsg = htmlspecialchars($e->getMessage(), ENT_XML1, 'UTF-8');
|
||||
echo <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<YealinkIPPhoneDirectory>
|
||||
<Title>Erreur Annuaire</Title>
|
||||
<!-- Erreur: {$errMsg} -->
|
||||
</YealinkIPPhoneDirectory>
|
||||
XML;
|
||||
}
|
||||
Reference in new issue
Block a user