1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-19 08:52:22 +01:00
OwncloudContactsOfficial/lib/controller/backendcontroller.php
babelouest c674b8db00 code clean in js config dialog
distinction between a ldap addressbook edition and a local addressbook edition in the UI
several bug fixes
2014-04-09 13:38:09 -04:00

51 lines
1.2 KiB
PHP

<?php
/**
* @author Nicolas Mora
* @copyright 2014 Nicolas Mora (mail@babelouest.org)
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Contacts\Controller;
use OCA\Contacts\App,
OCA\Contacts\JSONResponse,
OCA\Contacts\Utils\JSONSerializer,
OCA\Contacts\Controller,
OCP\AppFramework\Http;
/**
* Controller class For Address Books
*/
class BackendController extends Controller {
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getConnectors() {
$response = new JSONResponse();
$prefix = "backend_ldap_";
$suffix = "_connector.xml";
$path = __DIR__ . "/../../formats/";
$files = scandir($path);
$formats = array();
foreach ($files as $file) {
if (!strncmp($file, $prefix, strlen($prefix)) && substr($file, - strlen($suffix)) === $suffix) {
if (file_exists($path.$file)) {
$format = simplexml_load_file ( $path.$file );
if ($format) {
if (isset($format['name'])) {
$formatId = substr($file, strlen($prefix), - strlen($suffix));
$formats[] = array('id' => $formatId, 'name' => (string)$format['name'], 'xml' => $format->asXML());
}
}
}
}
}
return $response->setData($formats);
}
}