Git Product home page Git Product logo

carddav2fb's Introduction

Hi there, I'm Jens ๐Ÿ‘‹

I am a passionate computer scientist by education and an avid open source evangelist since the mid 1990s. My roots go back to development for the good old AmigaOS platform for which I was developing several different applications, e.g. YAM. Some of which you now can find here on GitHub. I do have records in algorithms design, parallel computing, embedded devices and medical imaging. Especially during the last years I am mostly working in the field of developing smart home solutions such as RaspberryMatic and other similar projects.

Feel free to file issues and pull-requests in any of the projects I maintain here. Contact me via email at [email protected] or on twitter at @MausJens. And if you use or like some of my open source contributions, please consider sponsoring it here on GitHub.

๐Ÿ† Github Profile Trophy

carddav2fb's People

Contributors

ahuemmer avatar benjaminrehn avatar carlos22 avatar charlycoste avatar corneliusweiss avatar fensterbank avatar hendrikf avatar holzhannes avatar jens-maus avatar jimjag avatar jplitza avatar mbehrle avatar p-h-a-i-l avatar pilsetnieks avatar ralf1070 avatar scrutinizer-auto-fixer avatar sercxanto avatar skyr avatar tbartelmess avatar thorbenheins avatar vaterlangen avatar wweich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carddav2fb's Issues

Wrong imageURL when config value for usb_disk is used

The config example says following:

// base path of USB storage of Fritz!Box under which the path 'FRITZ\fonpix' could be found
// '' -> use internal fritzbox storage
//$config['usb_disk'] = 'Generic-FlashDisk-01';

But in the script while setting the file path in the URL we find this line:
$person->addChild("imageURL", $this->config['fritzbox_path'] . $this->config['usb_disk'] . "FRITZ/fonpix/" . basename($photo_file));

If the usb_disk config value is used as proposed (without appending a "/"), imageURL properties like
file:///var/media/ftp/Generic-FlashDisk-01FRITZ/fonpix/Foo_f1230.jpg
are generated, which cannot work.

