mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-18 07:52:21 +01:00
clean code
This commit is contained in:
parent
e81af2fce4
commit
57211530f8
@ -434,8 +434,7 @@ abstract class AbstractBackend {
|
||||
*/
|
||||
public function getPreferences($addressBookId) {
|
||||
|
||||
$key = $this->combinedKey($addressBookId);
|
||||
$key = 'prefs_' . $key;
|
||||
$key = 'prefs_' . $this->combinedKey($addressBookId);
|
||||
|
||||
$data = \OCP\Config::getUserValue($this->userid, 'contacts', $key, false);
|
||||
return $data ? json_decode($data, true) : array();
|
||||
@ -448,8 +447,7 @@ abstract class AbstractBackend {
|
||||
* @return boolean
|
||||
*/
|
||||
public function setPreferences($addressbookid, array $params) {
|
||||
$key = $this->combinedKey($addressbookid);
|
||||
$key = 'prefs_' . $key;
|
||||
$key = 'prefs_' . $this->combinedKey($addressbookid);
|
||||
|
||||
$data = json_encode($params);
|
||||
return $data
|
||||
|
@ -359,34 +359,5 @@ class AddressBookController extends Controller {
|
||||
return $response->setParams($serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function getLdapConnectors() {
|
||||
$params = $this->request->urlParams;
|
||||
//$targetInfo = $this->request->post['target'];
|
||||
|
||||
$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[$formatId] = array('id' => $formatId, 'name' => (string)$format['name'], 'xml' => $format->asXML());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $response->setData($formats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,6 @@ class BackendController extends Controller {
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function getLdapConnectors() {
|
||||
$params = $this->request->urlParams;
|
||||
//$targetInfo = $this->request->post['target'];
|
||||
|
||||
$response = new JSONResponse();
|
||||
$prefix = "backend_ldap_";
|
||||
$suffix = "_connector.xml";
|
||||
|
Loading…
x
Reference in New Issue
Block a user