示例#1
0
OCP\App::checkAppEnabled('contacts');
// Get active address books. This creates a default one if none exists.
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$has_contacts = count(OC_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 = OC_Contacts_App::getTypesOfProperty('IMPP');
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
$ims = OC_Contacts_App::getIMOptions();
$im_protocols = array();
foreach ($ims as $name => $values) {
    $im_protocols[$name] = $values['displayname'];
}
$categories = OC_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('', 'jquery.multiselect');
OCP\Util::addscript('', 'oc-vcategories');
OCP\Util::addscript('contacts', 'contacts');
OCP\Util::addscript('contacts', 'expanding');
示例#2
0
        if (!$value) {
            // create a method thats returns an alternative for FN.
            //$value = getOtherValue();
        }
        break;
    case 'NOTE':
        $value = str_replace('\\n', '\\n', $value);
        break;
    case 'EMAIL':
        $value = strtolower($value);
        break;
    case 'IMPP':
        if (is_null($parameters) || !isset($parameters['X-SERVICE-TYPE'])) {
            bailOut(OC_Contacts_App::$l10n->t('Missing IM parameter.'));
        }
        $impp = OC_Contacts_App::getIMOptions($parameters['X-SERVICE-TYPE']);
        if (is_null($impp)) {
            bailOut(OC_Contacts_App::$l10n->t('Unknown IM: ' . $parameters['X-SERVICE-TYPE']));
        }
        $value = $impp['protocol'] . ':' . $value;
        break;
}
if (!$value) {
    unset($vcard->children[$line]);
    $checksum = '';
} else {
    /* setting value */
    switch ($element) {
        case 'BDAY':
            // I don't use setDateTime() because that formats it as YYYYMMDD instead
            // of YYYY-MM-DD which is what the RFC recommends.