jens-maus / carddav2fb

:notebook: A command-line PHP script allowing to import CardDAV-based VCards (e.g. from 'owncloud') to a phonebook in a AVM FRITZ!Box
The Unlicense
28 stars 19 forks source link

Add Config-Option to not export contact photos. #29

Open HendrikF opened 8 years ago

HendrikF commented 8 years ago

Add option to not export contact photos

Our Fritz!Box 7270 rejects uploading images in the WebGUI with a message similar to "Upload is only supported, when external memory is plugged in". The FTP server then gives "Permission denied" when attempting to upload the images.

The commit only wraps the extraction of the photo data and the ftp upload in a new configuration option, which per default does not change behaviour.

jens-maus commented 8 years ago

First of all, thanks for your pull request. However, I do feel there must be a better/automatic solution than introducing yet another config option. during the last release cycle I already tried to implement some automatic checking if FTP-Upload is supported at all on the fritzbox carddav2fb tries to connect to. And IMHO this should also work for the 7270 device than having to tune a config option based on the device.

So IMHO it would be better to try to identify your situation (ftp server rejects due to permission denied) and then skip uploading all together than having to manually tune the config option. So can you please try to implement it in that way instead?

HendrikF commented 8 years ago

:/ I'm sorry, but I have absolutely no experience with php and ftp. Also IMO carddav2fb should not do that much automatically.

I'm fully OK, when you don't want to merge this. I would leave it in my fork.

Greetings to Dresden from Freiberg ;)

jens-maus commented 8 years ago

Ok, then I will see if I could implement this. However, to better understand what exactly needs to be changed can you pleas show some output of carddav2fb if you have it running over your 7270 fritzbox so that I can see what exactly it complains about if you use my fork.

HendrikF commented 8 years ago

Yes, I will do that, but since I am only at home at weekends, you unfortunately have to wait until Friday or Saturday.

HendrikF commented 8 years ago

Here is the error message: http://prntscr.com/bf0ktl The picture I uploaded was http://www.publicdomainpictures.net/view-image.php?image=40292&picture=silhouette-man-standing&large=1

FTP output:

hendrik@hendrik:~$ ftp 192.168.178.1
Connected to 192.168.178.1.
220 FRITZ!BoxFonWLAN7270v3 FTP server ready.
Name (192.168.178.1:hendrik): admin
331 Password required for admin.
Password:
230 User admin logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/" is current directory.
ftp> ls
200 PORT command sucessful.
150 Opening ASCII mode data connection for '/bin/ls -lgA'.
-r--r--r-- 1 ftp ftp 6640 Sep 24 2015 FRITZ-NAS.txt
-r--r--r-- 1 ftp ftp 30192 Sep 24 2015 FRITZ-Picture.jpg
-r--r--r-- 1 ftp ftp 104464 Sep 24 2015 FRITZ-Song.mp3
-r--r--r-- 1 ftp ftp 95907 Sep 24 2015 FRITZ-Video.mp4
226 Transfer complete.
ftp> mkdir test
550 test: Permission denied.
ftp> 

Permissions: http://prntscr.com/bf0myo

Output of carddav2fb: (I removed reverse dns before)

owncloud@owncloud:~/carddav2fb$ php carddav2fb.php 
carddav2fb.php 1.11 (2016-05-12) - CardDAV to FRITZ!Box phonebook conversion tool
Copyright (c) 2012-2016 Karl Glatz, Martin Rost, Jens Maus, Johannes Freiburger

Retrieving VCards from all CardDAV server(s):
 [0]: https://---:8081/remote.php/carddav/addressbooks/---/kontakte Ignoring given Vcard Extension (.vcf)
...[shortened].. 693 VCards retrieved.
Done.
Converting VCards to FritzBox XML format:
...
...
...
Done.
Upload data to FRITZ!Box @ 192.168.178.1
PHP Warning:  ftp_mkdir(): /FRITZ/fonpix: Permission denied. in /home/owncloud/carddav2fb/carddav2fb.php on line 711
 FTP-Upload '---.jpg'...PHP Warning:  ftp_put(): /FRITZ/fonpix/---.jpg: Permission denied. in /home/owncloud/carddav2fb/carddav2fb.php on line 728
 retrying... PHP Warning:  ftp_put(): /FRITZ/fonpix/---.jpg: Permission denied. in /home/owncloud/carddav2fb/carddav2fb.php on line 753
 ERROR: while uploading file ---.jpg
...
...
...
 Uploading Phonebook XML to 192.168.178.1
  ERROR: Response of initialization call /login_sid.lua in initSID was not xml-formatted.
Done.

I hope these information can help you.

holzhannes commented 6 years ago

This pull request could be closed after pull request #40 was merged, because it includes an option to disable image processing and upload.