This should be fixed in code (I did not check if it's only an XML generation issue or if it affects also the file upload), but could break some existing configurations for users, if they appended an "/" to the config value manually.

improvement: convenient image upload โ€“ imagenumber instead of imagename

I did some minor changes, in the carddav2fb.php. This makes it easier to add a lot of images.
First create many files with a dimension of only 1x1 pixel with sequential numbers from 1.jpg to let say 1000.jpg and compress these Images. Therefore they are very small and you just upload them to your FritzBox /FRITZ/fonpix folder in some seconds.

After that just change the the following lines in carddav2fb.php.

in line 149 I added: $imgseqfname = 1;
comment the lines 200 and 201 with // infront and add these two lines after line 201:
$photo = $imgseqfname; $imgseqfname++;

That's all now you don't have to upload images manual again. The 1x1 pixel images will just be replaced by your real contact images.

silent mode for cron

Hi there,

i use the script with cron weekly. and it outputs the complete received vcards
as mail from cron. Can you please add an option that the script just
say success or error?

thanks Micha

Blank Character between First- and Lastname possible?

I changed the First- and Lastname in the Script. It works but...

Is there a possibility to make a blank character between First- and Lastname?
With a comma it works.

At this moment it looks like this: "Firstname, Lastname" but i want like this "Firstname Lastname".

My changed Line 182:
$name = $this->_concat($this->_concat($name_arr['firstname'],$name_arr['lastname']),$name_arr['additionalnames']);

photos referenced by URL are not imported

With several contacts I get following error when retrieving the contacts from the server:

PHP Warning: Illegal string offset 'value' carddav2fb.php on line 559

Now I figured out: These are the contacts where the photo on the fritzbox is empty: These contacts have a photo referenced by URL like this:

PHOTO:
 http://www.example.org/bilder/image_of_person.jpg

Would it be possible to fetch the images from the given URL and import them, too?

Changing phonebook name does not work

Hi,

changing $config['phonebook_name'] = 'Test'; in config, contacts are still added to the default phonebook.
Tested on a FritzBox 7360 SL.

Greets, ManOki

Image upload only works if user has full storage access

The script tries to upload the contact pictures to /$usbdevice/FRITZ/fonpix/.

When I create a restricted user just for this script who only has access to the fonpix folder, this folder is the root of the FTP file tree, so uploading fails because the designated upload path does not exist.
fritzuser

The script should made more intelligent in reading the available file structure. We should avoid to define more config values for this cases.

multiple config files

There should be an option to tell the script using a specific config file. So you can use it with different Fritz!Boxes, different users and different addressbooks.

For example:

php carddav2fb.php -c config0.php
php carddav2fb.php -c config1.php
php carddav2fb.php -c config2.php
...

Failed to upload images

Hi,

i'm getting the following warnings and errors while importing carddav for every contact with an image.

PHP Warning:  Invalid argument supplied for foreach() in /opt/carddav2fb/carddav2fb.php on line 724
 FTP-Upload 'First_Last_902ed.jpg'...PHP Warning:  in_array() expects parameter 2 to be array, null given in /opt/carddav2fb/carddav2fb.php on line 706
PHP Warning:  ftp_put() expects parameter 1 to be resource, boolean given in /opt/carddav2fb/carddav2fb.php on line 708
 retrying... PHP Warning:  ftp_login() expects parameter 1 to be resource, boolean given in /opt/carddav2fb/carddav2fb.php on line 713
PHP Warning:  ftp_pasv() expects parameter 1 to be resource, boolean given in /opt/carddav2fb/carddav2fb.php on line 714
PHP Warning:  ftp_put() expects parameter 1 to be resource, boolean given in /opt/carddav2fb/carddav2fb.php on line 715
 ERROR: while uploading file First_Last_902ed.jpg

my system specs are:
debian jessie, php 5.6.20, owncloud 9.0.1, fritzOS 6.30

is there an error or is this my mistake?

Greets ManOki

[Request/Question] carddav2xml without FritzBox

Is it possible to use the script without fritzbox?

I want to export my Nextcloud-adressbook to an xml-file, to use it as an remote-phonebook foy my Yealink-Ip-phone.

So, is it possible to use / modify the script to:

  • export .xml from carddav
  • upload to an ftp?

[example.xml]

<DirectoryEntry>
    <Name>Chris Wild</Name>
    <Telephone>5053</Telephone>
    <Telephone>5553</Telephone>
</DirectoryEntry>

<DirectoryEntry>
    <Name>Door Intercom</Name>
    <Telephone>sip:[email protected]</Telephone>
</DirectoryEntry>

<DirectoryEntry>
    <Name>Provu</Name>
    <Telephone>01484840048</Telephone>
</DirectoryEntry>

False image path cousing images showen randomly mixed on FritzFon

My FritzFon MT-F Firmware 01.03.67 in connection with FritzBox 7490 (UI) Firmware 06.50 seems to need file:///var/InternerSpeicher/FRITZ/fonpix/ prefix in the .xml document instead of file:///var/media/ftp/FRITZ/fonpix/ to show the images correctly.

Please note: If you look in the FritzBox the images will be shown correctly but on the phone the contacts have false images.

not working on boxes without FTP server

I tried to upload an addressbook to my 7312 at home, but it failed. Probably it will fail on all simple boxes without FTP server like 7312, 7412, 7112, 7113.
On my office box 7390 it works fine copying the pictures to the attached USB device.

$config['usb_disk'] = '';
...
PHP Warning:  ftp_close() expects parameter 1 to be resource, boolean given in /var/www/carddav2fb/carddav2fb2.php on line 474
 Uploading Phonebook XML
  ERROR: Response of initialization call /login_sid.lua in initSID was not xml-formatted.
Done.

Not Working under Windows / curl-error

Hi Guys,

when i try to use the Script under Windows i get following error.

Script is the Last commit.
I try different Version of PHP. From 5.4 up to 7.

Any Suggestion what i can make to fix?

bildschirmfoto 2016-04-07 um 14 43 51

choose one canonical repository

There are several forks of carddav2fb and it's hard to choose the best one. And it's not clear where's the best place to fill issues.

Issues while importing from posteo carddav to fritzbox 1312 (no nas/usb)

I come across several minor issues while using carddav-2-fritzbox for importing posteo addressbook to a Fritzbox 1312 (comes without USB and NAS):

Here is the output of the script and the errors and warnings:

fr@fr-HP:/etc/cron.daily$ ./import_posteo_to_fritzbox
carddav2fb.php - CardDAV to FRITZ!Box conversion tool
Copyright (c) 2012-2015 Karl Glatz, Martin Rost, Jens Maus

1 As you see, I'm running the script daily via cron. Cron writes a mail whenever there is output. Could carddav2fb get an option to run silent, that is less verbose?

Retrieving VCards from all CardDAV server(s):
 https://posteo.de:8443/addressbooks/username/default/
  116 VCards retrieved
PHP Notice:  Undefined offset: 0 in /home/fr/technix/carddav2fb/carddav2fb.php on line 189
PHP Notice:  Undefined offset: 0 in /home/fr/technix/carddav2fb/carddav2fb.php on line 194
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Notice:  Undefined offset: 0 in /home/fr/technix/carddav2fb/carddav2fb.php on line 189
PHP Notice:  Undefined offset: 0 in /home/fr/technix/carddav2fb/carddav2fb.php on line 194
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/lib/vCard-parser/vCard.php on line 320

2 Seems to be some kind of problem here? umlauts maybe?

Done.
Converting VCards to FritzBox XML format:
 VCard: Name, Vorname
  Added phone: 09999999 (home)
  Added email: [email protected] (home)
  ... repeats for each contact ...
 ...
 VCard: Name, Gr๏ฟฝne Neune
  Added phone: +999 (mobile)
PHP Warning:  Illegal string offset 'value' in /home/fr/technix/carddav2fb/carddav2fb.php on line 376

3 Seems like there are problems with Umlauts and other not-ASCII characters.

Done.
Upload data to FRITZ!Box @ fritz.box
PHP Warning:  ftp_set_option() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 444
PHP Warning:  ftp_login() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 445
PHP Warning:  ftp_pasv() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 446
PHP Warning:  ftp_nlist() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 450
PHP Warning:  ftp_mkdir() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 452
 FTP-Upload: xxx.jpg
PHP Warning:  ftp_put() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 465
  WARNING: an error occurred while uploading file xxx.jpg - retrying
PHP Warning:  ftp_login() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 470
PHP Warning:  ftp_pasv() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 471
PHP Warning:  ftp_put() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 472
  ERROR: an error occurred while uploading file xxx.jpg - giving up
  ... repeats for all images...

4 There are warnings about wrong parameters.

5 The ERROR is clear: This Fritzbox 1312 has no usb and nas. Could there be an option to disable photo uploading? Or even better that carddav2fb automatically checks if the fritzbox has NAS option in the first place?

PHP Warning:  ftp_close() expects parameter 1 to be resource, boolean given in /home/fr/technix/carddav2fb/carddav2fb.php on line 482

6 Again wrong parameter.

 Uploading Phonebook XML
  FRITZ!Box returned message: 'FRITZ!Box Telefonbuch wiederhergestellt'
Done.

Funny thing: Despite all the warnings: It works :) except that there are no photos as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.