2012-06-25 05:41:28 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Victor Dubiniuk
|
|
|
|
* Copyright (c) 2012 Victor Dubiniuk <victor.dubiniuk@gmail.com>
|
|
|
|
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
2012-08-16 02:24:38 +04:00
|
|
|
|
2012-06-25 05:41:28 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
|
|
|
OCP\JSON::callCheck();
|
|
|
|
|
2012-08-16 02:24:38 +04:00
|
|
|
$id = intval($_POST['id']);
|
2012-06-25 05:41:28 +04:00
|
|
|
$aid = intval($_POST['aid']);
|
2012-08-16 02:24:38 +04:00
|
|
|
$isaddressbook = isset($_POST['isaddressbook']) ? true: false;
|
|
|
|
|
|
|
|
// Ownership checking
|
2012-06-25 05:41:28 +04:00
|
|
|
OC_Contacts_App::getAddressbook($aid);
|
|
|
|
try {
|
2012-08-16 02:24:38 +04:00
|
|
|
OC_Contacts_VCard::moveToAddressBook($aid, $id, $isaddressbook);
|
2012-06-25 05:41:28 +04:00
|
|
|
} catch (Exception $e) {
|
|
|
|
$msg = $e->getMessage();
|
2012-08-16 02:24:38 +04:00
|
|
|
OCP\Util::writeLog('contacts', 'Error moving contacts "'.implode(',', $id).'" to addressbook "'.$aid.'"'.$msg, OCP\Util::ERROR);
|
2012-06-25 05:41:28 +04:00
|
|
|
OC_JSON::error(array('data' => array('message' => $msg,)));
|
|
|
|
}
|
2012-08-16 02:24:38 +04:00
|
|
|
|
|
|
|
OC_JSON::success(array('data' => array('ids' => $id,)));
|