示例#1
0
              $a[$k]=mb_convert_encoding($v,'UTF-8','ISO-8859-1');
      }        
  }*/
switch ($_POST['format']) {
    case 'vCard':
        if (!isset($_POST['text'])) {
            $errorHandler->error('invArg', 'No text posted.', basename($_SERVER['SCRIPT_NAME']));
        }
        $vCards = explode('END:VCARD', $_POST['text']);
        $n = 0;
        foreach ($vCards as $cardText) {
            if (!strstr($cardText, 'BEGIN:VCARD')) {
                // invalid entry ... mostly just the tail
                continue;
            }
            $contact = ContactImportExport::vCardImport($cardText . "END:VCARD\n");
            if ($contact != null) {
                $n++;
            }
        }
        if ($n != 1) {
            $errorHandler->success('Imported cards: ' . $n, basename($_SERVER['SCRIPT_NAME']));
        }
        if (!isset($_POST['continue']) && $n == 1) {
            // interface (more input), card (display imported)
            $_POST['continue'] = 'contact';
        }
        break;
    case 'csv':
        // NOT FINISHED!!
        if (!isset($_POST['text'])) {