<?php /** * Copyright (c) 2011 Thomas Tanghus <*****@*****.**> * 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'); $id = $_GET['id']; $checksum = isset($_GET['checksum']) ? $_GET['checksum'] : ''; $vcard = OCA\Contacts\App::getContactVCard($id); $adr_types = OCA\Contacts\App::getTypesOfProperty('ADR'); $tmpl = new OCP\Template("contacts", "part.edit_address_dialog"); if ($checksum) { $line = OCA\Contacts\App::getPropertyLineByChecksum($vcard, $checksum); $element = $vcard->children[$line]; $adr = OCA\Contacts\VCard::structureProperty($element); $types = array(); if (isset($adr['parameters']['TYPE'])) { if (is_array($adr['parameters']['TYPE'])) { $types = array_map('htmlspecialchars', $adr['parameters']['TYPE']); $types = array_map('strtoupper', $types); } else { $types = array(strtoupper(htmlspecialchars($adr['parameters']['TYPE']))); } } $tmpl->assign('types', $types, false); $adr = array_map('htmlspecialchars', $adr['value']); $tmpl->assign('adr', $adr, false);
OCP\App::checkAppEnabled('contacts'); // Get active address books. This creates a default one if none exists. $ids = OCA\Contacts\Addressbook::activeIds(OCP\USER::getUser()); $has_contacts = count(OCA\Contacts\VCard::all($ids, 0, 1)) > 0 ? true : false; // just to check if there are any contacts. if ($has_contacts === false) { OCP\Util::writeLog('contacts', 'index.html: No contacts found.', OCP\Util::DEBUG); } // Load the files we need OCP\App::setActiveNavigationEntry('contacts_index'); // Load a specific user? $id = isset($_GET['id']) ? $_GET['id'] : null; $impp_types = OCA\Contacts\App::getTypesOfProperty('IMPP'); $adr_types = OCA\Contacts\App::getTypesOfProperty('ADR'); $phone_types = OCA\Contacts\App::getTypesOfProperty('TEL'); $email_types = OCA\Contacts\App::getTypesOfProperty('EMAIL'); $ims = OCA\Contacts\App::getIMOptions(); $im_protocols = array(); foreach ($ims as $name => $values) { $im_protocols[$name] = $values['displayname']; } $categories = OCA\Contacts\App::getCategories(); $upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize')); $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size')); $maxUploadFilesize = min($upload_max_filesize, $post_max_size); $freeSpace = OC_Filesystem::free_space('/'); $freeSpace = max($freeSpace, 0); $maxUploadFilesize = min($maxUploadFilesize, $freeSpace); OCP\Util::addscript('contacts', 'multiselect'); OCP\Util::addscript('', 'oc-vcategories'); OCP\Util::addscript('contacts', 'app');