Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
c463546
Initial commit
andig Nov 17, 2017
4eb6f61
Minor
andig Nov 17, 2017
1ee143c
Fix command not found
andig Nov 18, 2017
00294a1
Better version constraints
andig Nov 18, 2017
2990055
Remove fiel artefact
andig Nov 18, 2017
6972ccf
Make executable
andig Nov 18, 2017
1f44b8a
Fix run command
andig Nov 18, 2017
c13468d
Refactor
andig Nov 18, 2017
2674dc0
Refactor dependencies and conversions
andig Nov 18, 2017
549e899
Updated
andig Nov 18, 2017
afdd8a0
Allow specifying config file
andig Nov 19, 2017
882c3f0
Add group mapping
andig Nov 19, 2017
af1af53
Add vip marker
andig Nov 19, 2017
4f81252
Added excluding by category
andig Nov 19, 2017
c3d0720
Fixed conversion config not used
andig Nov 21, 2017
a305ff3
Added highlevel logging
andig Nov 21, 2017
76b2a38
Minor
andig Nov 21, 2017
bbafac4
Fix counting
andig Nov 24, 2017
f187286
Refactored code and config options
andig Nov 24, 2017
0899501
Preparations for launch
blacksenator Nov 24, 2017
8c486a7
Merge pull request #11 from BlackSenator/patch-1
andig Nov 24, 2017
aa6b430
Fix function name
andig Nov 26, 2017
5f703cf
Merge branch 'master' of https://github.com/andig/carddav2fb
andig Nov 26, 2017
b4c0c70
Refactor upload function
andig Nov 27, 2017
6d29520
Add download progress indicator
andig Nov 27, 2017
a662499
Simplify and speed-up download
andig Nov 27, 2017
091b1b1
Add editorconfig
andig Nov 27, 2017
7b31e1c
PSR2 coding style
andig Nov 27, 2017
790fa93
More cleanup
andig Nov 27, 2017
af4bc4c
More cleanup
andig Nov 27, 2017
6a5b091
Fix setAuth
andig Nov 27, 2017
eb690d3
Fix filtering
andig Nov 28, 2017
056ffe1
Fix vip filter
andig Nov 29, 2017
ec73c02
wip
andig Nov 28, 2017
0023e5c
Major refactor
andig Nov 29, 2017
2174760
Remove object typehint
andig Nov 30, 2017
7f61b36
Add include filter
andig Dec 5, 2017
0323aa5
Add matching of array attributes
andig Dec 6, 2017
bc4f09c
Fix json option does not exist
andig Dec 10, 2017
5a07bd1
Added comments
andig Dec 11, 2017
c0a735d
Diverse Korrekturen: Gliederung/Rechtschreibung
blacksenator Dec 14, 2017
d48c728
Polishing
blacksenator Dec 14, 2017
512f54f
Serving suggestion
blacksenator Dec 14, 2017
79005ab
Merge pull request #23 from BlackSenator/patch-3
andig Dec 14, 2017
cb463ca
Update README.md
andig Dec 14, 2017
a77e5a6
Merge pull request #28 from BlackSenator/patch-8
andig Dec 14, 2017
c0e5326
Change default phone formatting
andig Dec 14, 2017
8f9daa2
Support nick names (#35)
blacksenator Jan 16, 2018
330b178
Allow reading multiple sources (#34)
blacksenator Jan 25, 2018
795c3be
[carddav2fb] update of README.MD (#44)
Stefan300381 Apr 12, 2018
756f49e
Validate reading intermediate files (#46)
andig Apr 14, 2018
c8650a7
Add digest authentication (#56)
andig Sep 12, 2018
5ab0057
Fix undefined property (#58)
Sep 17, 2018
b510882
Update README.md (#62)
BFallert Dec 8, 2018
894d174
deletes semicolons that sometimes appear at the end of "ORG:" names (…
blacksenator Dec 11, 2018
f9ce4da
Add image upload (#59)
blacksenator Dec 19, 2018
4e2a913
Update copyright (#65)
blacksenator Dec 19, 2018
8434a99
Image upload documentation (#67)
blacksenator Dec 26, 2018
0d42c55
Image upload error handling (#68)
blacksenator Dec 26, 2018
1cc2e93
Implements the assignment of quick dial and vanity numbers (#70)
blacksenator Dec 30, 2018
1a2131a
Handler contacts with >9 numbers (#71)
blacksenator Jan 5, 2019
dbb834b
Allow correct filtering even if multiple servers share the same group…
derwok Jan 5, 2019
41c15a0
Various cleanups (#79)
andig Jan 5, 2019
da6c84a
Improve Image Upload (#76)
derwok Jan 5, 2019
d7bea0c
Sort phone numbers by configurable type (#80)
blacksenator Jan 6, 2019
80d6f75
Looks nicer with a LF (#83)
blacksenator Jan 7, 2019
d64492d
Apply php-cs-fixer
andig Jan 8, 2019
42714bf
Update license holders
andig Jan 8, 2019
84c1f42
Force Fritz!Fon image refresh of changed/updated images (#85)
derwok Jan 8, 2019
d7da031
Perform early check if image upload may be possible. Fixes #82 (#86)
derwok Jan 9, 2019
903c357
If ftp_nlist returns false, we now interpret this as empty dir and co…
derwok Jan 12, 2019
ab291da
Show warning on console if more than 150 images on FritzBox. Fixes #9…
derwok Jan 12, 2019
3c3730d
Clean up quote backslashes before some special chars (#91)
derwok Jan 12, 2019
4969295
Simplify file upload
andig Jan 14, 2019
9666521
Ensure base url formatted without trailing /
andig Jan 14, 2019
d3f7730
Use new postFile function
andig Jan 21, 2019
142656e
Merge pull request #96 from andig/api
andig Jan 21, 2019
efe1954
Warn about dslf-conf user (#95)
blacksenator Jan 21, 2019
729ed75
Do not uploads contacts without a phone number (#102)
blacksenator Jan 21, 2019
9ec65a2
Cleanup function names
andig Jan 25, 2019
61e25d8
Rewrite HTTP client handling (#103)
andig Jan 28, 2019
23e2b57
Fix login not public
andig Jan 28, 2019
ddc8fc4
Tweak ftp connection
andig Jan 28, 2019
09a7ae8
Tweak ftp connection (#104)
andig Jan 28, 2019
1a80858
Setup CI (#105)
andig Jan 28, 2019
8e74117
Fix validation errors
andig Jan 28, 2019
49488be
Fix validation errors
andig Jan 28, 2019
4c38db1
Fix refactoring errors
andig Jan 29, 2019
2f97f58
Further simplify converter code
andig Jan 29, 2019
e430a6d
ftp: use passive mode (#109)
mtdcr Jan 31, 2019
30fab4f
Fix contacts download empty
andig Feb 5, 2019
7052430
Align extension handling with url path trimming
andig Feb 5, 2019
22c4512
Revert 70524306d780422ce9e59354ca535d0b8542b2e7
andig Feb 6, 2019
46cae0e
Cache http client (#116)
andig Feb 8, 2019
3ce70ea
Update README.md
andig Feb 10, 2019
d765ed7
Handle contacts with >9 phone numbers (#117)
andig Feb 13, 2019
a0e470d
Add unit tests (#121)
andig Feb 14, 2019
bd850eb
Update README.md
andig Feb 14, 2019
05fca26
typo (#125)
mokkin Mar 10, 2019
8511ffc
Gracefully handle failed card downloads (#127)
andig Mar 22, 2019
15728e5
Use REPORT instead of GET for card retrieval
andig Mar 24, 2019
5fa7246
Preserve quickdial and vanity attributes from fritzbox (#120)
derwok Mar 24, 2019
6a9be5e
Properly strip xml namespaces
andig Mar 26, 2019
6592153
Ignore http 404 reponse from REPORT request on empty address book
andig Mar 26, 2019
6a5c6c7
Add debug option (#131)
mokkin Mar 27, 2019
9cdee19
Merge pull request #129 from andig/report
andig Mar 27, 2019
1099110
Correct totals count (#132)
blacksenator Apr 1, 2019
b730a22
Refactor ftp connection (#134)
blacksenator Apr 1, 2019
0c0bebf
Upload quickdials as background image to Fritz!Fon (#136)
blacksenator Apr 13, 2019
bb6a74a
Update docs and minor cleanup (#137)
andig Apr 13, 2019
ec71e09
Fix font usage (#139)
blacksenator Apr 17, 2019
96a08f9
Add Dockerfile and Docker entrypoint with cron functionality (#141)
Skyr May 12, 2019
9d37764
Publish docker image
andig May 12, 2019
382e0c3
Use deploy hook
andig May 12, 2019
189c9d5
Make button "1" reserved for answering machine (#140)
blacksenator May 12, 2019
f0db75d
Add docker tag
andig May 14, 2019
a9576b1
Fix path to assets (#143)
blacksenator May 16, 2019
0ce0ccf
Use Sabre for parsing (#150)
andig Aug 15, 2019
8c92831
Use vendored phpunit
andig Aug 22, 2019
a1c674c
Update symfony/console requirement from ^3.0 to ^4.3 (#153)
dependabot-preview[bot] Aug 22, 2019
7d055fc
Add vcf import/export (#155)
blacksenator Sep 18, 2019
564691a
Persist quickdial and vanity numbers on Fritz!Box internal memory (#151)
blacksenator Sep 22, 2019
658c528
Support PNG images (#157)
blacksenator Oct 3, 2019
fc7434b
Make executable again
andig Oct 18, 2019
01d7153
Make local files a command line instead of config option
andig Oct 21, 2019
229c8aa
Remove duplicate code
andig Oct 21, 2019
87f3d02
Minor wording change
andig Oct 21, 2019
0c5b8f6
Fix corruption of CDATA sections (#163)
andig Oct 21, 2019
de9c6e9
Merge pull request #162 from andig/local
andig Oct 21, 2019
60af7b4
Upgrade alpine and add ext-xmlreader (#164)
andig Oct 21, 2019
6be7fdc
Add missing ftp functions
andig Oct 22, 2019
c39cb32
Support english success message
andig Oct 23, 2019
2a252bc
Fix logic
andig Oct 23, 2019
18e472d
Fix variable name
andig Oct 23, 2019
0f6a0f9
Use correct property name for organisation
andig Oct 23, 2019
15a7b1a
Skip fb-generated identifiers (#169)
blacksenator Nov 6, 2019
df00238
Support base64 embedded data in CardDAV 3.0 PHOTO URI attribute (#172)
blacksenator Nov 10, 2019
8d51e70
Allow Symfony 5 (#171)
andig Nov 10, 2019
c2f225d
Allow differing names for quickdials in background image (#174)
blacksenator Nov 17, 2019
733cdba
Ignore annyoing SSL warning (#175)
andig Nov 28, 2019
db70bee
Use numeric return code for Symfony 5 (#176)
andig Nov 28, 2019
9ddb3ec
fix typo fac -> fax (#182)
zero-24 Nov 30, 2019
caa5b45
Ignore groups for enrichment (#177)
blacksenator Dec 1, 2019
d00ad47
Remove dead code for image upload (#178)
blacksenator Dec 1, 2019
827e85f
Fix warning in background image upload (#180)
blacksenator Dec 3, 2019
492ba2d
Add Symfony 5 return values (#183)
andig Dec 3, 2019
b497530
Add Symfony 5 return values (#184)
blacksenator Dec 4, 2019
d0fe8e0
Send xml content-type header on request (#187)
develth Jan 9, 2020
73aae0c
Handle default phonebook entries correctly (#195)
blacksenator Feb 11, 2020
a52658f
Allow deactivating ftp (#197)
blacksenator Apr 6, 2020
2537ba7
Accept image/jpeg as a mime type (#201)
blacksenator Apr 13, 2020
12ad040
Configurable query method to support different CardDav servers (#205)
blacksenator May 13, 2020
1f9acf0
Fix convert command (#207)
blacksenator May 29, 2020
fbc1539
Split vcard conversion and improve reusability (#210)
blacksenator Jun 2, 2020
b3a99f5
Upgrade image and add php-gd (#212)
andig Jun 10, 2020
541dbf9
Update README.md
andig Jun 10, 2020
36f5a8d
Upgrade php to 7.3
andig Jun 10, 2020
0ec68d4
Drop matrix setting
andig Jun 10, 2020
f386954
Fix compatibility with phpstan ^0.12.28
andig Jun 10, 2020
6f6932a
Update guzzlehttp/guzzle requirement from ^6.0 to ^7.0 (#215)
dependabot-preview[bot] Jun 29, 2020
3c9ca92
Add PHP8 support (#219)
andig Dec 19, 2020
734574c
Fix test signatures (#221)
andig Dec 19, 2020
4c26ee4
Close #222
blacksenator Dec 27, 2020
733285e
Merge pull request #223 from blacksenator/Ampersand_in_email_adresses
andig Dec 27, 2020
7e8113c
Update of the information about the PHP version
blacksenator Dec 28, 2020
238ddc1
Fixing VIP attribute examples in config.example.php
blacksenator Apr 10, 2021
d2e5929
Merge pull request #228 from blacksenator/config_vip_debug
andig Apr 12, 2021
a1614f8
Merge pull request #224 from blacksenator/update_readme
andig Apr 12, 2021
ce4857c
Validate that X-ADDRESSBOOKSERVER-KIND and -MEMBER are present (#231)
blacksenator May 31, 2021
84abce2
Fix multipart image transfer (#232)
blacksenator Aug 30, 2021
d0451d7
fix for large contact lists (#240)
linuzer Mar 17, 2022
dc87303
Minor changes in config.example.php and README.md (#243)
blacksenator Apr 1, 2022
373167e
refactoring Converter.php (#244)
blacksenator Jun 5, 2022
b52a035
Bug fix restoring internal numbers in contacts including external num…
blacksenator Feb 12, 2024
71d48db
Updating to recent PHP Version (#250)
blacksenator Mar 1, 2025
24921dd
cleanup deprecated PHP commands (#251)
blacksenator Mar 2, 2025
499e991
fixing that for internal phone numbers, possibly assigned quickdial a…
blacksenator Mar 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
composer.lock
config.cron
config.php
vendor/
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/

root = true

[*.php]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
/composer.lock
/config.php
/cards.xml
/vendor/
php-cs-fixer.config
config.cron
cache
/carddav2fb.wiki
/workbench/google.php
/workbench/liz.php
/workbench/request_b.php
/workbench/request_m.php
/workbench/t-online.php
/workbench/test.php
/workbench/test1.php
/workbench/wolf_cfg.php
/.vscode/launch.json
14 changes: 14 additions & 0 deletions .php_cs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('src')
;

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder)
->setUsingCache(false)
;
56 changes: 56 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
sudo: false

language: php

php:
- "7.3"

cache:
directories:
- $HOME/.composer/cache

env:
global:
- secure: "Ef6Z9viGwbt8crRkwdjqfg3/xBwTvALrLBfTJJGsbYNbOq7g8amL6EMdlaUhjqLnQT+sHELtQIScpOp7XuVzt5t6yMbYh4zPBJ1MCjY1Fav859X44g42Ba8TzM3jlDSe95n2tq3kM9ExfIhBHIPwjn/Yfy32zhIFXmuDVbQKC4xW0/uD63kvnqA7H74/atNeyVTZu+ZrN05v9kRceLkb98QN2K/EOYZZcLikJDX98afVqI6IdQCjnpOlZ9DoSlODZ11xVPwdfo9wnlrf4RDhYR8MBOGGffQNigc2lIfHEwjOqh65+59TrL5YkdFtuti9dyKNXqvLK3SSUTjMsf1eQnpDoMuN1nS5kOTvPh0QpxrfotspuaUO5/hq2fmO/guvYFVVlShRrNYlMbVokzvk2NW5lohp8kENzntTyNRo+bmgP/GSM5a1Mg0uvpAMAirOUEWZUEatdJLsnokULv8Q8WlC5G59H5zdmzXeLNOh1LMWDUSFrn2M+JDkM8kmK34R6CRpSsxB1c+fJT711EDTl363TAqMvSrvlNgpyMXiNDmSjPIjfjD1sNsO7MkDrLjRj9nUxIaSRMmzW0MKr+Z/R/SCa2+ujY0o/pVZF8hr2UA0VWnji+b5RAiFwEKD5HM9RfeMe2O9rbdlas6I9pO38HOhli43bvvYVeqNq2evOoQ="
- secure: "ZN/wGrHvtcl01q6DUBlcvZZ49szNGgYbk8E4DZcc2T8dkNPITumnxhdYU+HoSFvvQm0w3KAIRTRj67EJxeHrKrxpnyJKtl03+iDcdVABP3rLFBy+9PHVgQ4oPEZ9qVqTdRP/z44CwjjR/NNXnSUTNtCIPjW5hnN4eM2YcugxQy8vTr8bwRoFkTrGDSgQhszg+bsjRan0PchJPnWmXnkqYR+lrHUIWcBr73/nwysdZQAX4BK9iUkETwJMNgw3Lgm4Q8QB8eNKoewZKnkjaJ+ykxudOtjXidRl7GxJpyUR6BzI2R6ba0Yf1B8lE+Fk/XuO9qFbZ/qu1Wv6F4AXuSiXcpmI/SVySj7+BN+Jha7Mbz9m2PRp4FXvRW4HxUNPJ168J+pWbzivpMSJ31Nt8MaxGtXedkVX1+j0g6p4hBueulRldJRKkifSFRqPq0z56KrFuSd9FHcpYEjile+wElutM2Fjw8+5QkP4kmaJd/zxHCE1P8tri3sljuWyl1yhKR2V87pY99hCtUp8H48pXBatUYK2pNOJho0f+rtwQIGjcQDAL96EVLXvNS4AW8tLZyUZC9hduSVrbPSxtHNdi8EDX/HJRifLI3sSMGW9ct3Tj5MfPo0MHc3okFh7nHCiCCQQGYEi8mWlLpm7DDgm6YXZo8h5UcOJcMbKAdh/IMm6oLQ="

notifications:
email:
on_success: never
on_failure: change

jobs:
include:
- stage: Test
install:
- composer install
script:
- vendor/bin/phpunit
- # parallel
install:
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- composer require --dev "phpstan/phpstan"
script:
- ./vendor/bin/phpstan analyze --level=5 --no-progress src
- # parallel
install:
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- composer require --dev "friendsofphp/php-cs-fixer:^2.8"
script:
- IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS
- ./vendor/bin/php-cs-fixer fix --config=.php_cs.php -v --dry-run --diff --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"
- stage: Deploy
install: skip
script: skip
before_deploy:
- |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker pull ${TRAVIS_REPO_SLUG}:latest
deploy:
- provider: script
on:
branch: master
script: >
bash -c "set -xe &&
docker build --cache-from ${TRAVIS_REPO_SLUG}:latest -t ${TRAVIS_REPO_SLUG}:latest . &&
docker push ${TRAVIS_REPO_SLUG}:latest"
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM alpine:3.12
LABEL description="Download CardDAV VCards and upload as phonebook to AVM FRITZ!Box"

VOLUME [ "/data" ]

# Install dependencies for carddav2fb
RUN set -xe && \
apk update && apk upgrade && \
apk add --no-cache --virtual=run-deps \
php7-cli \
php7-curl \
php7-dom \
php7-ftp \
php7-gd \
php7-mbstring \
php7-simplexml \
php7-tokenizer \
php7-xml \
php7-xmlreader \
php7-xmlwriter \
composer && \
apk del --progress --purge && \
rm -rf /var/cache/apk/*

# Copy carddav2fb and install php dependencies
COPY . /srv
RUN mkdir -p /data && \
cd /srv && \
composer install --no-dev && \
chmod +x /srv/carddav2fb /srv/docker-entrypoint && \
ln -s /data/config.php .

ENTRYPOINT [ "/srv/docker-entrypoint" ]
160 changes: 92 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,124 @@
# CardDAV contacts import for AVM FRITZ!Box

[![Build Status](https://scrutinizer-ci.com/g/jens-maus/carddav2fb/badges/build.png?b=master)](https://scrutinizer-ci.com/g/jens-maus/carddav2fb/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jens-maus/carddav2fb/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jens-maus/carddav2fb/?branch=master)
[![Build Status](https://travis-ci.org/andig/carddav2fb.svg?branch=master)](https://travis-ci.org/andig/carddav2fb) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BB3W3WH7GVSNW)

Features:
This is a completely revised version of [https://github.com/jens-maus/carddav2fb][descent].

* Allows to import CardDAV-based VCard contacts (e.g. from 'owncloud') to a phonebook in a AVM FRITZ!Box
* CardDAV import includes photo images specified in VCards
* No modification of FRITZ!Box firmware (aka FRITZ!OS) required
* Definition of multiple CardDAV accounts and "folders" possible
* Format of full name in FRITZ!Box phonebook can be designed
## Features

**CAUTION: This script will overwrite your current contacts in the FritzBox without any warning!**
* download from any number of CardDAV servers
* read from any local *.vcf files (optional)
* selection (include/exclude) by categories or groups (e.g. iCloud)
* upload of contact pictures to display them on the FRITZ!Fon (handling see below)
* automatically preserves quickDial and vanity attributes of phone numbers set in FRITZ!Box Web GUI. Works without config.
* automatically preserves internal numbers (e.g. if you use [Gruppenruf](https://avm.de/service/fritzbox/fritzbox-7590/wissensdatenbank/publication/show/1148_Interne-Rufgruppe-in-FRITZ-Box-einrichten-Gruppenruf/))
* if more than nine phone numbers are included, the contact will be divided into a corresponding number of phonebook entries (any existing email addresses are assigned to the first set [there is no quantity limit!])
* phone numbers are sorted by type. The order of the conversion values ('phoneTypes') determines the order in the phone book entry
* the contact's UID of the CardDAV server is added to the phonebook entry (not visible in the FRITZ! Box GUI)
* automatically preserves QuickDial and Vanity attributes of phone numbers set in FRITZ!Box Web GUI. Works without config. These data are saved separately in the internal FRITZ!Box memory under `../FRITZ/mediabox/Atrributes.csv` from loss.
* generates an image with keypad and designated quickdial numbers (2-9), which can be uploaded to designated handhelds (see details below)

## Information
## Requirements

This version of carddav2fb is a forked version from carlos22 (https://github.com/carlos22/carddav2fb) and adding support for convenient image upload, different FRITZ!Box base paths (for example for FRITZ!Box 7490 (UI) OS: 6.50) and full name design support.
* PHP 8.2 or higher (`apt-get install php php-curl php-mbstring php-xml`)
* [Composer][composer]

## Installation

## Requirements
Install requirements

* PHP-version 5.3.6 or higher
* PHP-curl module
* PHP-ftp module
* PHP-mbstring module
```console
git clone https://github.com/andig/carddav2fb.git
cd carddav2fb
composer install --no-dev
```

## Installation
edit `config.example.php` and save as `config.php`

Checkout the carddav2fb sources including its related subprojects using the following command:
## Usage

git clone https://github.com/jens-maus/carddav2fb.git
### List all commands

Now you should have everything setup and checked out to a 'carddav2fb' directory.
```console
./carddav2fb list
```

### Configuration
1. Make sure you have `System -> FRITZ!Box-Users -> Login via Username+Password` in your FRITZ!Box activated.
2. Make sure you have a separate user created under `System -> FRITZ!Box-Users` for which the following access rights have been granted:
* `FRITZ!Box settings` (required to upload telephone book data)
* `Access to NAS content` (required to upload photos via ftp).
3. Make sure the telephone book you are going to update via carddav2fb exists on the FRITZ!Box, otherwise the upload will fail.
4. Copy `config.example.php` to `config.php` and adapt it to your needs including setting the FRITZ!Box user settings.
### Complete processing

## Usage
```console
./carddav2fb run
```

### Get help for a command

```console
./carddav2fb run -h
```

#### Preconditions

### Ubuntu
* memory (USB stick) is indexed [Heimnetz -> Speicher (NAS) -> Speicher an der FRITZ!Box]
* ftp access is active [Heimnetz -> Speicher (NAS) -> Heimnetzfreigabe]
* you use an standalone user (NOT! dslf-config) which has explicit permissions for FRITZ!Box settings, access to NAS content and read/write permission to all available memory [System -> FRITZ!Box-Benutzer -> [user] -> Berechtigungen]

1. Install PHP, PHP-curl, PHP-ftp, PHP-mbstring and php-xml module:
### Upload FRITZ!Fon background image

sudo apt-get install php-cli php-curl php-ftp php-mbstring php-xml
<img align="right" src="assets/fritzfon.png"/>

2. Open a Terminal and execute:
Using the `background-image` command it is possible to upload the quickdial numbers as background image to FRITZ!Fon (nothing else!)

php carddav2fb.php
```console
./carddav2fb background-image
```

### Windows
Uploading can also be included in uploading phonebook:

1. Download PHP from [php.net](http://windows.php.net/download/). Extract it to `C:\PHP`.
2. Start -> cmd. Run `C:\PHP\php.exe C:\path\to\carddav2fb\carddav2fb.php`
```console
./carddav2fb run -i
```

## config.php Example (owncloud)
#### Image upload preconditions

$config['fritzbox_ip'] = 'fritz.box';
$config['fritzbox_user'] = '<USERNAME>';
$config['fritzbox_pw'] = '<PASSWORD>';
$config['phonebook_number'] = '0';
$config['phonebook_name'] = 'Telefonbuch';
$config['fritzbox_path'] = 'file:///var/media/ftp/';
* requires FRITZ!Fon C4 or C5 handhelds
* settings in FRITZ!Fon: Einstellungen -> Anzeige -> Startbildschirme -> Klassisch -> Optionen -> Hintergrundbild
* assignment is made via the internal number(s) of the handheld(s) in the 'fritzfons'-array in config.php
* internal number have to be between '610' and '615', no '**'-prefix

// full name format options default 0
// parts in '' will only added if existing and switched to true in config
// 0 = 'Prefix' Lastname, Firstname, 'Additional Names', 'Suffix', 'orgname'
// 1 = 'Prefix' Firstname Lastname 'AdditionalNames' 'Suffix' '(orgname)'
// 2 = 'Prefix' Firstname 'AdditionalNames' Lastname 'Suffix' '(orgname)'
$config['fullname_format'] = 0;
## Debugging

// fullname parts
$config['prefix'] = false; // include prefix in fullname if existing
$config['suffix'] = false; // include suffix in fullname if existing
$config['addnames'] = false; // include additionalnames in fullname if existing
$config['orgname'] = false; // include organisation (company) in fullname if existing

$config['quickdial_keyword'] = 'Quickdial:'; // once activated you may add 'Quickdial:+49030123456:**709' to the contact note field and the number will be set as quickdialnumber in your FRITZ!Box. It is possible to add more quickdials for one contact each in a new line
For debugging please set your config.php to

// first
$config['carddav'][0] = array(
'url' => 'https://<HOSTNAME>/remote.php/carddav/addressbooks/<USERNAME>/contacts',
'user' => '<USERNAME>',
'pw' => '<PASSWORD>'
);
```php
'http' => 'debug' => true
```

## Note
This script is using third-party libraries for downloading VCards from CardDAV servers based on the following packages
* CardDAV-PHP (https://github.com/jens-maus/CardDAV-PHP.git)
* FRITZ!Box-API-PHP (https://github.com/jens-maus/fritzbox_api_php.git)
* VCard-Parser (https://github.com/jens-maus/vCard-parser.git)
## Docker image

The Docker image contains the tool and all its dependencies. A volume
`/data` contains the configuration files. If the configuration is
missing, the Docker entrypoint will abort with an error message and copy
an example file to the volume.

There are two ways to use the image:

```console
docker run --rm -v ./carddav2fb-config:/data andig/carddav2fb command...
```

will execute a single command (and remove the created container
afterwards).

Without a command, the container entrypoint will enter an endless loop,
repeatedly executing `carddav2fb run` in given intervals. This allows
automatic, regular updates of your FRITZ!Box's phonebook.

## License
This script is released under Public Domain.

This script is released under Public Domain, some parts under GNU AGPL or MIT license. Make sure you understand which parts are which.

## Authors
Copyright (c) 2012-2016 Karl Glatz, Martin Rost, Jens Maus, Johannes Freiburger

Copyright (c) 2012-2025 Andreas Götz, Volker Püschel, Karl Glatz, Christian Putzke, Martin Rost, Jens Maus, Johannes Freiburger

[composer]: https://getcomposer.org/download/
[descent]: https://github.com/jens-maus/carddav2fb
Binary file added assets/fritzfon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/impact.ttf
Binary file not shown.
Binary file added assets/keypad.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions carddav2fb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env php
<?php

namespace Andig;

use Symfony\Component\Console\Application;

require_once('vendor/autoload.php');

$app = new Application('CardDAV to FritzBox converter');

$app->addCommands(array(
new RunCommand(),
new DownloadCommand(),
new ConvertCommand(),
new UploadCommand(),
new BackgroundCommand()
));

$app->run();
Loading