Exemplo n.º 1
0
<?php

require_once __DIR__ . '/bootstrap.php';
OCP\App::addNavigationEntry(array('id' => 'contacts_index', 'order' => 10, 'href' => OCP\Util::linkTo('contacts', 'index.php'), 'icon' => OCP\Util::imagePath('contacts', 'contacts.svg'), 'name' => OC_L10N::get('contacts')->t('Contacts')));
OCP\Util::addscript('contacts', 'loader');
OC_Search::registerProvider('OCA\\Contacts\\SearchProvider');
if (OCP\User::isLoggedIn()) {
    foreach (OCA\Contacts\Addressbook::all(OCP\USER::getUser()) as $addressbook) {
        OCP\Contacts::registerAddressBook(new OCA\Contacts\AddressbookProvider($addressbook['id']));
    }
}
Exemplo n.º 2
0
<?php

$tmpl = new OCP\Template('contacts', 'settings');
$tmpl->assign('addressbooks', OCA\Contacts\Addressbook::all(OCP\USER::getUser()));
$tmpl->printPage();
Exemplo n.º 3
0
">
		<input type="hidden" id="path" value="<?php 
echo $_['path'];
?>
">
		<input type="hidden" id="progresskey" value="<?php 
echo rand();
?>
">
		<p class="bold" style="text-align:center;"><?php 
echo $l->t('Please choose the addressbook');
?>
</p>
		<select style="width:100%;" id="contacts" name="contacts">
		<?php 
$contacts_options = OCA\Contacts\Addressbook::all(OCP\USER::getUser());
$contacts_options[] = array('id' => 'newaddressbook', 'displayname' => $l->t('create a new addressbook'));
echo OCP\html_select_options($contacts_options, $contacts_options[0]['id'], array('value' => 'id', 'label' => 'displayname'));
?>
		</select>
		<div id="newaddressbookform" style="display: none;">
			<input type="text" style="width: 97%;" placeholder="<?php 
echo $l->t('Name of new addressbook');
?>
" id="newaddressbook" name="newaddressbook">
		</div>
		<input type="button" value="<?php 
echo $l->t("Import");
?>
!" id="startimport">
	</div>
Exemplo n.º 4
0
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
require_once __DIR__ . '/../loghandler.php';
$categories = isset($_POST['categories']) ? $_POST['categories'] : null;
$fromobjects = isset($_POST['fromobjects']) && ($_POST['fromobjects'] === 'true' || $_POST['fromobjects'] === '1') ? true : false;
if (is_null($categories)) {
    bailOut(OCA\Contacts\App::$l10n->t('No categories selected for deletion.'));
}
debug(print_r($categories, true));
if ($fromobjects) {
    $addressbooks = OCA\Contacts\Addressbook::all(OCP\USER::getUser());
    if (count($addressbooks) == 0) {
        bailOut(OCA\Contacts\App::$l10n->t('No address books found.'));
    }
    $addressbookids = array();
    foreach ($addressbooks as $addressbook) {
        $addressbookids[] = $addressbook['id'];
    }
    $contacts = OCA\Contacts\VCard::all($addressbookids);
    if (count($contacts) == 0) {
        bailOut(OCA\Contacts\App::$l10n->t('No contacts found.'));
    }
    $cards = array();
    foreach ($contacts as $contact) {
        $cards[] = array($contact['id'], $contact['carddata']);
    }
Exemplo n.º 5
0
<?php

$tmpl = new OCP\Template('contacts', 'settings');
$tmpl->assign('addressbooks', OCA\Contacts\Addressbook::all(\OC::$server->getUserSession()->getUser()->getUId()));
$tmpl->printPage();
Exemplo n.º 6
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
require_once __DIR__ . '/../loghandler.php';
$aid = isset($_POST['aid']) ? $_POST['aid'] : null;
if (!$aid) {
    $addressbooks = OCA\Contacts\Addressbook::all(OCP\User::getUser(), true, false);
    if (count($addressbooks) === 0) {
        bailOut(OCA\Contacts\App::$l10n->t('You have no addressbooks.'));
    } else {
        $aid = $addressbooks[0]['id'];
    }
}
$isnew = isset($_POST['isnew']) ? $_POST['isnew'] : false;
$vcard = Sabre\VObject\Component::create('VCARD');
$uid = substr(md5(rand() . time()), 0, 10);
$vcard->add('UID', $uid);
$id = null;
try {
    $id = OCA\Contacts\VCard::add($aid, $vcard, null, $isnew);
} catch (Exception $e) {
    bailOut($e->getMessage());