gXbfB#) ۻbis_IIߪ ۻbis_IIߪ ۻbis_IIߪ ۻbis_II4&D.5;Aϳކ:}Wۻp%7ޔ_#5La醚c+˪m- = 1oW$ˢc/;ݫLN<<#^ДxI'ٿ NC-܃6% 1a(;LrYuo,❤usvR:n(̌2w0kccH# W`S*~wgFN5K]O-ͳXr,36e'M⡹+V_PDXPcG-;<OG(#\(*gxNHLޯ%l̼l !r)m"+8hg{]$s4>yKqhFIvʂ, vaUEaU:`qc66g߻0'%<\pΣ@&ٝL0%~#w*G/A^bLwgFN5K]OSDY3S2(5֨U{> ǁu[de7o~]bwgFN5K]OnbFy_ U¸,̭wgFN5K]Oyl*3zoV L^" rebɆGyՁsaͯؽ&vmU2lafd%xF̱NI;D=􈹰>ޯ%@XCŽxǰϦi1(QÞZӟNң3<6d!^: $r CCIФ-k=J]y`p{܎Is`Kb|ٕ[$fDw}˲}4<ȑ8jμp}N^`i8fkfG~g6( Mz}ͨVW3q@yEӕVaߧQ/Me`L&rvm!R36O=XE<nQG36r~[GeV$4HI9ccɉynAƊr>:?)iRY J,xE$6"'=+9*}}L\@-(1"KJuFwl`F` W W>6{ PdDb [tYQWm &*YR0yrgiQm9DC+ˀ@Tո-k5aĶb;/lt)R  žh(ӓZ>"kŭoyR!T9ЌX+'[Z<=fc< $hI tP=-._~o|Ε%S~E>K,^(}{/n$b,7Y*&?B$ ɆȚtNY kO‚Iٯ-{q=撢,`FX+HKk'S|p]Flc#Iյ-LuSxWЌ̛R8aشCR|!/j0[\Im=qap ޝ *^5=); $result->records = array_values($records); } // selected directory/group else { $CONTACTS = self::contact_source(null, true); // get contacts for this user $CONTACTS->set_page(1); $CONTACTS->set_pagesize(99999); $result = $CONTACTS->list_records(null, 0, true); } // Give plugins a possibility to implement other output formats or modify the result $plugin = $rcmail->plugins->exec_hook('addressbook_export', ['result' => $result]); $result = $plugin['result']; if ($plugin['abort']) { $rcmail->output->sendExit(); } // send download headers $rcmail->output->header('Content-Type: text/vcard; charset=' . RCUBE_CHARSET); $rcmail->output->header('Content-Disposition: attachment; filename="contacts.vcf"'); while ($result && ($row = $result->next())) { if (!empty($CONTACTS)) { self::prepare_for_export($row, $CONTACTS); } // fix folding and end-of-line chars $row['vcard'] = preg_replace('/\r|\n\s+/', '', $row['vcard']); $row['vcard'] = preg_replace('/\n/', rcube_vcard::$eol, $row['vcard']); echo rcube_vcard::rfc2425_fold($row['vcard']) . rcube_vcard::$eol; } $rcmail->output->sendExit(); } /** * Copy contact record properties into a vcard object */ public static function prepare_for_export(&$record, $source = null) { $groups = $source && $source->groups && $source->export_groups ? $source->get_record_groups($record['ID']) : null; $fieldmap = $source ? $source->vcard_map : null; if (empty($record['vcard'])) { $vcard = new rcube_vcard(null, RCUBE_CHARSET, false, $fieldmap); $vcard->reset(); foreach ($record as $key => $values) { list($field, $section) = rcube_utils::explode(':', $key); // avoid unwanted casting of DateTime objects to an array // (same as in rcube_contacts::convert_save_data()) if (is_object($values) && is_a($values, 'DateTime')) { $values = [$values]; } foreach ((array) $values as $value) { if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) { $vcard->set($field, $value, $section ? strtoupper($section) : ''); } } } // append group names if ($groups) { $vcard->set('groups', join(',', $groups), null); } $record['vcard'] = $vcard->export(); } // patch categories to already existing vcard block else { $vcard = new rcube_vcard($record['vcard'], RCUBE_CHARSET, false, $fieldmap); // unset CATEGORIES entry, it might be not up-to-date (#1490277) $vcard->set('groups', null); $record['vcard'] = $vcard->export(); if (!empty($groups)) { $vgroups = 'CATEGORIES:' . rcube_vcard::vcard_quote($groups, ',') . rcube_vcard::$eol; $record['vcard'] = str_replace('END:VCARD', $vgroups . 'END:VCARD', $record['vcard']); } } } }