Example #1
0
Copyright Intermesh 2003
Author: Merijn Schering <*****@*****.**>
Version: 1.0 Release date: 08 July 2003

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('calendar');
require_once $GO_MODULES->class_path . 'calendar.class.inc';
require_once $GO_MODULES->class_path . 'go_ical.class.inc';
require_once $GO_CONFIG->class_path . 'phpvnconv/phpvnconv.class.inc';
$conv = new phpVnconv();
$ical = new go_ical();
if (isset($_REQUEST['calendar_id']) && ($calendar = $ical->get_calendar($_REQUEST['calendar_id']))) {
    $event = false;
    $filename = $conv->VnConv($calendar['name'] . '.ics');
} elseif (isset($_REQUEST['event_id']) && ($event = $ical->get_event($_REQUEST['event_id']))) {
    $calendar = false;
    $filename = $conv->VnConv($event['name'] . '.ics');
}
if (!isset($filename)) {
    die($strDataError);
} else {
    $browser = detect_browser();
    header('Content-Type: text/calendar');
    //header('Content-Length: '.filesize($path));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         $headings = $quote . implode($quote . $seperator . $quote, $headings) . $quote;
         echo $vnconv->VnConv($headings);
         echo $crlf;
         $ab->get_companies($_POST['addressbook_id']);
         while ($ab->next_record()) {
             $record = array($ab->f("name"), $ab->f("country"), $ab->f("state"), $ab->f("city"), $ab->f("zip"), $ab->f("address"), $ab->f("email"), $ab->f("phone"), $ab->f("fax"), $ab->f("homepage"), $ab->f("bank_no"), $ab->f('vat_no'));
             $record = $quote . implode($quote . $seperator . $quote, $record) . $quote;
             echo $vnconv->VnConv($record);
             echo $crlf;
         }
     }
     exit;
 } else {
     $addressbook = $ab->get_addressbook($addressbook_id);
     require $GO_CONFIG->class_path . "/phpvnconv/phpvnconv.class.inc";
     $vnconv = new phpVnconv();
     $vnconv->set_to("ascii");
     $browser = detect_browser();
     header("Content-type: text/x-csv");
     header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     if ($browser['name'] == 'MSIE') {
         header("Content-Disposition: inline; filename=\"" . $vnconv->vnconv($addressbook['name']) . "-" . $_POST['export_type'] . ".csv\"");
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Pragma: no-cache');
         header("Content-Disposition: attachment; filename=\"" . $vnconv->vnconv($addressbook['name']) . ".csv\"");
     }
     $vnconv->set_to($_POST['encoding'] == "none" || $_POST['encoding'] == "utf16" ? '' : $_POST['encoding']);
     $utf16 = $_POST['encoding'] == 'utf16';
     $quote = smartstrip($_POST['quote']);
Example #3
0
<form name="import" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
<input type="hidden" name="task" value="import" />
<input type="hidden" name="return_to" value="<?php 
echo $return_to;
?>
" />

<?php 
$tabtable = new tabtable('export_tab', $contacts_import, '460', '400', '120', '', true);
$tabtable->print_head();
echo '<table border="0" cellpadding="5"><tr><td>';
require_once $GO_CONFIG->class_path . "/phpvnconv/phpvnconv.class.inc";
$vnconv = new phpVnconv();
$vnconv->set_to('utf8');
$vnconv->set_from($_POST['encoding'] == "none" ? '' : $_POST['encoding']);
if ($task == 'import') {
    $contact_groups[''] = 0;
    $group_mode = isset($_POST['group_mode']) ? $_POST['group_mode'] : 'group_name';
    $group_id = isset($_POST['group_id']) ? $_POST['group_id'] : 'group_id';
    if ($group_mode == 'file') {
        $ab->get_groups($_POST['addressbook_id']);
        while ($ab->next_record()) {
            $contact_groups[$ab->f('name')] = $ab->f('id');
        }
    }
    switch ($_POST['file_type']) {
        case 'vcf':
            require_once $GO_MODULES->path . "classes/vcard.class.inc";