function export($user) { global $db, $loader; $row = $db->fetch(' select * from sitellite_user where username = ?', $user); if (!$row) { $this->error = $db->error; return false; } // build vcard $loader->import('saf.Date.vCalendar'); $card = new vCal(); $card->tag = 'VCARD'; $card->addProperty('VERSION', '3.0'); $card->addProperty('PRODID', '-//Simian Systems\\, Inc//NONSGML Sitellite CMS ' . SITELLITE_VERSION . '//EN'); if (empty($row->firstname) && empty($row->lastname)) { // skip name $card->addProperty('N', $row->username); } else { $card->addProperty('N', array($row->firstname, $row->lastname)); $card->addProperty('FN', $row->firstname . ' ' . $row->lastname); } if (!empty($row->company)) { $card->addProperty('ORG', $row->company); } if (!empty($row->position)) { $title =& $card->addProperty('TITLE', $row->position); $title->addParameter('LANGUAGE', $row->lang); } if (!empty($row->email)) { $card->addProperty('EMAIL', $row->email, array('type' => 'WORK')); } if (!empty($row->phone)) { $card->addProperty('TEL', $row->phone, array('type' => 'WORK')); } if (!empty($row->cell)) { $card->addProperty('TEL', $row->cell, array('type' => 'CELL')); } if (!empty($row->fax)) { $card->addProperty('TEL', $row->fax, array('type' => 'FAX')); } if (!empty($row->home)) { $card->addProperty('TEL', $row->home, array('type' => 'HOME')); } if (!empty($row->address1)) { $card->addProperty('ADR', array('', '', $row->address1, $row->city, $row->province, $row->postal_code, $row->country), array('type' => 'HOME')); } if (!empty($row->website)) { $card->addProperty('URL', $row->website); } // write the vcard return $card->unfold($card->write()); }
<?php loader_import('siteevent.Event'); loader_import('saf.Date'); loader_import('saf.Date.vCalendar'); if (!isset($parameters['limit'])) { $parameters['limit'] = 50; } $e = new SiteEvent_Event(); $list = $e->getUpcoming($parameters['limit'], $parameters['category'], $parameters['audience']); $cal = new vCal(); $cal->addProperty('METHOD', 'PUBLISH'); $cal->addProperty('CALSCALE', 'GREGORIAN'); $cal->addProperty('PRODID', '-//SIMIAN systems//NONSGML SiteEvent//EN'); $cal->addProperty('VERSION', '2.0'); foreach (array_keys($list) as $k) { $item =& $list[$k]; $e =& $cal->addEvent('VEVENT'); $e->addProperty('UID', site_domain() . '/siteevent/' . $item->id); $e->addProperty('SEQUENCE', $k + 1); $p =& $e->addProperty('URL', 'http://' . site_domain() . site_prefix() . '/index/siteevent-details-action/id.' . $item->id . '/title.' . siteevent_filter_link_title($item->title)); $p->addParameter('VALUE', 'URI'); $e->addProperty('STATUS', 'CONFIRMED'); if ($item->time && $item->time > '00:00:00') { $e->addProperty('DTSTART', Date::timestamp($item->date . ' ' . $item->time, 'Ymd\\THis')); } else { $p =& $e->addProperty('DTSTART', Date::format($item->date, 'Ymd')); $p->addParameter('VALUE', 'DATE'); } if ($item->until_date && $item->until_date > '0000-00-00') { if ($item->until_time && $item->until_time > '00:00:00') {
<?php $user = db_single('select * from sitellite_user where username = ?', $parameters['user']); if (!$user) { die('User not found'); } loader_import('saf.Date.vCalendar'); $card = new vCal(); $card->tag = 'VCARD'; $card->addProperty('VERSION', '3.0'); $card->addProperty('FN', $user->firstname . ' ' . $user->lastname); $card->addProperty('N', array($user->lastname, $user->firstname)); if (!empty($user->company)) { $card->addProperty('ORG', $user->company); } if (!empty($user->website)) { $card->addProperty('URL', $user->website, array('TYPE' => 'WORK')); } if (!empty($user->email)) { $card->addProperty('EMAIL', $user->email, array('PREF' => 'INTERNET')); } if (!empty($user->phone)) { $card->addProperty('TEL', $user->phone, array('TYPE' => 'WORK')); } if (!empty($user->cell)) { $card->addProperty('TEL', $user->cell, array('TYPE' => 'CELL')); } if (!empty($user->home)) { $card->addProperty('TEL', $user->home, array('TYPE' => 'HOME')); } if (!empty($user->address1)) {