Compare commits

..

167 Commits
0.2 ... master

Author SHA1 Message Date
Phil a73477c9f2 1.0.0-beta 2025-01-07 14:15:39 +01:00
Phil 625c27878f Civix Upgrade, fixes #77 2025-01-07 14:11:45 +01:00
Phil 8d1863c4eb CiviX Upgrade #77
Civix upgrade should fix install error
2025-01-06 15:33:13 +01:00
Phil 6a5cb00131 Fix Webhook error handling logic 2024-10-02 16:52:26 +02:00
Phil 9beb8136fe 1.0.0-alpha2 2024-09-05 09:22:57 +02:00
Phil e8df834277 Merge branch 'issue/74' 2024-09-05 09:21:53 +02:00
Phil d4cfd0a173 [#74] hash value now uses string instead of hex 2024-09-05 09:20:15 +02:00
Phil 4972a5dbc1 1.0.0-alpha1
Fix for #75
2024-09-04 21:45:55 +02:00
Phil 79c278170f Merge branch 'issue/75' 2024-09-04 21:43:13 +02:00
Phil 38c378cc80 [#75] Add driver to Mailer class
see 26192
2024-09-04 21:42:24 +02:00
Phil 6e455e4438 1.0.0-alpha 2024-08-21 15:12:16 +02:00
Phil 1c5ebea422 Merge branch 'dev/69' 2024-08-16 16:44:21 +02:00
Phil c902a5ff1f Merge branch 'issue/62_php8' 2024-08-16 16:39:39 +02:00
Jens Schuppe 0822bc7bee Back to dev (0.8-dev) 2024-06-18 12:15:23 +02:00
Jens Schuppe 2bb4050eab Version 0.7.0 2024-06-18 12:14:53 +02:00
Jens Schuppe acaf9e7477 Merge remote-tracking branch 'ejegg/API4' 2024-06-18 12:08:30 +02:00
Phil b4e2f7a5b9 #62 update Cache_Lite pear Library in place
via https://github.com/pear/Cache_Lite
2024-05-24 15:17:17 +02:00
Phil 7779d71711 Make parrameters configurable 2024-05-24 08:24:56 +02:00
Phil 016886a5e6 0.6.0
CiviProxy Stable Release
2024-01-24 17:50:15 +01:00
Jaap Jansma 405bb04c7c Fix for #69 2024-01-17 14:39:54 +01:00
peth-systopia 01c7e9f726
Update README.md 2024-01-09 14:24:35 +01:00
Elliott Eggleston c8cbb54651 Proxy requests to API4, support authx flows
In order to use the .htaccess rewrite rules you'll need to inlcude
the appropriate AllowOverride in your apache site config.

Introduces new configuration options $target_rest4 (URL to API4
endpoint), authx_internal_flow, and authx_external_flow
(both of which are explained in config.dist.php). Note that this
commit only supports authx flows on API4 requests.

Fixes #66
2023-11-08 10:13:07 -05:00
peth-systopia e172aa196e
Update requirements.md 2023-06-21 11:35:39 +02:00
Jo Franz 010e7d8ed6 Docs 2022-12-28 23:14:53 +01:00
Philipp Batroff fe1ee908c1 [#62] update commenting for PHP8
#[ is no longer interpreted as the start of a comment, as this syntax is now used for attributes.
2022-12-14 08:40:12 +01:00
Anna 5d41d0f460 [#62]civix upgrade 2022-11-15 15:21:34 +01:00
Björn Endres dbdaa25468
Merge pull request #60 from systopia/issue/59
#59 remove googlefonts api
2022-08-23 11:17:57 +02:00
Johannes e3ace146f8 #59 remove googlefonts api 2022-08-23 11:11:26 +02:00
B. Endres 5c1e804055 bump back to 0.6-dev 2022-05-25 12:18:24 +02:00
B. Endres 98dd7c85f1 tagged 0.6-beta5 2022-05-25 12:17:39 +02:00
Björn Endres 5eb314df89
Merge pull request #57 from systopia/issue/44
Add qid to valid parameter list for opening tracking (#44)
2022-05-25 08:51:21 +02:00
Philipp Batroff 61f25b53f2 Add qid to valid parameter list for opening tracking 2022-05-13 17:14:55 +02:00
B. Endres ecc6eebfb0 back to 0.6-dev 2022-03-24 14:39:59 +01:00
B. Endres 3d4bda9bbe tagged 0.6-beta4 2022-03-24 14:39:07 +01:00
Björn Endres 668b7ea150
Merge pull request #56 from jaapjansma/issue_55
Fix for issue #55: view in browser link is broken
2022-03-24 14:35:24 +01:00
Jaap Jansma 611e21ac04 Fix for issue #55: view in browser link is broken 2022-03-24 14:31:37 +01:00
B. Endres 555ac6a796 bump back to 0.6-dev 2021-11-19 17:02:10 +01:00
B. Endres a26ca725cf 0.6-beta3 2021-11-19 17:01:35 +01:00
Björn Endres b6176c3609
Merge pull request #54 from jaapjansma/fix_for_38
Fix for #38
2021-11-19 16:33:28 +01:00
B. Endres 4ed9d58050 [#39] added mosacio compatibility for wordpress, merged PR-39 2021-11-19 16:32:19 +01:00
Jaap Jansma cd780e50e1 Fix for #38: added url encoding to mosaico template images, so that google+.png works 2021-11-19 16:31:05 +01:00
B. Endres d8c7b3cee8 bump back to 0.6-dev 2021-11-19 16:30:46 +01:00
Jaap Jansma 199cb98991
Merge branch 'master' into fix_for_38 2021-11-19 16:29:05 +01:00
B. Endres cf02dcd0c5 Revert "Merge pull request #53 from jaapjansma/wp_compatibility"
This reverts commit afd597495e, reversing
changes made to 3e0cf56c0d.
2021-11-19 16:28:05 +01:00
Björn Endres afd597495e
Merge pull request #53 from jaapjansma/wp_compatibility
Issue #39: added mosacio compatibility for wordpress
2021-11-19 16:22:46 +01:00
Jaap Jansma 59b7544b0b Fix for #38: added url encoding to mosaico template images, so that google+.png works 2021-11-19 16:19:48 +01:00
Jaap Jansma 6828950f9c Fix for #38
Fix for #38
2021-09-30 12:01:16 +02:00
Jaap Jansma 8952b72285 Issue #39: added mosacio compatibility for wordpress 2021-09-24 14:22:05 +02:00
B. Endres 3e0cf56c0d released 0.6-beta2 2021-06-14 10:51:03 +02:00
B. Endres 9e03e018e5 [#52] updated CacheLite to v1.8.3 2021-06-14 10:45:12 +02:00
B. Endres 45950312f7 [#52] don't use PEAR error logging 2021-06-09 16:47:30 +02:00
B. Endres ba21ed8a6f updated config template 2021-06-07 20:32:19 +02:00
B. Endres 13ddf6d6f0 updated file headers 2021-06-07 12:07:31 +02:00
B. Endres be59f15252 [#52] updated CacheLite to v1.8.3 2021-06-07 11:51:15 +02:00
Björn Endres d967a3febe
Merge pull request #48 from eileenmcnaughton/master
Fix url references to preferred urls
2020-11-20 09:40:45 +01:00
eileen 9f3b3e9ed5 Fix typo 2020-11-19 13:41:28 +13:00
eileen efc483e277 Fix url references to preferred urls
The older urls are still commented in the config.dist.php file so should not
be too hard to find for someone dealing with an older site
2020-11-19 13:38:17 +13:00
Björn Endres aaa7cccc26
Merge pull request #47 from codebymikey/codebymikey-version-regex
Add ability to match pre-releases and build labels e.g. "-dev"
2020-10-12 11:49:02 +02:00
Michael S 21f2d22506
Update ProxySettings.php
#46 Add ability to match pre-releases and build labels e.g. "-dev"
2020-10-12 09:22:51 +01:00
B. Endres bbf5c3c9e9 cleaned up logging and typos 2020-09-16 09:14:32 +02:00
Björn Endres b82c633663
Merge pull request #45 from seamuslee001/seamus_master
Update autogenrated civix file to be most recent version
2020-09-08 10:35:41 +02:00
Seamus Lee 76b5d8f49a Update autogenrated civix file to be most recent version 2020-09-08 18:07:47 +10:00
B. Endres c8c5694b52 [#44] alignment for readability 2020-09-07 09:36:17 +02:00
B. Endres 0ae1acb426 [#44] merged CiviCRM's new routes by @seamuslee001 2020-09-07 09:34:18 +02:00
B. Endres 1f46d5e5da [#44] added warning for CiviCRM < 5.27 2020-09-07 09:32:57 +02:00
Björn Endres 911f9ec3d3
Merge pull request #43 from seamuslee001/normal_routing
Add in normal url routes for tracked opens and tracking urls to the m…
2020-09-07 09:28:15 +02:00
Seamus Lee a88b621758 Add in normal url routes for tracked opens and tracking urls to the mend urls function and also make use of the normal routes when quering the target civi 2020-09-04 16:41:31 +10:00
Björn Endres 999345f4b5
Merge pull request #41 from MikeyMJCO/patch-1
MkDocs upgrade fix.
2020-04-14 12:46:04 +02:00
Mikey O'Toole d5062f8345
Update mkdocs.yml 2020-04-13 16:07:45 +01:00
Mikey O'Toole 9600bdd11c
MkDocs upgrade fix. 2020-04-13 12:21:41 +01:00
B. Endres e8fc1b1b0d bump back to 0.6-dev 2020-03-17 07:52:14 +01:00
Philipp Batroff c941a1248e Added logging to successful webhook handling 2019-11-27 17:11:00 +01:00
B. Endres 42c95f62c7 0.6-beta1 2019-11-26 16:20:14 +01:00
B. Endres 6478762b74 [#38] merged mosaico relative url fix (dev_38) 2019-11-26 16:09:41 +01:00
B. Endres 8aeaa3120b [#32] merged webhook2api (dev_32) 2019-11-26 16:08:11 +01:00
Philipp Batroff 20140a0d41 [#38] Fix relative file paths for view in browser 2019-11-25 17:48:32 +01:00
Björn Endres 5763a2b792
Merge pull request #36 from d1ss0nanz/master
simplify email regex; allow + in user part
2019-09-26 15:12:52 +02:00
Daniel Stutz 1bb61efd32 simplify email regex; allow + in user part 2019-09-25 17:39:26 +02:00
Björn Endres ccb0c41377
Merge pull request #28 from pbatroff/dev_27
Fix for #27: Correct link generation. Needs a bit more testing
2019-09-24 14:14:18 +02:00
Björn Endres d4853095ce
Merge branch 'master' into dev_27 2019-09-24 14:14:09 +02:00
Björn Endres 9b4c5f8f99
Merge pull request #34 from jaapjansma/issue_33
Issue #33 case insesntive entity and action specification
2019-09-03 07:28:44 +02:00
Jaap Jansma cad78b5496 Issue #33 case insesntive entity and action specification 2019-08-30 14:38:48 +02:00
Philipp Batroff 917af8650d Changed http return code to 200 if the command was parsed successfully, but a civiCRM error occured. In that case we shouldn't return an error code, because it's an internal error 2019-07-18 12:18:38 +02:00
Philipp Batroff f83fc0c77e udpate parsing of response codes from civicrm api 2019-07-18 11:34:18 +02:00
Philipp Batroff 1ffa67865d implementing webhook2api, amendment for json array parameter parsing. WiP - debuggin output for error_log 2019-07-17 14:15:52 +02:00
B. Endres f044515feb [#32] improved documentation 2019-01-04 17:41:45 +01:00
B. Endres 2207a95c2b [#32] implementing webhook2api 2019-01-04 17:28:52 +01:00
B. Endres d87d5a6c24 [#32] implementing webhook2api 2019-01-04 16:22:43 +01:00
B. Endres 3eae978200 Merge remote-tracking branch 'Michael/config-dist' 2019-01-04 10:45:44 +01:00
B. Endres aef6fbeaa2 bump master back to 0.6-dev 2019-01-04 10:06:15 +01:00
B. Endres bf53d03b3b [#31] added remark about clean URLs 2018-11-26 09:02:22 +01:00
B. Endres abb46397d3 [#30] added php-curl requirement 2018-11-26 07:24:38 +01:00
Philipp Batroff 47f6f1b4b8 Fix for #27: Correct link generation. Needs a bit more testing 2018-07-02 11:50:44 +02:00
SYSTOPIA 5894bce133
Merge pull request #24 from michaelmcandrew/docker
adding Dockerfile
2018-03-12 13:16:09 +01:00
Michael McAndrew 8f1aba57e7 Merge branch 'master' of https://github.com/systopia/CiviProxy into config-dist 2018-03-12 09:02:29 +00:00
Michael McAndrew 8116bdd128 Merge branch 'master' of https://github.com/systopia/CiviProxy into docker 2018-03-12 09:02:19 +00:00
Michael McAndrew 3f0a766241 adding Dockerfile 2018-03-09 17:27:26 +00:00
Michael McAndrew 1b1d5e8bd4 a hint on installation in the config.dist.php file 2018-03-09 17:25:16 +00:00
Michael McAndrew aaa5330591 distribute a config.dist.php file 2018-03-09 17:24:13 +00:00
systopia d846c1d9ff implemented #22 2018-03-01 11:12:11 +01:00
systopia 1e280e1f0e Merge remote-tracking branch 'origin/dev_20' 2018-03-01 11:09:58 +01:00
systopia a23f0cfb05 implementing #20 2018-03-01 11:08:44 +01:00
systopia e4a9927919 released 0.5 2018-03-01 10:18:49 +01:00
systopia 2346076e72 implementing #20 2018-03-01 10:15:59 +01:00
systopia 9f1caed052 implementing #20 2018-02-28 17:06:02 +01:00
systopia 9e9bae4015 0.5.beta1 2017-12-11 11:36:34 +01:00
systopia dd9affd1f9 disable mosaic by default 2017-11-17 15:59:52 +01:00
systopia 9e7cbdc00a fixed static mail 2017-11-17 15:43:40 +01:00
systopia ecbf179fbb make mosaico static mail work (#7) 2017-11-17 14:05:15 +01:00
systopia b6dcfbcb16 moved mosaico to separate script (#7) 2017-11-17 13:59:28 +01:00
systopia 0f351f6cf0 adjusted versions 2017-09-06 11:08:50 +02:00
SYSTOPIA 08aa1d6f7c Merge pull request #9 from MegaphoneJon/mosaico-support
Mosaico support
2017-09-06 11:07:03 +02:00
systopia f29646cfac make logging more secure (#17) 2017-08-29 09:12:26 +02:00
systopia 0c18d8c9e4 bugfix #16 2017-08-28 16:17:11 +02:00
systopia 5bf3f39f00 0.3.3.dev 2017-08-28 14:28:25 +02:00
systopia 3c825a8f55 implementing #16 2017-07-31 16:32:58 +02:00
Erik Hommel 053c3f5fb9 fix link to github in installation docs 2017-07-21 15:22:58 +02:00
Erik Hommel 675229f3e0 updated info.xml for version 04, tested with 4.7 2017-07-20 12:38:39 +02:00
Erik Hommel 802843c743 docs confirming with style guide 2017-07-20 12:37:18 +02:00
Erik Hommel 19d57e52e5 update docs for issue 12 2017-07-20 11:51:58 +02:00
Erik Hommel b82cba324b Merge branch 'issue12' to fix #12 2017-07-20 11:15:38 +02:00
Erik Hommel 2c4c12cb56 fix issues from testing with #12 2017-07-20 11:11:06 +02:00
Erik Hommel 662f217570 completed alternative 1 for issue 12 2017-07-20 09:46:58 +02:00
Erik Hommel 7f73bc0b64 docs - add caution for empty parameters scenario 2017-07-20 09:42:05 +02:00
Erik Hommel 60e6b31013 link to documentation on civicrm-docs 2017-07-20 09:00:37 +02:00
Erik Hommel 41774c177c update api and site key settings 2017-07-20 08:58:38 +02:00
Erik Hommel 4b93dfae7d work in progress issue 12 2017-07-19 18:57:30 +02:00
Erik Hommel 1aeeb8553b Merge branch 'master' into issue12 2017-07-19 17:09:24 +02:00
Erik Hommel 723cd1234f add mkdocs guide 2017-07-19 16:45:06 +02:00
Erik Hommel 0814e8457c add ip whitelisting fix #12 2017-07-19 16:40:09 +02:00
Erik Hommel 7ad8a423b3 Merge branch 'master' into issue12 2017-07-19 14:58:12 +02:00
Erik Hommel 8aff0d4dca fix #14 add help text for mail setting 2017-07-19 14:57:27 +02:00
Erik Hommel b22045fa3d add .idea to gitignore to ignore phpstorm projects 2017-07-19 14:53:59 +02:00
Jon goldberg fed7a8ee7a Remove chunked transfer encoding header BEFORE saving to cache 2017-04-26 16:51:59 -04:00
Jon goldberg cd4c59a691 Encode Mosaico images properly in the Civi extension 2017-04-26 15:58:56 -04:00
Jon goldberg 4fcf7cf695 Insert Mosaico target path into config.php 2017-04-26 15:55:24 -04:00
Jon goldberg 32966f0802 check for a mosaico parameter; change URL if it's found; strip out chunked transfer header 2017-04-26 15:54:13 -04:00
SYSTOPIA f1ed911979 Merge pull request #6 from PalanteJon/readme-fix
Include PEAR in README as a requirement
2017-04-26 09:02:27 +02:00
Jon goldberg 79dbb537de Include PEAR in README as a requirement 2017-04-25 18:19:41 -04:00
SYSTOPIA b0cf0a93f5 Merge pull request #5 from JoeMurray/patch-1
two typos
2017-03-13 15:23:13 +01:00
Joe Murray 71deebc22d two typos 2017-03-13 10:10:26 -04:00
systopia a0f9c90083 fixed #4 2016-01-06 16:43:22 +01:00
systopia 1063bcc421 update version number 2015-10-22 19:33:03 +02:00
SYSTOPIA 8bc79d8366 added image 2015-10-22 19:31:22 +02:00
systopia 26d01b0356 Merge remote-tracking branch 'public/master' 2015-10-22 19:28:20 +02:00
systopia ae0738591a added acknowledgements 2015-10-22 19:26:42 +02:00
systopia 114f14dcf3 added license 2015-10-22 18:23:57 +02:00
SYSTOPIA 2a15ef6351 Initial commit 2015-10-22 18:20:39 +02:00
systopia 22b4aa9205 more docs 2015-10-22 18:18:39 +02:00
systopia 83534a0b3e released extension version 0.3.1 2015-10-22 10:58:28 +02:00
systopia d1ceac5295 included CURLOPT_INTERFACE option 2015-09-09 17:20:11 +02:00
systopia 8659e27503 minor fix 2015-06-22 10:13:59 +02:00
systopia e5a0063d80 require SSL 2015-03-27 13:21:15 +01:00
systopia 9d6e05e480 fixed certificate requirement 2015-03-27 13:20:48 +01:00
systopia fdcb417e1b undo require_not_once workaround 2015-03-27 13:19:56 +01:00
systopia 90f55d7e56 fixed proxy for mailing 2015-03-23 17:31:56 +01:00
systopia ee634517c7 fixed mail forward 2015-03-23 17:31:34 +01:00
systopia 0df7a70315 fixed path issues 2015-03-19 15:24:59 +01:00
systopia c86617508a use our own mailer wrapper instead of alterMail hook 2015-03-19 15:21:57 +01:00
systopia a2385a8c1c fixed path issues 2015-03-19 15:21:18 +01:00
systopia 6a8d44548f email subscription ready for testing 2015-03-19 10:38:27 +01:00
systopia c86213dcc9 work in progress - email subscription 2015-03-19 09:29:54 +01:00
systopia be1a118ec7 started developing mail subscribe/unsubscribe pages 2015-03-18 08:02:31 +01:00
systopia d69e543853 removed example files 2015-02-20 16:41:36 +01:00
systopia c1e6d83201 working on 0.3 2015-02-20 16:23:09 +01:00
systopia c2fdacdda5 included Niko's error page 2015-02-20 16:22:34 +01:00
systopia 7f7f355cc8 created a neutral config file 2015-02-20 16:13:55 +01:00
58 changed files with 3585 additions and 1416 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
secrets.php
proxy/file_cache
proxy/config.php
debug.log
.idea

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
# You may find this Dockerfile useful in development or production
# From the CiviProxy directory
# * Build a docker image with `docker build . -t civiproxy`
# * Run a development container with `run -d -p 4050:80 -v $PWD/proxy:/var/www/html --name civiproxy civiproxy`
FROM php:7-apache
COPY proxy/ /var/www/html

10
LIBRARIES.md Normal file
View File

@ -0,0 +1,10 @@
# Libraries
This module uses the following libraries
## PEAR Cache Lite
by Fabien MARTY <fab@php.net> and Markus Tacker <tacker@php.net>
URL: [https://travis-ci.org/pear/Cache_Lite](https://travis-ci.org/pear/Cache_Lite)

662
LICENSE Normal file
View File

@ -0,0 +1,662 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

8
README.md Normal file
View File

@ -0,0 +1,8 @@
## About
CiviProxy is a tool to set up a security proxy server specifically for your CiviCRM instance. It uses whitelisting and parameter sanitation to allow only legitimate requests to pass through.
## Documentation
The documentation on CiviProxy can be found here: https://docs.civicrm.org/civiproxy/en/latest/
## We need your support
This software is provided as Free and Open Source Software, and we are happy if you find it useful. However, we have put a lot of work into it (and continue to do so), much of it unpaid for. So if you benefit from our software, please consider making a financial contribution so we can continue to maintain and develop it further.
If you are willing to support us in developing this tool, please send an email to info@systopia.de to get an invoice or agree a different payment method. Thank you!

View File

@ -1,4 +1,12 @@
<?php
/*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+--------------------------------------------------------*/
require_once 'CRM/Admin/Form/Setting.php';
require_once 'CRM/Core/BAO/CustomField.php';
@ -16,7 +24,7 @@ class CRM_Admin_Form_Setting_ProxySettings extends CRM_Admin_Form_Setting
$this->addElement('text', 'proxy_url', ts('Proxy URL'), array('disabled' => 'disabled'));
$this->addElement('static', 'proxy_version', ts('Proxy version'));
$this->addElement('text', 'civimail_external_optout', ts('CiviMail: External opt-out page'), array('disabled' => 'disabled'));
$this->addElement('text', 'custom_mailing_base', ts('Custom Subscribe/Unsubscribe Pages'), array('disabled' => 'disabled'));
$this->addButtons(array(
array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE),
@ -28,7 +36,7 @@ class CRM_Admin_Form_Setting_ProxySettings extends CRM_Admin_Form_Setting
function addRules() {
$this->addRule('proxy_url', ts('This may only contain a valid URL'), 'onlyValidURL');
$this->addRule('civimail_external_optout', ts('This may only contain a valid URL'), 'onlyValidURL');
$this->addRule('custom_mailing_base', ts('This may only contain a valid URL'), 'onlyValidURL');
}
function preProcess() {
@ -51,7 +59,7 @@ class CRM_Admin_Form_Setting_ProxySettings extends CRM_Admin_Form_Setting
$this->setDefaults(array(
'proxy_url' => $proxyUrl,
'proxy_version' => $proxyVersion, // watch out, this might contain an error message
'civimail_external_optout' => CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'civimail_extoptout')
'custom_mailing_base' => CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'custom_mailing_base')
));
}
@ -66,8 +74,13 @@ class CRM_Admin_Form_Setting_ProxySettings extends CRM_Admin_Form_Setting
if (isset($values['proxy_url'])) {
CRM_Core_BAO_Setting::setItem($values['proxy_url'],'CiviProxy Settings', 'proxy_url');
}
if (isset($values['civimail_external_optout'])) {
CRM_Core_BAO_Setting::setItem($values['civimail_external_optout'],'CiviProxy Settings', 'civimail_extoptout');
if (isset($values['custom_mailing_base'])) {
// check if it is simply default ({$proxy_url}/mailing)
if ($values['custom_mailing_base'] == $values['proxy_url'] . '/mailing') {
// ...in which case we'll simply set it to ''
$values['custom_mailing_base'] = '';
}
CRM_Core_BAO_Setting::setItem($values['custom_mailing_base'],'CiviProxy Settings', 'custom_mailing_base');
}
// give feedback to user
@ -92,9 +105,9 @@ class CRM_Admin_Form_Setting_ProxySettings extends CRM_Admin_Form_Setting
if($response === FALSE) {
return array('is_error' => 1, 'message' => sprintf(ts('Error: cannot access "%s"'), $url));
}else{
$result = preg_match("/<p id=\"version\">CiviProxy Version ([0-9]+\.[0-9]+|[0-9]+\.[0-9]+\.[0-9]+)<\/p>/", $response, $output_array);
$result = preg_match("/<p id=\"version\">CiviProxy Version (([0-9]+\.[0-9]+|[0-9]+\.[0-9]+\.[0-9]+)(?:-[0-9A-Za-z-]+)?)<\/p>/", $response, $output_array);
if ($result === FALSE || $result === 0){
return array('is_error' => 1, 'message' => sprintf(ts('Error: failed to parse version information'), $url));
return array('is_error' => 1, 'message' => sprintf(ts('Error: failed to parse version information: (%s)'), $url));
}else{
return array('is_error' => 0, 'version' => $output_array[1]);
}

View File

@ -0,0 +1,102 @@
<?php
/*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+--------------------------------------------------------*/
/**
* Wrapper for CiviCRM Mailer
*/
class CRM_Civiproxy_Mailer {
/**
* this is the orginal, wrapped mailer
*/
protected $mailer = NULL;
/**
* @var Mail Driver
*/
protected $driver = NULL;
/**
* @var array Mail Params, currently not used
*/
protected $params = [];
/**
* construct this mailer wrapping another one
*/
public function __construct($mailer, $driver, $params) {
$this->mailer = $mailer;
$this->driver = $driver;
$this->params = $params;
}
/**
* Send an email via the wrapped mailer,
* mending the URLs contained
*/
function send($recipients, $headers, $body) {
foreach ($headers as &$header) {
CRM_CiviProxy_Mailer::mendURLs($header);
}
CRM_CiviProxy_Mailer::mendURLs($body);
$this->mailer->send($recipients, $headers, $body);
}
/**
* This function will manipulate the URLs in Emails, so they point
* to the correct proxy addresses
*/
static function mendURLs(&$value) {
// check if the proxy is enabled
$enabled = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_enabled');
if (!$enabled) return;
$mosaico = CRM_Civiproxy_Mosaico::singleton();
// get the URLs
$config = CRM_Core_Config::singleton();
$system_base = $config->userFrameworkBaseURL;
$proxy_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_url');
// General external functions
$value = preg_replace("#{$system_base}civicrm/mailing/url#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/url.php#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$system_base}civicrm/mailing/open#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/open.php#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$system_base}sites/default/files/civicrm/persist/#i", $proxy_base.'/file.php?id=', $value);
$value = preg_replace("#{$system_base}civicrm/mosaico/img\?src=#i", $proxy_base.'/mosaico.php?id=', $value);
$value = preg_replace("#{$system_base}civicrm/mosaico/img/\?src=#i", $proxy_base.'/mosaico.php?id=', $value);
if ($mosaico->isMosaicoInstalled()) {
$value = preg_replace_callback("#({$mosaico->getMosaicoExtensionUrl()}/packages/mosaico/templates/)(\S*)([\"'])#i", function($matches) use ($proxy_base) {
return $proxy_base . '/mosaico.php?template_url=' . urlencode($matches[2]) . $matches[3];
}, $value);
}
// Mailing related functions
$value = preg_replace("#{$system_base}civicrm/mailing/view#i", $proxy_base.'/mailing/mail.php', $value);
$custom_mailing_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'custom_mailing_base');
$other_mailing_functions = array('subscribe', 'confirm', 'unsubscribe', 'resubscribe', 'optout');
foreach ($other_mailing_functions as $function) {
if (empty($custom_mailing_base)) {
$new_url = "{$proxy_base}/mailing/{$function}.php";
} else {
$new_url = "{$custom_mailing_base}/{$function}.php";
}
$value = preg_replace("#{$system_base}civicrm/mailing/{$function}#i", $new_url, $value);
}
}
/**
* @return Mail|null
*/
public function getDriver() {
return $this->driver;
}
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Copyright (C) 2021 Jaap Jansma (jaap.jansma@civicoop.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class CRM_Civiproxy_Mosaico {
/**
* @var CRM_Civiproxy_Mosaico
*/
private static $singleton;
/**
* @var String
*/
private $mosiacoExtenionUrl;
/**
* @var bool
*/
private $isMosaicoInstalled = false;
private function __construct() {
try {
$mosaicoExt = civicrm_api3('Extension', 'getsingle', ['full_name' => "uk.co.vedaconsulting.mosaico"]);
$this->isMosaicoInstalled = true;
$this->mosiacoExtenionUrl = CRM_Mosaico_ExtensionUtil::url();
} catch (\Exception $ex) {
// Do nothing
}
}
/**
* @return CRM_Civiproxy_Mosaico
*/
public static function singleton() {
if (!self::$singleton) {
self::$singleton = new CRM_Civiproxy_Mosaico();
}
return self::$singleton;
}
/**
* @return bool
*/
public function isMosaicoInstalled() {
return $this->isMosaicoInstalled;
}
/**
* @return string
*/
public function getMosaicoExtensionUrl() {
return $this->mosiacoExtenionUrl;
}
}

View File

@ -3,240 +3,199 @@
// AUTO-GENERATED FILE -- Civix may overwrite any changes made to this file
/**
* (Delegated) Implementation of hook_civicrm_config
* The ExtensionUtil class provides small stubs for accessing resources of this
* extension.
*/
function _civiproxy_civix_civicrm_config(&$config = NULL) {
class CRM_Civiproxy_ExtensionUtil {
const SHORT_NAME = 'civiproxy';
const LONG_NAME = 'de.systopia.civiproxy';
const CLASS_PREFIX = 'CRM_Civiproxy';
/**
* Translate a string using the extension's domain.
*
* If the extension doesn't have a specific translation
* for the string, fallback to the default translations.
*
* @param string $text
* Canonical message text (generally en_US).
* @param array $params
* @return string
* Translated text.
* @see ts
*/
public static function ts($text, $params = []): string {
if (!array_key_exists('domain', $params)) {
$params['domain'] = [self::LONG_NAME, NULL];
}
return ts($text, $params);
}
/**
* Get the URL of a resource file (in this extension).
*
* @param string|NULL $file
* Ex: NULL.
* Ex: 'css/foo.css'.
* @return string
* Ex: 'http://example.org/sites/default/ext/org.example.foo'.
* Ex: 'http://example.org/sites/default/ext/org.example.foo/css/foo.css'.
*/
public static function url($file = NULL): string {
if ($file === NULL) {
return rtrim(CRM_Core_Resources::singleton()->getUrl(self::LONG_NAME), '/');
}
return CRM_Core_Resources::singleton()->getUrl(self::LONG_NAME, $file);
}
/**
* Get the path of a resource file (in this extension).
*
* @param string|NULL $file
* Ex: NULL.
* Ex: 'css/foo.css'.
* @return string
* Ex: '/var/www/example.org/sites/default/ext/org.example.foo'.
* Ex: '/var/www/example.org/sites/default/ext/org.example.foo/css/foo.css'.
*/
public static function path($file = NULL) {
// return CRM_Core_Resources::singleton()->getPath(self::LONG_NAME, $file);
return __DIR__ . ($file === NULL ? '' : (DIRECTORY_SEPARATOR . $file));
}
/**
* Get the name of a class within this extension.
*
* @param string $suffix
* Ex: 'Page_HelloWorld' or 'Page\\HelloWorld'.
* @return string
* Ex: 'CRM_Foo_Page_HelloWorld'.
*/
public static function findClass($suffix) {
return self::CLASS_PREFIX . '_' . str_replace('\\', '_', $suffix);
}
}
use CRM_Civiproxy_ExtensionUtil as E;
/**
* (Delegated) Implements hook_civicrm_config().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config
*/
function _civiproxy_civix_civicrm_config($config = NULL) {
static $configured = FALSE;
if ($configured) return;
if ($configured) {
return;
}
$configured = TRUE;
$template =& CRM_Core_Smarty::singleton();
$extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
$extDir = $extRoot . 'templates';
if ( is_array( $template->template_dir ) ) {
array_unshift( $template->template_dir, $extDir );
} else {
$template->template_dir = array( $extDir, $template->template_dir );
}
$include_path = $extRoot . PATH_SEPARATOR . get_include_path( );
set_include_path( $include_path );
$extRoot = __DIR__ . DIRECTORY_SEPARATOR;
$include_path = $extRoot . PATH_SEPARATOR . get_include_path();
set_include_path($include_path);
// Based on <compatibility>, this does not currently require mixin/polyfill.php.
}
/**
* (Delegated) Implementation of hook_civicrm_xmlMenu
* Implements hook_civicrm_install().
*
* @param $files array(string)
*/
function _civiproxy_civix_civicrm_xmlMenu(&$files) {
foreach (_civiproxy_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
$files[] = $file;
}
}
/**
* Implementation of hook_civicrm_install
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function _civiproxy_civix_civicrm_install() {
_civiproxy_civix_civicrm_config();
if ($upgrader = _civiproxy_civix_upgrader()) {
return $upgrader->onInstall();
}
// Based on <compatibility>, this does not currently require mixin/polyfill.php.
}
/**
* Implementation of hook_civicrm_uninstall
* (Delegated) Implements hook_civicrm_enable().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
*/
function _civiproxy_civix_civicrm_uninstall() {
function _civiproxy_civix_civicrm_enable(): void {
_civiproxy_civix_civicrm_config();
if ($upgrader = _civiproxy_civix_upgrader()) {
return $upgrader->onUninstall();
}
// Based on <compatibility>, this does not currently require mixin/polyfill.php.
}
/**
* (Delegated) Implementation of hook_civicrm_enable
* Inserts a navigation menu item at a given place in the hierarchy.
*
* @param array $menu - menu hierarchy
* @param string $path - path to parent of this item, e.g. 'my_extension/submenu'
* 'Mailing', or 'Administer/System Settings'
* @param array $item - the item to insert (parent/child attributes will be
* filled for you)
*
* @return bool
*/
function _civiproxy_civix_civicrm_enable() {
_civiproxy_civix_civicrm_config();
if ($upgrader = _civiproxy_civix_upgrader()) {
if (is_callable(array($upgrader, 'onEnable'))) {
return $upgrader->onEnable();
}
}
}
/**
* (Delegated) Implementation of hook_civicrm_disable
*/
function _civiproxy_civix_civicrm_disable() {
_civiproxy_civix_civicrm_config();
if ($upgrader = _civiproxy_civix_upgrader()) {
if (is_callable(array($upgrader, 'onDisable'))) {
return $upgrader->onDisable();
}
}
}
/**
* (Delegated) Implementation of hook_civicrm_upgrade
*
* @param $op string, the type of operation being performed; 'check' or 'enqueue'
* @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
*
* @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
*/
function _civiproxy_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
if ($upgrader = _civiproxy_civix_upgrader()) {
return $upgrader->onUpgrade($op, $queue);
}
}
function _civiproxy_civix_upgrader() {
if (!file_exists(__DIR__.'/CRM/Civiproxy/Upgrader.php')) {
return NULL;
} else {
return CRM_Civiproxy_Upgrader_Base::instance();
}
}
/**
* Search directory tree for files which match a glob pattern
*
* Note: Dot-directories (like "..", ".git", or ".svn") will be ignored.
* Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles()
*
* @param $dir string, base dir
* @param $pattern string, glob pattern, eg "*.txt"
* @return array(string)
*/
function _civiproxy_civix_find_files($dir, $pattern) {
if (is_callable(array('CRM_Utils_File', 'findFiles'))) {
return CRM_Utils_File::findFiles($dir, $pattern);
}
$todos = array($dir);
$result = array();
while (!empty($todos)) {
$subdir = array_shift($todos);
foreach (_civiproxy_civix_glob("$subdir/$pattern") as $match) {
if (!is_dir($match)) {
$result[] = $match;
}
}
if ($dh = opendir($subdir)) {
while (FALSE !== ($entry = readdir($dh))) {
$path = $subdir . DIRECTORY_SEPARATOR . $entry;
if ($entry{0} == '.') {
} elseif (is_dir($path)) {
$todos[] = $path;
}
}
closedir($dh);
}
}
return $result;
}
/**
* (Delegated) Implementation of hook_civicrm_managed
*
* Find any *.mgd.php files, merge their content, and return.
*/
function _civiproxy_civix_civicrm_managed(&$entities) {
$mgdFiles = _civiproxy_civix_find_files(__DIR__, '*.mgd.php');
foreach ($mgdFiles as $file) {
$es = include $file;
foreach ($es as $e) {
if (empty($e['module'])) {
$e['module'] = 'de.systopia.civiproxy';
}
$entities[] = $e;
}
}
}
/**
* (Delegated) Implementation of hook_civicrm_caseTypes
*
* Find any and return any files matching "xml/case/*.xml"
*
* Note: This hook only runs in CiviCRM 4.4+.
*/
function _civiproxy_civix_civicrm_caseTypes(&$caseTypes) {
if (!is_dir(__DIR__ . '/xml/case')) {
return;
}
foreach (_civiproxy_civix_glob(__DIR__ . '/xml/case/*.xml') as $file) {
$name = preg_replace('/\.xml$/', '', basename($file));
if ($name != CRM_Case_XMLProcessor::mungeCaseType($name)) {
$errorMessage = sprintf("Case-type file name is malformed (%s vs %s)", $name, CRM_Case_XMLProcessor::mungeCaseType($name));
CRM_Core_Error::fatal($errorMessage);
// throw new CRM_Core_Exception($errorMessage);
}
$caseTypes[$name] = array(
'module' => 'de.systopia.civiproxy',
'name' => $name,
'file' => $file,
);
}
}
/**
* Glob wrapper which is guaranteed to return an array.
*
* The documentation for glob() says, "On some systems it is impossible to
* distinguish between empty match and an error." Anecdotally, the return
* result for an empty match is sometimes array() and sometimes FALSE.
* This wrapper provides consistency.
*
* @see http://php.net/glob
* @param string $pattern
* @return array, possibly empty
*/
function _civiproxy_civix_glob($pattern) {
$result = glob($pattern);
return is_array($result) ? $result : array();
}
/**
* Inserts a navigation menu item at a given place in the hierarchy
*
* $menu - menu hierarchy
* $path - path where insertion should happen (ie. Administer/System Settings)
* $item - menu you need to insert (parent/child attributes will be filled for you)
* $parentId - used internally to recurse in the menu structure
*/
function _civiproxy_civix_insert_navigation_menu(&$menu, $path, $item, $parentId = NULL) {
static $navId;
function _civiproxy_civix_insert_navigation_menu(&$menu, $path, $item) {
// If we are done going down the path, insert menu
if (empty($path)) {
if (!$navId) $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
$navId ++;
$menu[$navId] = array (
'attributes' => array_merge($item, array(
'label' => CRM_Utils_Array::value('name', $item),
'active' => 1,
'parentID' => $parentId,
'navID' => $navId,
))
);
return true;
} else {
$menu[] = [
'attributes' => array_merge([
'label' => $item['name'] ?? NULL,
'active' => 1,
], $item),
];
return TRUE;
}
else {
// Find an recurse into the next level down
$found = false;
$found = FALSE;
$path = explode('/', $path);
$first = array_shift($path);
foreach ($menu as $key => &$entry) {
if ($entry['attributes']['name'] == $first) {
if (!$entry['child']) $entry['child'] = array();
$found = _civiproxy_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item, $key);
if (!isset($entry['child'])) {
$entry['child'] = [];
}
$found = _civiproxy_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item);
}
}
return $found;
}
}
/**
* (Delegated) Implements hook_civicrm_navigationMenu().
*/
function _civiproxy_civix_navigationMenu(&$nodes) {
if (!is_callable(['CRM_Core_BAO_Navigation', 'fixNavigationMenu'])) {
_civiproxy_civix_fixNavigationMenu($nodes);
}
}
/**
* Given a navigation menu, generate navIDs for any items which are
* missing them.
*/
function _civiproxy_civix_fixNavigationMenu(&$nodes) {
$maxNavID = 1;
array_walk_recursive($nodes, function($item, $key) use (&$maxNavID) {
if ($key === 'navID') {
$maxNavID = max($maxNavID, $item);
}
});
_civiproxy_civix_fixNavigationMenuItems($nodes, $maxNavID, NULL);
}
function _civiproxy_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
$origKeys = array_keys($nodes);
foreach ($origKeys as $origKey) {
if (!isset($nodes[$origKey]['attributes']['parentID']) && $parentID !== NULL) {
$nodes[$origKey]['attributes']['parentID'] = $parentID;
}
// If no navID, then assign navID and fix key.
if (!isset($nodes[$origKey]['attributes']['navID'])) {
$newKey = ++$maxNavID;
$nodes[$origKey]['attributes']['navID'] = $newKey;
$nodes[$newKey] = $nodes[$origKey];
unset($nodes[$origKey]);
$origKey = $newKey;
}
if (isset($nodes[$origKey]['child']) && is_array($nodes[$origKey]['child'])) {
_civiproxy_civix_fixNavigationMenuItems($nodes[$origKey]['child'], $maxNavID, $nodes[$origKey]['attributes']['navID']);
}
}
}

View File

@ -1,32 +1,21 @@
<?php
/*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+--------------------------------------------------------*/
require_once 'civiproxy.civix.php';
/**
* In outgoing emails, replace the various resources and trackers with proxied versions
* We will provide our own Mailer (wrapping the original one).
* so we can mend all the URLs in outgoing emails
*/
function civiproxy_civicrm_alterMailParams( &$params, $context ) {
// check if the proxy is enabled
$enabled = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_enabled');
if (!$enabled) return;
// get the URLs
$config = CRM_Core_Config::singleton();
$system_base = $config->userFrameworkBaseURL;
$proxy_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_url');
// fields to replace:
$external_urls = array('url.php', 'open.php');
$fields2replace = array('html', 'text');
foreach ($fields2replace as $field) {
$value = $params[$field];
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/url.php#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/open.php#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$system_base}sites/default/files/civicrm/persist/#i", $proxy_base.'/file.php?id=', $value);
$value = preg_replace("#{$system_base}civicrm/mailing/view#i", $proxy_base.'/mail.php', $value);
$value = preg_replace("#{$system_base}civicrm/mailing/optout#i", $proxy_base.'/index.php', $value);
$params[$field] = $value;
}
function civiproxy_civicrm_alterMailer(&$mailer, $driver, $params) {
$mailer = new CRM_Civiproxy_Mailer($mailer, $driver, $params);
}
/**
@ -36,15 +25,6 @@ function civiproxy_civicrm_config(&$config) {
_civiproxy_civix_civicrm_config($config);
}
/**
* Implementation of hook_civicrm_xmlMenu
*
* @param $files array(string)
*/
function civiproxy_civicrm_xmlMenu(&$files) {
_civiproxy_civix_civicrm_xmlMenu($files);
}
/**
* Implementation of hook_civicrm_install
*/
@ -52,13 +32,6 @@ function civiproxy_civicrm_install() {
return _civiproxy_civix_civicrm_install();
}
/**
* Implementation of hook_civicrm_uninstall
*/
function civiproxy_civicrm_uninstall() {
return _civiproxy_civix_civicrm_uninstall();
}
/**
* Implementation of hook_civicrm_enable
*/
@ -66,61 +39,9 @@ function civiproxy_civicrm_enable() {
return _civiproxy_civix_civicrm_enable();
}
/**
* Implementation of hook_civicrm_disable
*/
function civiproxy_civicrm_disable() {
return _civiproxy_civix_civicrm_disable();
}
/**
* Implementation of hook_civicrm_upgrade
*
* @param $op string, the type of operation being performed; 'check' or 'enqueue'
* @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
*
* @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
*/
function civiproxy_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
return _civiproxy_civix_civicrm_upgrade($op, $queue);
}
/**
* Implementation of hook_civicrm_managed
*
* Generate a list of entities to create/deactivate/delete when this module
* is installed, disabled, uninstalled.
*/
function civiproxy_civicrm_managed(&$entities) {
return _civiproxy_civix_civicrm_managed($entities);
}
/**
* Implementation of hook_civicrm_caseTypes
*
* Generate a list of case-types
*
* Note: This hook only runs in CiviCRM 4.4+.
*/
function civiproxy_civicrm_caseTypes(&$caseTypes) {
_civiproxy_civix_civicrm_caseTypes($caseTypes);
}
/**
* Implementation of hook_civicrm_alterSettingsFolders
*
* Scan for settings in custom folder and import them
*
*/
function civiproxy_civicrm_alterSettingsFolders(&$metaDataFolders = NULL){
static $configured = FALSE;
if ($configured) return;
$configured = TRUE;
$extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
$extDir = $extRoot . 'settings';
if(!in_array($extDir, $metaDataFolders)){
$metaDataFolders[] = $extDir;
}
}

View File

@ -3,19 +3,36 @@
<file>civiproxy</file>
<name>CiviProxy</name>
<description>This will enable CiviProxy support for mailings</description>
<license></license>
<license>AGPL</license>
<maintainer>
<author>B. Endres</author>
<email>endres@systopia.de</email>
</maintainer>
<releaseDate></releaseDate>
<version>0.2</version>
<develStage>alpha</develStage>
<urls>
<url desc="Main Extension Page">https://github.com/systopia/CiviProxy</url>
<url desc="Documentation">https://docs.civicrm.org/civiproxy/en/latest/</url>
<url desc="Support">https://github.com/systopia/CiviProxy/issues</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2024-01-07</releaseDate>
<version>1.0.0-beta</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.4</ver>
<ver>5.45</ver>
</compatibility>
<comments>This is an addition to SYSTOPIA's CiviProxy security system</comments>
<comments>This is the companion extension to SYSTOPIA's CiviProxy security system</comments>
<civix>
<namespace>CRM/Civiproxy</namespace>
<format>24.09.1</format>
</civix>
<mixins>
<mixin>menu-xml@1.0.0</mixin>
<mixin>setting-php@1.0.0</mixin>
<mixin>smarty-v2@1.0.3</mixin>
<mixin>entity-types-php@2.0.0</mixin>
</mixins>
<classloader>
<psr0 prefix="CRM_" path="."/>
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
</extension>

View File

@ -0,0 +1,40 @@
<?php
/**
* Auto-register entity declarations from `schema/*.entityType.php`.
*
* @mixinName entity-types-php
* @mixinVersion 2.0.0
* @since 5.73
*
* Changelog:
* - v2.0 scans /schema directory instead of /xml/schema/*
* - v2.0 supports only one entity per file
* - v2.0 adds 'module' key to each entity
*
* @param CRM_Extension_MixInfo $mixInfo
* On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
* @param \CRM_Extension_BootCache $bootCache
* On newer deployments, this will be an instance of BootCache. On older deployments, Civix may polyfill with a work-a-like.
*/
return function ($mixInfo, $bootCache) {
/**
* @param \Civi\Core\Event\GenericHookEvent $e
* @see CRM_Utils_Hook::entityTypes()
*/
Civi::dispatcher()->addListener('hook_civicrm_entityTypes', function ($e) use ($mixInfo) {
// When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically.
if (!$mixInfo->isActive() || !is_dir($mixInfo->getPath('schema'))) {
return;
}
$files = (array) glob($mixInfo->getPath('schema/*.entityType.php'));
foreach ($files as $file) {
$entity = include $file;
$entity['module'] = $mixInfo->longName;
$e->entityTypes[$entity['name']] = $entity;
}
});
};

View File

@ -0,0 +1,78 @@
<?php
/**
* Auto-register "templates/" folder.
*
* @mixinName smarty-v2
* @mixinVersion 1.0.3
* @since 5.59
*
* @deprecated - it turns out that the mixin is not version specific so the 'smarty'
* mixin is preferred over smarty-v2 (they are the same but not having the version
* in the name is less misleading.)
*
* @param CRM_Extension_MixInfo $mixInfo
* On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
* @param \CRM_Extension_BootCache $bootCache
* On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
*/
return function ($mixInfo, $bootCache) {
$dir = $mixInfo->getPath('templates');
if (!file_exists($dir)) {
return;
}
$register = function($newDirs) {
$smarty = CRM_Core_Smarty::singleton();
$v2 = isset($smarty->_version) && version_compare($smarty->_version, 3, '<');
$templateDirs = (array) ($v2 ? $smarty->template_dir : $smarty->getTemplateDir());
$templateDirs = array_merge($newDirs, $templateDirs);
$templateDirs = array_unique(array_map(function($v) {
$v = str_replace(DIRECTORY_SEPARATOR, '/', $v);
$v = rtrim($v, '/') . '/';
return $v;
}, $templateDirs));
if ($v2) {
$smarty->template_dir = $templateDirs;
}
else {
$smarty->setTemplateDir($templateDirs);
}
};
// Let's figure out what environment we're in -- so that we know the best way to call $register().
if (!empty($GLOBALS['_CIVIX_MIXIN_POLYFILL'])) {
// Polyfill Loader (v<=5.45): We're already in the middle of firing `hook_config`.
if ($mixInfo->isActive()) {
$register([$dir]);
}
return;
}
if (CRM_Extension_System::singleton()->getManager()->extensionIsBeingInstalledOrEnabled($mixInfo->longName)) {
// New Install, Standard Loader: The extension has just been enabled, and we're now setting it up.
// System has already booted. New templates may be needed for upcoming installation steps.
$register([$dir]);
return;
}
// Typical Pageview, Standard Loader: Defer the actual registration for a moment -- to ensure that Smarty is online.
// We need to bundle-up all dirs -- Smarty 3/4/5 is inefficient with processing repeated calls to `getTemplateDir()`+`setTemplateDir()`
if (!isset(Civi::$statics[__FILE__]['event'])) {
Civi::$statics[__FILE__]['event'] = 'civi.smarty-v2.addPaths.' . md5(__FILE__);
Civi::dispatcher()->addListener('hook_civicrm_config', function() use ($register) {
$dirs = [];
$event = \Civi\Core\Event\GenericHookEvent::create(['dirs' => &$dirs]);
Civi::dispatcher()->dispatch(Civi::$statics[__FILE__]['event'], $event);
$register($dirs);
});
}
Civi::dispatcher()->addListener(Civi::$statics[__FILE__]['event'], function($event) use ($mixInfo, $dir) {
if ($mixInfo->isActive()) {
array_unshift($event->dirs, $dir);
}
});
};

View File

@ -1,4 +1,12 @@
<?php
/*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+--------------------------------------------------------*/
/*
* Settings metadata file
@ -16,7 +24,7 @@ return array(
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Enables or disables the proxy',
'help_text' => 'TODO',
'help_text' => '',
),
'proxy_url' => array(
'group_name' => 'CiviProxy Settings',
@ -28,7 +36,7 @@ return array(
'is_domain' => 1,
'is_contact' => 0,
'description' => 'The URL from which the proxy will be available for requests',
'help_text' => 'TODO',
'help_text' => '',
),
'proxy_version' => array(
'group_name' => 'CiviProxy Settings',
@ -40,6 +48,18 @@ return array(
'is_domain' => 1,
'is_contact' => 0,
'description' => 'The version of the currently selected proxy',
'help_text' => 'TODO',
'help_text' => '',
),
'custom_mailing_base' => array(
'group_name' => 'CiviProxy Settings',
'group' => 'de.systopia',
'name' => 'custom_mailing_base',
'type' => 'String',
'default' => "",
'add' => '4.3',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'The URL can override the proxy for custom designed mailing subscribe/unsubscribe pages',
'help_text' => '',
),
);

View File

@ -1,3 +1,12 @@
{*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+-------------------------------------------------------*}
{htxt id='id-proxy-enabled'}
<p>
{ts}Activating CiviProxy will cause all resource URLs (images, URL trackers, mail open tracers, etc.) to point to the proxy.{/ts}
@ -16,8 +25,8 @@
</p>
{/htxt}
{htxt id='id-extoptout-url'}
{htxt id='id-custom-mailing-base'}
<p>
{ts}TODO #2{/ts}
{ts}The path for the default unsubscribe page. You can use the default in CiviProxy or create your own and add the path here{/ts}
</p>
{/htxt}

View File

@ -1,3 +1,11 @@
{*-------------------------------------------------------+
| CiviProxy |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+--------------------------------------------------------+
| License: AGPLv3, see /LICENSE |
+-------------------------------------------------------*}
<div class="crm-block crm-form-block">
<div>
<h3>{ts}Basic Settings{/ts}</h3>
@ -20,21 +28,21 @@
</div>
</div>
</div>
{* ==== advanced settings disabled ========
<br/>
<div>
<h3>{ts}Advanced Settings{/ts}</h3>
<h3>{ts}Mailing Settings{/ts}</h3>
<div>
<div>
<table id="component_settings" class="no-border">
<table id="core_settings" class="no-border">
<tr>
<td class="label">{$form.civimail_external_optout.label} <a onclick='CRM.help("{ts}CiviMail: External opt-out page{/ts}", {literal}{"id":"id-extoptout-url","file":"CRM\/Admin\/Form\/Setting\/ProxySettings"}{/literal}); return false;' href="#" title="{ts}Help{/ts}" class="helpicon">&nbsp;</a></td>
<td>{$form.civimail_external_optout.html}</td>
<td class="label">{$form.custom_mailing_base.label}&nbsp;<a onclick='CRM.help("{ts}CiviMail: Custom pages{/ts}", {literal}{"id":"id-custom-mailing-base","file":"CRM\/Admin\/Form\/Setting\/ProxySettings"}{/literal}); return false;' href="#" title="{ts}Help{/ts}" class="helpicon">&nbsp;</a></td>
<td>{$form.custom_mailing_base.html}</td>
</tr>
</table>
</div>
</div>
</div>
==== advanced settings disabled ======== *}
<br/>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
@ -42,24 +50,29 @@
<script type="text/javascript">
function enableInput() {
cj('#proxy_url').attr('disabled',!this.checked);
cj('#civimail_external_optout').attr('disabled', !this.checked);
cj('#custom_mailing_base').attr('disabled', !this.checked);
}
function enableInputGlobal() {
var is_enabled = cj('#proxy_enabled').attr('checked') == 'checked';
cj('#proxy_url').attr('disabled', !is_enabled);
cj('#civimail_external_optout').attr('disabled', !is_enabled);
cj('#custom_mailing_base').attr('disabled', !is_enabled);
}
(function(cj) {
cj('#proxy_enabled').click(enableInput);
enableInputGlobal();
// set the default value to {$proxy_url}/mailing
if (cj("#custom_mailing_base").val().length == 0) {
cj("#custom_mailing_base").val(cj("#proxy_url").val() + '/mailing');
}
})(cj);
</script>
<style type="text/css">
#proxy_url, #civimail_external_optout {
#proxy_url, #custom_mailing_base {
width: 350px;
}

223
docs/configuration.md Normal file
View File

@ -0,0 +1,223 @@
# How to configure CiviProxy
!!! caution
We assume you have a very basic understanding of PHP and editing PHP files. If you do not, it is probably a good idea to get some support from a CiviCRM expert. You can find one on [Find an Expert](https://civicrm.org/partners-contributors).
## Configuration of the CiviCRM extension
You can use CiviProxy to do a couple of things related to mails and mailing for you.
* You can still see all the stuff on the CiviMailing report like the click-throughs and bounces and such.
* You do not want the links in your bulk mailing or individual mails to immediately feed back to your CiviCRM installation but pass through CiviProxy.
* You want your subscribe/unsubscribe links to pass through CiviProxy rather than go directly to your CiviCRM installation.
If you want to do any of these things, you will need to install and configure the CiviCRM extension **de.systopia.civiproxy** in your CiviCRM installation.
If you have not installed the extension already, check [Installing CiviCRM](installation.md) for instructions how to.
!!! note
If you do not install the **de.systopia.civiproxy** extension you can still use CiviProxy to whitelist your API requests.
Once you have installed the CiviCRM extension you will need to configure the CiviProxy settings. To do this, go to **Administer>Administration Console**. You will see the CiviProxy Settings in the System Settings section of the menu as you can see below.
![Administration Console - System Settings](img/administration_console.png)
If you click on the CiviProxy Settings you will get a page with a few settings for CiviProxy. If you access the page for the first time these will be empty. The settings you can enter are:
1. A checkbox CiviProxy Enabled to enable or disable the CiviProxy functionality with your CiviCRM mailing links.
1. A text field Proxy URL where you can add the URL of your CiviProxy server. This link will be validated and the version of the CiviProxy will be shown. If the URL does not meet the validation (does not contain a valid CiviProxy installation), there will be an error message.
1. A text field Custom Subscribe/Unsubscribe Pages for a path to the unsubscribe page that will be used. There is a basic unsubscribe page on your CiviProxy server, the path to this page will be the default. If the default unsubscribe page is not what you would like, then you can either update the page in the CiviProxy installation on your server or create your own page and set the URL here.
!!! note
If you do create your own subscription page make sure the parameters and returns and such are the same as in the default unsubscribe page!
In the screen print below you can see the CiviProxy Settings page with the values I have used for my test installation when producing this guide.
![Example CiviProxy Settings](img/civicrm_proxy_settings.png)
## Configuration of the CiviProxy server
The CiviProxy server is the actual policeman that receives all requests and decides if they are allowed to send data to or retrieve data from CiviCRM. It consists of a series of scripts which you need to install on the server as explained in [Installing CiviProxy](installation.md).
Once you have installed your CiviProxy server you need to complete a few configuration steps.
### The Config.php file
The configuration of CiviProxy is mainly controlled with one PHP file called `config.php`. Create this file by copying or renaming the `config.dist.php` file.
![List of files on your CiviProxy server](img/file%20list%20proxy.png)
### Configuring the URL of your CiviProxy server
First thing you need to configure is the base URL of your CiviProxy server using the `$proxy_base` variable in the `config.php` file. As I have used a local test installation I have used `http://localhost/proxy`:
```php
// this should point to the base address of the CiviProxy installation
$proxy_base = 'http://localhost/proxy';
```
!!! note
This guide assumes a Drupal7 target CiviCRM with clean URLs enabled. If this is not the case for you, you might have to adjust the URLs and/or encounter issues. If so, please report on GitHub!
### Configuring the link to the secure target CiviCRM
Next thing you want to configure is what your target CiviCRM is. This is the CiviCRM installation which you want CiviProxy to police, so the one where the actual data resides and is collected from or sent to.
The assumption is that this CiviCRM resides in some kind of VPN and will accept traffic only from the CiviProxy IP address (and probably a few trusted others like home workers or support people).
You can set the URL of the target CiviCRM using the variable `$target_civirm` in the `config.php` file. Again, I have used a local test installation:
```php
// this should point to the target CiviCRM system
$target_civicrm = 'http://localhost/ehdev';
```
### Setting for the click tracking url
There is a setting in CiviCRM which is used for tracking the clicks in your mailing. On your CiviProxy server this setting is captured in the variable `$target_url` in the `config.php` file:
```php
$target_url = $target_civicrm . '/civicrm/mailing/url';
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
### Setting for the open tracking
CiviCRM tracks if a mailing has been opened in a certain way. CiviProxy has this setting in the variable `$target_open` in the `config.php` file:
```php
$target_open = $target_civicrm . '/civicrm/mailing/url/open.php';
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
### Setting for the location of images and included files in your mail(ing)
CiviCRM stores images and attachments you include in your (bulk) mail in a specific folder. In CiviProxy the name of this folder is stored in variable `$target_file` in the `config.php` file:
```php
$target_file = $target_civicrm . '/sites/default/files/civicrm/persist/';
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
!!! note
By default CiviProxy will cache the files so it does not have to file from CiviCRM for each individual mail that is part of a bulk mailing. The default settings can be found in the `config.php` file:
```php
/****************************************************************
** File Caching Options **
****************************************************************/
// define file cache options, see http://pear.php.net/manual/en/package.caching.cache-lite.cache-lite.cache-lite.php
$file_cache_options = array(
'cacheDir' => 'file_cache/',
'lifeTime' => 86400
);
// define regex patterns that shoud NOT be accepted
$file_cache_exclude = array();
// if set, cached file must match at least one of these regex patterns
$file_cache_include = array(
//'#.+[.](png|jpe?g|gif)#i' // only media files
);
```
You can update these settings if you should want to.
You can find documentation on the caching engine used in CiviProxy [here](http://pear.php.net/manual/en/package.caching.cache-lite.cache-lite.cache-lite.php)
### Setting for the view unformatted mail link
If CiviCRM sends a mail you can get a link to view the mail unformatted. CiviProxy keeps this setting in a variable `$target_mail_view` in the `config.php` file:
```php
$target_mail_view = $target_civicrm . '/civicrm/mailing/view';
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
### Setting for the REST API requests
When you want to use the CiviCRM API from another server than the one CiviCRM itself resides on you will do so using the REST interface.
!!! seealso
Generic information on CiviCRM with REST [here](https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface)
CiviProxy has a setting which specifies where the REST script is located in the variable `$target_rest` in the `config.php` file:
```php
$target_rest = $target_civicrm . '/sites/all/modules/civicrm/extern/rest.php';
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
### Configuring the API key for (un)subscribe
CiviCRM allows subscribe/unsubscribe links in mailings. To process these a user needs to be configured with a specific API key. In CiviProxy this API key is held in the `config.php` file in variable ``:
```php
$mail_subscription_user_key = 123teSt!ExaMpl1;
```
If you set it to the value NULL this functionality will not be available on your CiviProxy server.
### Configuring the API and Site key
To be able to access your target CiviCRM with the API using REST you will need to configure an API key and a site key. Actually, you will most likely need more to be able if more outside applications are allowed to access your target CiviCRM.
!!! seealso
Generic information on CiviCRM with REST [here](https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface)
In CiviProxy you can either store the API and Site keys directly in the `config.php` file or you can include a `secrets.php` file in your installation which holds your key values.
Whatever method you prefer, you will have to end up with an array like the one below:
```php
$api_key_map = array('eR1k!tSt4321' => 'cal1Mer0#tST');
$sys_key_map = array('1234#tsT#eR1k' => 'p1P0!tEst1Ng5678');
```
As you can see you can give the application that is accessing you different keys than the ones you use to access your target CiviCRM.
So in this example I will explain to the party wanting to access my CiviProxy that they have to use the key _1234#tsT#eR1k_ and the api key _eR1k!tSt4321_. My target CiviCRM will expect site key _p1P0!tEst1Ng5678_ and the api key _cal1Mer0#tST_.
### Whitelisting API requests
Even if you have entered your API and Site key, and the setting for the target REST is ok, you will not be able to use any API calls through CiviProxy just yet. As CiviProxy uses the **whitelisting** principle by default **no** API calls are allowed unless they have been whilelisted.
Also **parameter sanitation** is used. This means that only the specified parameters are allowed, and only content data of the specified type will be allowed.
You can whitelist an API entity and action (and a set of allowed parameters) for all request from outside, but you can also whitelist an API entity and action ONLY if it comes from a specific IP address.
!!! note
The address of the request is checked with the PHP variable `$_SERVER['REMOTE_ADDR']`
In the example below you will see the possible configuration:
* the API `Contact getsingle` with parameter `email` is allowed for all servers making a request to CiviProxy,
* the API `Contact getsingle` with parameters `first_name` and `last_name` is only allowed if it is requested from IP address 123.45.678.1.
```php
$rest_allowed_actions = array(
'all' => array(
'Contact' => array(
'getsingle' => array(
'email' => 'string',
),
),
),
'123.45.678.1' => array(
'Contact' => array(
'getsingle' => array(
'first_name' => 'string',
'last_name' => 'string',
),
),
),
);
```
!!! note
In earlier versions of CiviProxy this format was allowed for `$rest_allowed_actions`:
```php
$rest_allowed_actions = array(
'Contact' => array(
'getsingle' => array(
'email' => 'string',
),
),
);
```
That format will still work, but is considered **deprecated** and you are encouraged to adapt to the new format described in the section above.
!!! caution
A little bit of developer background....Obviously you can use the core CiviCRM API's but you have to think carefully of the parameter sanitation. Techically what happens is that if any parameters are passed to CiviProxy that are not _allowed_, they are ignored when the API request is passed to CiviCRM. This could lead to undesired behaviour. Consider this example:
* we have allowed the `Contact Get` API with only the parameter `email`
* the request we get in CiviProxy has the `Contact Get` but the parameters `first_name` and `last_name`
* because `first_name` and `last_name` are not whitelisted, they get ignored and a `Contact Get` without parameters if passed to the target CiviCRM, returning the first 25 contacts are a result...which is not what we wanted.
We recommend solving these situations by developing specific API's rather than using the core ones. And if you think of a good solution feel free to raise an issue or do a PR!
### Debug setting
CiviProxy has a `$debug` setting which allows you to add the name of a text file where all requests are send to. This can be used during the initial testing to see if everything is processed correcty.
```php
// CAREFUL: only enable temporarily on debug systems. Will log all queries to given PUBLIC file
$debug = NULL; //'debug.log';
```
If you set the `$debug` setting to NULL this feature will not be used.
!!! warning
We recommend only using this debug feature in the testing face, never on an active production installation as it can produce a massive log file quite easily.
### Target Interface setting
There is a setting for a local network interface or IP to be used for relayed queries. If you have no idea what this is about, just leave it as is.
```php
// Local network interface or IP to be used for the relayed query
// This is usefull in some VPN configurations (see CURLOPT_INTERFACE)
$target_interface = NULL;
```
!!! tip
We do advice you to monitor what request are still being fired directly to your target CiviCRM once you installed and configured CiviProxy, and then find solutions for the situations if you still see some undesired access requests.

5
docs/enhancements.md Normal file
View File

@ -0,0 +1,5 @@
# Future enhancements for CiviProxy
At the moment there are a few future enhancements, bug fixes and small suggested changes, as you can see on the [issue list](https://github.com/systopia/CiviProxy/issues).
!!! tip
If you want to report bugs or suggest future enhancements please do so on the [issue list](https://github.com/systopia/CiviProxy/issues).

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
docs/img/network.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

68
docs/index.md Normal file
View File

@ -0,0 +1,68 @@
# Introduction
## Public facing website and CiviCRM
In the CiviCRM world it is a fairly typical requirement to want your public facing website and CiviCRM to communicate with each other.
You would probably want to do stuff like:
* Allow website visitors to sign a petition, make a donation or register for an event.
* Allow registered website visitors to view and perhaps update their own data.
* Get website visitors to sign up (or unsubscribe) for newsletters.
However, for security and maintainability purposes it is recommended that you separate your CiviCRM installation and your public facing website. Factors that might influence this:
* Your biggest security risk is probably your public facing website where you want the whole world to be able to check, browse and do stuff, even without identifying themselves.
* The data you want to protect the most is quite likely to be part of CiviCRM (data on your donors, peope who sign petitions, email addresses etc.).
* You will need to install security upgrades on your website regularly as this is exposed to the public. However, you do not want to test all your business processes with each upgrade (which you will need to do if you have both website and CiviCRM on the same server to be sure they continue to work together).
So we think it is a sound practise to separate CiviCRM and your public facing website, and mainly use the CiviCRM API to send data to or get data from CiviCRM.
However, we do not want every authorized user to be able to use all the API possibilities. And we also do not want to allow any user access to the CiviCRM API.
And that is where **CiviProxy** comes in!
## How does it work?
The basic idea is to first put your CiviCRM (with probably a dummy CMS which you could use for your intranet) server into a VPN. This makes the server virtually inaccessible from the internet, and your users or your whole office will access it via a secure connection.
But what about your public web pages, donation pages, data exchange with other systems, API request? This is where CiviProxy comes in: You get a small, secure, extra server and give it access to both, the internet and your VPN. It will act as a safe gateway for selected features of your CiviCRM that you would like to expose.
In an example picture:
![a picture of an example network architecture](img/network.png)
The advantages in a nutshell :thumbsup:
* CiviProxy is CiviCRM specific, so it kind of understands how CiviCRM works. It is **designed** to work with CiviCRM in a fairly simple way.
* CiviProxy uses **whitelisting**. This means it starts with the principle _nothing is allowed_ and then lets you configure what is allowed, rather than the other way around.
* CiviProxy uses **parameter sanitation**, meaning that only named parameters are allowed, and then only with the allowed content type (string, integer etc.).
## What can it do?
Currently CiviProxy can expose/relay the following CiviCRM functions
1. Serve resources for newsletters and mailings.
1. Cache those resources, taking load off your CiviCRM server.
1. Pass-through of tracking data on opening and click-through rates.
1. Sign-on and off of your newsletter (Webpage templates).
1. Relay of whitelisted REST API calls for data exchange with other systems.
1. Perform input sanitation and parameter whitelisting for the REST API calls.
!!! attention
This software has not (yet) been audited for security.
## Why not an application firewall?
The traditional approach to this problem would be an application firewall / reverse proxy setup. However, CiviCRM can have very complex interactions with other systems (e.g. via the API), and a malicious request can sometimes only be detected by understanding the meaning of the individual parameters.
Creating firewall rules for this level of detail is very complex and is very hard to maintain.
For this reason we wanted to take another approach and build a simple "bridgehead" system that *understands* CiviCRM, thus making its configuration and maintenance as easy as possible.
## Contents of this guide
In this guide you will find pages on:
* [technical requirements for CiviProxy](requirements.md)
* [how to install CiviProxy](installation.md)
* [how to configure CiviProxy](configuration.md)
* [what to do if an outside application wants to communicate with CiviProxy](outside.md)
* [future enhancements for CiviProxy](enhancements.md)
!!! note
This documentation is based on release 0.4 of CiviProxy.
!!! note
In the guide we assume Drupal is the CMS of your target CiviCRM. Most of the stuff is CMS agnostic but you might have to change some of the URL's in the examples.

56
docs/installation.md Normal file
View File

@ -0,0 +1,56 @@
# Installation
CiviProxy has to run on its own server (with its own IP address) for maximum effect.
The best option for a server on which you can install CiviProxy is a simple managed webspace, that you can rent cheaply from the hoster of your choice. It should have its own IP address, but other than that there are virtually no restrictions. This approach comes with a lot of advantages:
* Since there are a multitude of clients like you on such a server, the level of security can be expected to be very high, and it should be managed and monitored by professionals 24/7.
* For the same reason, the bandwith and connectivity of such a server should be very high as well.
* The price should not have to be huge.
!!! note
Obviously there is nothing stopping you from installing CiviProxy on a server you manage yourself, but that then automatically means you have to ensure you maintain a high level of security and update the stuff regularly!
Installing CiviProxy should be pretty straightforward:
* Download the GitHub repository from [https://github.com/systopia/CiviProxy](https://github.com/systopia/CiviProxy).
* In your repository are actually two relevant parts:
* A CiviCRM extension called **de.systopia.civiproxy** that you can use to send mailings (newsletters) from CiviCRM. This should be installed on your target CiviCRM installation.
* A **proxy** folder with the scripts that you need to install on your CiviProxy server.
* On top of that there will also be a **docs** folder containing this guide and a few necessary files (which are needed but you can ignore):
* LIBRARIES.md
* LICENSE
* README.md
* mkdocs.yml
## Installing the CiviCRM extension on your target CiviCRM
* copy the folder **de.systopia.civiproxy** that you downloaded in the previous step into your CiviCRM extensions folder. You should be able to find your civicrm extensions folder in **Administer>System Settings>Directories**. If you have never touched or changed this it will look like screen print below. In that case your folder is probably `<your civicrm folder>/sites/default/files/civicrm/ext/`
!!! seealso
![Screen print of the Administer>System Settings>Directories form](img/civicrm_directories.png)
* go to **Administer>System Settings>Extensions** to see a page with all the installed extensions on your CiviCRM installation. You will have to click the **Refresh** button to see the **de.systopia.civiproxy** extension. Click the **Install** action listed behind the extension information. Upon successfull installation you should see a list like the one below (although you will probably see a larger list as you will have more extensions installed).
!!! seealso
![Screen print of the extensions page after successfull installation](img/extensions_list.png)
* type the URL`http://example.org/civicrm/clearcache` to clear the caches and rebuild the menu. This is necessary to add the CiviProxy settings page to CiviCRM.
!!! note
use the URL `http://example.org/?q=civicrm/clearcache` if CleanUrls are not enabled
* you should now be able to access the CiviProxy Settings page with **Administer>Administration Console** (in the menu section System Settings) or with the URL `http://example.org/civicrm/admin/setting/civiproxy`.
!!! note
use the URL `http://example.org/?q=civicrm/admin/setting/civiproxy` if CleanUrls are not enabled
!!! note
If you want to you can add the CiviProxy Settings page to your Administration menu with Administer/Customize Data and Screens/Navigation Menu.
* check the [Configuring CiviProxy](configuration.md) page to see how to configure the CiviProxy extension.
## Installing the Proxy scripts your your CiviProxy server
1. Copy the **proxy** folder on the webspace you want to use for CiviProxy
2. Create a `config.php` file using `config.dist.php` as a template.
See [Configuring CiviProxy](configuration.md) for details on what you need to include in the `config.php` file.

12
docs/outside.md Normal file
View File

@ -0,0 +1,12 @@
# What to do if an outside application wants to communicate with CiviProxy
In most cases when an outside application (for example the public website, or maybe even a center webservice) wants to access CiviProxy to be able to retreive data from CiviCRM or send data to CiviCRM they will want to use the API.
In that case you should provide them with the Site key and an API key they can use. We recommend you do NOT use the CiviCRM Site Key and API Key.
!!! tip
If you do not know how to do this check [Configuring CiviProxy](configuration.md).
They will have to use your CiviProxy URL in their REST request, and you will need to provide them with that URL. In my local example the call to the CiviProxy server would be:
```
http://localhost/proxy/rest.php?entity=Contact&action=getsingle&key=erikhtestkey&version=3&json=1&api_key=testerikhapikey&email=pipotest@example.org
```

10
docs/requirements.md Normal file
View File

@ -0,0 +1,10 @@
# Technical Requirements
There shouldn't be any requirements that any web hoster wouldn't comply with, but here they are:
1. PHP 5.3+
2. PHP PEAR (to install on Debian/Ubuntu, run `apt-get install php-pear`)
3. The `php-curl` module
4. Read/write permissions on your webspace
5. Reasonable amount of protection, i.e. only authorised users (you) can upload/download the files
6. Ideally with it's own IP address (makes configuring the VPN easier)

25
mkdocs.yml Normal file
View File

@ -0,0 +1,25 @@
site_name: CiviProxy Guide
site_description: Guide using and installing CiviProxy to manage the traffic to and from your CiviCRM installation
repo_url: https://github.com/systopia/CiviProxy
theme:
name: material
nav:
- Introduction: index.md
- Technical Requirements: requirements.md
- Installing CiviProxy: installation.md
- Configuring CiviProxy: configuration.md
- Directing an outside application to CiviProxy: outside.md
- Future enhancements to CiviProxy: enhancements.md
markdown_extensions:
- attr_list
- admonition
- def_list
- codehilite
- toc:
permalink: true
- pymdownx.superfences
- pymdownx.emoji

6
proxy/.htaccess Normal file
View File

@ -0,0 +1,6 @@
# Serve
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/civicrm/ajax/api4
RewriteRule ^civicrm/ajax/api4/([^/]*)/([^/]*) rest4.php?entity=$1&action=$2 [QSA,B]
</IfModule>

View File

@ -1,5 +0,0 @@
TODO
1) sanitize string values (mysql_escape_string?)
2) better index page
3) error page

82
proxy/checks.php Normal file
View File

@ -0,0 +1,82 @@
<?php
/**
* generates a CiviCRM REST API compliant error
* and ends processing
*/
function civiproxy_rest_error($message) {
$error = array( 'is_error' => 1,
'error_message' => $message);
// TODO: Implement header();
print json_encode($error);
exit();
}
/**
* Updates $credentials['api_key'] in-place, or displays an error if api key
* is missing or does not correspond to an entry in $api_key_map (which should
* be set in config.php).
* @param array $credentials
* @param array $api_key_map
*/
function civiproxy_map_api_key(array &$credentials, array $api_key_map) {
if (empty($credentials['api_key'])) {
civiproxy_rest_error("No API key given");
}
else {
if (isset($api_key_map[$credentials['api_key']])) {
$credentials['api_key'] = $api_key_map[$credentials['api_key']];
}
else {
civiproxy_rest_error("Invalid api key");
}
}
}
/**
* Updates $credentials['key'] in-place, or displays an error if site key
* is missing or does not correspond to an entry in $sys_key_map (which should
* be set in config.php).
* @param array $credentials
* @param array $sys_key_map
*/
function civiproxy_map_site_key(array &$credentials, array $sys_key_map) {
if (empty($credentials['key'])) {
civiproxy_rest_error("No site key given");
}
else {
if (isset($sys_key_map[$credentials['key']])) {
$credentials['key'] = $sys_key_map[$credentials['key']];
}
else {
civiproxy_rest_error("Invalid site key");
}
}
}
/**
* @param array $action should have both 'entity' and 'action' keys set
* @param array $rest_allowed_actions from config.php
* @return array
*/
function civiproxy_get_valid_parameters(array $action, array $rest_allowed_actions) {
// in release 0.4, allowed entity/actions per IP were introduced. To introduce backward compatibility,
// the previous test is still used when no 'all' key is found in the array
if (isset($rest_allowed_actions['all'])) {
// get valid key for the rest_allowed_actions
$valid_allowed_key = civiproxy_get_valid_allowed_actions_key($action, $rest_allowed_actions);
$valid_parameters = civiproxy_retrieve_api_parameters($valid_allowed_key, $action['entity'], $action['action'], $rest_allowed_actions);
if (!$valid_parameters) {
civiproxy_rest_error("Invalid entity/action.");
}
}
else {
if (isset($rest_allowed_actions[$action['entity']]) && isset($rest_allowed_actions[$action['entity']][$action['action']])) {
$valid_parameters = $rest_allowed_actions[$action['entity']][$action['action']];
}
else {
civiproxy_rest_error("Invalid entity/action.");
}
}
return $valid_parameters;
}

217
proxy/config.dist.php Normal file
View File

@ -0,0 +1,217 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
/****************************************************************
** INSTALLATION **
** **
** 0. Read https://docs.civicrm.org/civiproxy/en/latest **
** 1. Make a copy of this file called config.php **
** 2. Adjust the parameters and enable needed features **
** 3. Some features (like mailings) require the CiviProxy **
** extension to be enabled on the target CiviCRM **
** **
****************************************************************/
/****************************************************************
** URLS **
****************************************************************/
// this should point to the base address of the CiviProxy installation
$proxy_base = 'https://proxy.yourdomain.org';
// this should point to the target CiviCRM system
$target_civicrm = 'https://your.civicrm.installation.org';
/****************************************************************
** FEATURES / DEFAULT PATHS **
** **
** set to NULL to disable a feature **
****************************************************************/
// default paths, override if you want. Set to NULL to disable
$target_rest = $target_civicrm . '/sites/all/modules/civicrm/extern/rest.php';
// base URL for api4 calls. Will append entity and action path segments
$target_rest4 = $target_civicrm . '/civicrm/ajax/api4/';
$target_file = $target_civicrm . '/sites/default/files/civicrm/persist/';
$target_mosaico = NULL; // (disabled by default): $target_civicrm . '/civicrm/mosaico/img?src=';
$target_mosaico_template_url = NULL; // (disabled by default): $target_civicrm . '/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/';
$target_mail_view = $target_civicrm . '/civicrm/mailing/view';
$target_url = $target_civicrm . '/civicrm/mailing/url';
$target_open = $target_civicrm . '/civicrm/mailing/open';
// CAUTION: use the following for CiviCRM < 5.27 or "Extern URL Style" = "Standalone Scripts"
//$target_url = $target_civicrm . '/sites/all/modules/civicrm/extern/url.php';
//$target_open = $target_civicrm . '/sites/all/modules/civicrm/extern/open.php';
/****************************************************************
** GENERAL OPTIONS **
****************************************************************/
// This logo is shown if the proxy server is address with a web browser
// add your own logo here
$civiproxy_logo = "<img src='{$proxy_base}/static/images/proxy-logo.png' alt='SYSTOPIA Organisationsberatung'></img>";
// Set api-key for mail subscribe/unsubscribe user
// Set to NULL/FALSE to disable the feature
// Can/shoud also be defined in secrets.php
$mail_subscription_user_key = NULL;
// CAREFUL: only enable temporarily on debug systems.
// Will log all queries to given PUBLIC file
// Also: use some random name (not this one!)
$debug = NULL; //'LUXFbiaoz4dVWuAHEcuBAe7YQ4YP96rN4MCDmKj89p.log';
// Local network interface or IP to be used for the relayed query
// This is useful in some VPN configurations (see CURLOPT_INTERFACE)
$target_interface = NULL;
/***************************************************************
** Authentication Options **
***************************************************************/
// API and SITE keys (you may add keys here)
$api_key_map = [
'my_api_key' => 'my_api_key', // use this to allow API key
'ext_api_key' => 'real_api_key' // use this to allow and map API key
];
$sys_key_map = [
'REAL_SITE_KEY' => 'REAL_SITE_KEY', // use this to allow site key
'EXT_SITE_KEY' => 'REAL_SITE_KEY' // use this to allow and map site key
];
// source secrets.php to overwrite keys
if (file_exists(dirname(__FILE__)."/secrets.php")) {
// keys can also be stored in 'secrets.php'
require "secrets.php";
}
// Parameter whitelisting for open tracking and URL tracking
// basic civicrm URL/open parameter are u, q and qid (as int)
// If additional parameters are needed, best practise would be to whitelist each one as needed in
// $valid_url_parameters and/or $valid_open_parameters.
// Alternatively it is also possible to allow all parameters with the wildcard parameter '*' => 'string'
$valid_url_parameters = [
'u' => 'int',
'q' => 'int',
'qid' => 'int',
// '*' => 'string' // whildcard, whitelist all url parameters
];
$valid_open_parameters = [
'u' => 'int',
'q' => 'int',
'qid' => 'int',
// '*' => 'string' // wildcard, whitelist *all* open parameters
];
// CiviCRM's API can authenticate with different flows
// https://docs.civicrm.org/dev/en/latest/framework/authx/#flows
// CiviProxy supports 'header', 'xheader', 'legacyrest', and 'param'.
// These flows are supported for API4 but could be extended to API3.
// $authx_internal_flow controls how CiviProxy sends credentials to CiviCRM, and
// $authx_external_flow where CiviProxy looks for credentials on incoming requests.
// The internal setting needs to have a single scalar value, but the
// external setting can be an array of accepted flows.
// There is no standard header for site key, so in both header and xheader
// flows it uses X-Civi-Key
$authx_internal_flow = 'header';
$authx_external_flow = ['legacyrest'];
/****************************************************************
** File Caching Options **
****************************************************************/
// define file cache options, see http://pear.php.net/manual/en/package.caching.cache-lite.cache-lite.cache-lite.php
$file_cache_options = [
'cacheDir' => 'file_cache/',
'lifeTime' => 86400
];
// define regex patterns that shoud NOT be accepted
$file_cache_exclude = [];
// if set, cached file must match at least one of these regex patterns
$file_cache_include = [
//'#.+[.](png|jpe?g|gif)#i' // only media files
];
/****************************************************************
** REST API OPTIONS **
****************************************************************/
// if you enable this, the system will also try to
// parse the 'json' parameter, which holds additional
// input data according to the CiviCRM REST API specs
$rest_evaluate_json_parameter = FALSE;
// whitelisting is done per IP address ($_SERVER['REMOTE_ADDR']) with a 'all' for the generic stuff that applies to all IP addresses
// - if a request comes in and the IP is not a key in the array, the whitelisted in 'all' are used
// - if a request comes in and the IP is indeed a key in the array, the whitelisted in the IP are checked first. If nothing is
// found ,the 'all' ones are checked next.
$rest_allowed_actions = [
'all' => [
'Contact' => [
'getsingle' => [
'email' => 'string',
],
],
],
'123.45.67.8' => [
'Contact' => [
'getsingle' => [
'first_name' => 'string',
'last_name' => 'string',
// the following means *all* remaining parameters will be
// added and sanitised as 'string'. Better leave it out
// if you know which parameters you expect
'*' => 'string',
],
],
],
];
/****************************************************************
** WebHook2API CONFIGURATIONS **
** Translates typical webhook calls into CiviCRM API calls **
****************************************************************/
// Example configuration:
// remove if you don't want this feature or rename to $webhook2api to activate
$_webhook2api = [
"configurations" => [
"default" => [
"name" => "Example",
"ip_sources" => ['172.10.0.1/24', '192.168.1.1/24'], // only accept source ID from the given range
"data_sources" => ["POST/json", "REQUEST"], // POST/json json-decodes the post data, REQUEST is PHP's $_REQUEST array
"sentinel" => [["type", "equal:customer.created"]], // only execute if all of these are true
"entity" => "Contact",
"action" => "create",
"api_key" => "api key",
"parameter_mapping" => [
[["data", "object", "metadata", "salutation"], ["prefix_id"]],
[["data", "object", "metadata", "first_name"], ["first_name"]],
[["data", "object", "metadata", "last_name"], ["last_name"]],
[["data", "object", "metadata", "street"], ["street_address"]],
[["data", "object", "metadata", "zip_code"], ["postal_code"]],
[["data", "object", "metadata", "city"], ["city"]],
[["data", "object", "metadata", "country"], ["country_id"]],
[["data", "object", "metadata", "telephone"], ["phone"]],
[["data", "object", "metadata", "birthday"], ["birth_date"]],
[["data", "object", "metadata", "email"], ["email"]]
],
"parameter_sanitation" => [],
]
]
];

View File

@ -1,114 +0,0 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
/****************************************************************
** URLS **
****************************************************************/
// this should point to the base address of the CiviProxy installation
$proxy_base = 'https://ssl.webpack.de/wp11230065.server-he.de';
// this should point to the target CiviCRM system
$target_civicrm = 'https://crmtest.muslimehelfen.org';
//$proxy_base = 'http://localhost:8888/proxy';
/****************************************************************
** DEFAULT PATHS **
** **
** set to NULL to disable a feature **
****************************************************************/
// default paths, override if you want. Set to NULL to disable
$target_rest = $target_civicrm . '/sites/all/modules/civicrm/extern/rest.php';
$target_url = $target_civicrm . '/sites/all/modules/civicrm/extern/url.php';
$target_open = $target_civicrm . '/sites/all/modules/civicrm/extern/open.php';
$target_file = $target_civicrm . '/sites/default/files/civicrm/persist/';
$target_mail = $target_civicrm . '/civicrm/mailing/view';
// CAREFUL: only enable on debug systems. Will log all queries to given PUBLIC file
$debug = NULL; //'debug.log';
/****************************************************************
** File Caching Options **
****************************************************************/
// API and SITE keys
$api_key_map = array();
$sys_key_map = array();
if (file_exists("secrets.php")) {
// keys can also be stored in 'secrets.php'
require_once "secrets.php";
}
// define file cache options, see http://pear.php.net/manual/en/package.caching.cache-lite.cache-lite.cache-lite.php
$file_cache_options = array(
'cacheDir' => 'file_cache/',
'lifeTime' => 86400
);
// define regex patterns that shoud NOT be accepted
$file_cache_exclude = array();
// if set, cached file must match at least one of these regex patterns
$file_cache_include = array(
//'#.+[.](png|jpe?g|gif)#i' // only media files
);
/****************************************************************
** REST API OPTIONS **
****************************************************************/
$rest_allowed_actions = array(
'MhApi' => array(
'getcontact' => array(
'email' => 'string',
'first_name' => 'string',
'last_name' => 'string',
'organization_name' => 'string',
'contact_type' => array('Individual', 'Organization'),
'prefix' => 'string',
'street_address' => 'string',
'country' => 'string',
'postal_code' => 'string',
'city' => 'string',
'phone' => 'string',
'create_if_not_found' => 'int',
'source' => 'string',
),
'addcontribution' => array(
'contact_id' => 'int',
'financial_type_id' => 'int',
'financial_type' => 'string',
'payment_instrument' => 'string',
'contribution_campaign' => 'string',
'total_amount' => 'float2',
'currency' => 'string',
'contribution_status' => 'string',
'is_test' => 'int',
'iban' => 'string',
'bic' => 'string',
'source' => 'string',
'datum' => 'string',
'notes' => 'string',
'turnus' => 'int',
'dekade' => 'int',
'bank_name' => 'string',
'bank_name' => 'string',
),
'addactivity' => array(
'contact_id' => 'int',
'type_id' => 'int',
'subject' => 'string',
),
)
);

View File

@ -2,16 +2,12 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
require_once "proxy.php";
$error = "Please do not divide by zero."; //TODO: remove this and call the page properly
$display_version = FALSE; //TODO: "
?>
<!DOCTYPE html>
@ -19,7 +15,6 @@ $display_version = FALSE; //TODO: "
<head>
<meta charset="UTF-8">
<title>CiviProxy Error</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<style type="text/css">
body {
margin: 0;
@ -119,16 +114,14 @@ $display_version = FALSE; //TODO: "
<body>
<div id="container">
<div id="info" class="center-small">
<a href="https://www.systopia.de/"><img src="static/images/proxy-logo.png" alt="SYSTOPIA Organisationsberatung"></img></a>
<?php if($display_version): ?>
<p id="version">CiviProxy Version <?php echo $civiproxy_version;?></p>
<?php endif; ?>
<a href="https://www.systopia.de/"><?php echo $civiproxy_logo;?></a>
<p id="version">CiviProxy Version <?php echo $civiproxy_version;?></p>
</div>
<div id="error-container" class="center">
<?php if(isset($error)):?>
<?php if(isset($civiproxy_error_message)):?>
<div class="bs-callout bs-callout-danger">
<h4>An error has occurred while processing your request</h4>
<?php echo($error); ?>
<h4>An error has occurred while processing your request:</h4>
<?php echo($civiproxy_error_message); ?>
</div>
<?php endif;?>
</div>

View File

@ -1,340 +0,0 @@
Return-Path: <b.59.74059.098fb2a643e5ac6d@civicrm.muslimehelfen.org>
X-Original-To: endres@systopia.de
Delivered-To: endres@systopia.de
Received: from mgt-ext03.vs.cloud.fabits.de (mx-ext03.cloud.fabits.de [188.40.174.21])
by mail.systopia.de (Postfix) with ESMTP id 382A41425C
for <endres@systopia.de>; Wed, 21 Jan 2015 17:05:07 +0100 (CET)
Received: from civicrm.muslimehelfen.org (civicrm.muslimehelfen.org [217.151.151.254])
by mgt-ext03.vs.cloud.fabits.de (Postfix) with ESMTP id 10449618E1
for <endres@systopia.de>; Wed, 21 Jan 2015 17:05:07 +0100 (CET)
Received: by civicrm.muslimehelfen.org (Postfix, from userid 0)
id 2C56FC09B3; Wed, 21 Jan 2015 17:05:06 +0100 (CET)
To: Systopia Administrator <endres@systopia.de>
Subject: =?utf-8?Q?=C3=96ffne_Dein_Herz_=2E=2E=2E?=
X-PHP-Originating-Script: 0:mail.php
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_e57ca34fab37770a3a721bcfc43294ae"
Reply-To: r.59.74059.098fb2a643e5ac6d@civicrm.muslimehelfen.org
From: "muslimehelfen e.V." <info@muslimehelfen.org>
List-Unsubscribe: <mailto:u.59.74059.098fb2a643e5ac6d@civicrm.muslimehelfen.org>
Message-ID: <m.59.74059.098fb2a643e5ac6d@civicrm.muslimehelfen.org>
Precedence: bulk
X-CiviMail-Bounce: b.59.74059.098fb2a643e5ac6d@civicrm.muslimehelfen.org
Date: Wed, 21 Jan 2015 17:05:06 +0100
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Wed Jan 21 17:05:09 2015
X-DSPAM-Confidence: 0.9970
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 54bfce35224008741614672
--=_e57ca34fab37770a3a721bcfc43294ae
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
Falls der Newsletter nicht korrekt angezeigt wird, klicken Sie bitte
hier [1].
[2]
[3]
[4]
[2]
148.040 Personen gefällt muslimehelfen e.V. [2]
Service-Nummer von Mo.-Fr. 9-18 Uhr
+49 621- 40 54 670
[5]
Assalamu alaikum Systopia,
die Winterhilfe [6] endet bald. Über 12.000 Bedürftigen konnte bereits
geholfen werden. Doch noch frieren viele andere bei der Kälte.
Ende Dezember fielen die Temperaturen auf minus 20 Grad. Blerim im Norden
Albaniens war schon nach einem Tag völlig zugeschneit und der Weg dorthin
abgeschnitten. Aber alhamdulillah, kurz davor haben 160 Familien
Lebensmittel, Kleidung und Brennholz bekommen. Zu dieser Winterhilfe haben
über 2.200 Spender beigetragen, sei auch Du dabei.
Systopia, NUTZE DIESE CHANCE, IM WINTER ZU HELFEN. »
Spende jetzt! [5]
[7]
[7]
Winterkälte ist kein Zuckerschlecken [8]
[8]
Der Winter spaltet die Gemüter. Was für die einen pure Romantik ist,
jagt anderen als Schrecken die Glieder herunter. Mehr dazu liest Du» hier.
[8]
[9]
Keine Zinsen bei muslimeHELFEN [10]
Als Muslime dürfen wir Zinsen weder verlangen, noch annehmen. Was aber
machen wir mit den Zinsen, die wir von unserer Bank bekommen? Mehr dazu
liest Du» hier. [10]
[10]
Kontakt
[7]
muslimeHELFEN e.V.
Kaiser-Wilhelm-Str. 15
67059 Ludwigshafen, Germany
Tel: +49 (0621) 40 54 670
Fax: +49 (0621) 40 54 674 0
E-Mail: » info@muslimehelfen.org
Internet: » www.muslimehelfen.org [11]
muslimeHELFEN e.V. ist das freie, gemeinnützige und mildtätige Hilfswerk
von Muslimen, gegründet 1985. Zweck ist die Unterstützung
hilfsbedürftiger Menschen in Not- und Katastrophengebieten, bei Krieg,
Hungersnot, Naturkatastrophen und anderen Notfällen durch Hilfsmaßnahmen
vor Ort. Die Hilfsorganisation ist unabhängig von Regierungen und
Parteien.
SPENDENKONTEN:
Deutschland:
Konto: 6030448700 * BLZ: 43060967 * Bank: GLS Bank
IBAN: DE55430609676030448700 * BIC: GENODEM1GLS
Ãsterreich:
Konto: 92159385 * BLZ: 60000 * Bank: PSK
IBAN: AT696000000092159385 * BIC: OPSKATWW
Schweiz:
Konto: 60-301601-2 * Bank: Post Finance Bern
IBAN: CH8409000000603016012 * BIC: POFICHBEXXX
Klicke hier [12] um den Newsletter von muslimehelfen e.V. abzubestellen.
Links:
------
[1] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=212&qid=74059
[2] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059
[3] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=214&qid=74059
[4] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=215&qid=74059
[5] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=216&qid=74059
[6] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=217&qid=74059
[7] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059
[8] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059
[9] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=220&qid=74059
[10] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059
[11] http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=222&qid=74059
[12] http://civicrm.muslimehelfen.org/civicrm/mailing/optout?reset=1&jid=59&qid=74059&h=098fb2a643e5ac6d
--=_e57ca34fab37770a3a721bcfc43294ae
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset=utf-8
<p>&nbsp;</p>
<table style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #e3e3e8; border-top-width: 1px; border-top-style: solid; border-top-color: #e3e3e8; width: 100%;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#f3f3f3">
<tbody>
<tr>
<td align="center" valign="middle" width="600" height="40px"><span style="font-size: 11px; font-family: Arial; color: #000000;"> Falls der <span class="il">Newsletter</span> nicht korrekt angezeigt wird, <a style="color: #3279bb; text-decoration: underline;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=212&qid=74059' target="_blank">klicken Sie bitte hier</a>. </span></td>
</tr>
</tbody>
</table>
<!-- HEADER - SOCIAL MEDIA & TELEPHONE -->
<table style="width: 100%; padding: 0px 0px 10px 0px;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- START -->
<table style="width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ececec">
<tbody>
<tr>
<td>
<table style="color: #000000; text-align: center; width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-left.png" alt="" width="30" height="85" /></td>
<td valign="top" width="540" height="85">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td width="50" height="42">&nbsp;</td>
<td width="20" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb.gif" alt="" width="20" height="42" /></a></td>
<td width="23" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=214&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/tw.gif" alt="" width="23" height="42" /></a></td>
<td width="20" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=215&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/rs.gif" alt="" width="20" height="42" /></a></td>
<td width="20" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/trennlinie-sm.gif" alt="" width="21" height="42" /></td>
<td width="108" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb-like.gif" alt="" width="108" height="42" /></a></td>
<td align="left" width="299" height="42"><span style="font-family: Arial; font-size: 12px;">148.040 Personen gef&auml;llt <a style="color: #3b5998; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank">muslimehelfen e.V.</a></span></td>
</tr>
<tr>
<td colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-duenn.gif" alt="" width="540" height="1" /></td>
</tr>
<tr>
<td colspan="7" width="540" height="42">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" width="270" height="42"><span style="font-family: Arial; font-size: 14px; color: #333333;">Service-Nummer von Mo.-Fr. 9-18 Uhr</span></td>
<td align="right" width="270" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/telephone-icon.gif" alt="" width="24" height="15" /><span style="font-family: Arial; font-size: 19px; color: #333333;"><strong>+49 621- 40 54 670</strong></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-right.png" alt="" width="30" height="85" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END --></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- MAIN -->
<table style="width: 100%; padding: 0px 0pt;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- HEADER // START -->
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody><!-- HEADER // ENDE --> <!-- TOP HIGHTLIGHT CONTENT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; margin-top: 30px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=216&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/NL_Titelbild_winter15_2.png" alt="Winterhilfe muslimehelfen" width="540" height="272" /></a></td>
</tr>
<tr>
<td style="padding: 30px 0 30px 0;" colspan="2" valign="top">
<p><!-- SALUTION --><span style="font-family: Arial; font-size: large; color: #333333;">Assalamu alaikum Systopia,</span></p>
</td>
</tr>
<tr>
<td style="line-height: 1.8em;" valign="top">
<p><span style="font-size: small;"><!-- CONTENT --> <span style="font-family: Arial; color: #333333; line-height: 1.8em;"> die <a style="background: #FFFFCC; color: #000; text-decoration: none; font-weight: bold;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=217&qid=74059' target="_blank">Winterhilfe</a> endet bald. &Uuml;ber 12.000 Bed&uuml;rftigen konnte bereits geholfen werden. Doch noch frieren viele andere bei der K&auml;lte.</span></span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Ende Dezember fielen die Temperaturen auf minus 20 Grad. Blerim im Norden Albaniens war schon nach einem Tag v&ouml;llig zugeschneit und der Weg dorthin abgeschnitten. Aber alhamdulillah, kurz davor haben 160 Familien Lebensmittel, Kleidung und Brennholz bekommen. Zu dieser Winterhilfe haben &uuml;ber 2.200 Spender beigetragen, sei auch Du dabei.</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Systopia, <strong>nutze diese Chance, im Winter zu helfen.</strong> <a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 8px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=216&qid=74059' target="_blank">&raquo; Spende jetzt!</a>&nbsp;&nbsp;</span><span style="color: #333333; font-family: Arial; font-size: 14px; line-height: 1.8em;"><br /></span></p>
</td>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank">&nbsp;</a></td>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- TOP HIGHTLIGHT CONTENT END --> <!-- BLOG WEILMUSLIMEHELFEN - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 1 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540">
<p>&nbsp;</p>
<p><!-- TITLE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/banner_zaehler.jpg" alt="Winterhilfe muslimehelfen" width="540" height="227" /></a></p>
<p><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></p>
<p><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank">Winterk&auml;lte ist kein Zuckerschlecken </a></p>
</td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_1_winterkaelte.jpg" alt="Winterhilfe muslimehelfen" width="290" height="165" /></a></td>
<td style="line-height: 1.8em; padding-top: 10px;" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Der Winter spaltet die Gem&uuml;ter. Was f&uuml;r die einen pure Romantik ist, jagt anderen als Schrecken die Glieder herunter. Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!--Winterhilfe Banner START-->
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=220&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/content_winter_2014_B.png" alt="Winterhilfe muslimehelfen" width="540" height="155" /></a></td>
</tr>
<!--Winterhilfe Banner END-->
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 2 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank"> Keine Zinsen bei muslime<strong>helfen</strong> </a></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding-top: 10px;" align="left" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Als Muslime d&uuml;rfen wir Zinsen weder verlangen, noch annehmen. Was aber machen wir mit den Zinsen, die wir von unserer Bank bekommen? Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
<td style="padding: 10px 0px 0px 10px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank"><img title="Zinsen Riba muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_2_zinsen.jpg" alt="Zinsen Riba muslimehelfen" width="290" height="165" /></a></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG WEILMUSLIMEHELFEN - ENDE --> <!-- BLOG KONTAKT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- KONTAKT -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><span style="font-family: Arial; font-size: 20px; color: #333333; line-height: 1.8em;">Kontakt</span></td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="left" valign="bottom" width="200">
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" valign="bottom" width="200"><span><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/kontakt-logo-mh.gif" alt="" width="180" height="130" /></a></span></td>
<td valign="top" width="340">
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">&nbsp;</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">muslime<strong>helfen</strong>&nbsp;e.V.<br />Kaiser-Wilhelm-Str. 15<br />67059 Ludwigshafen, Germany<br /><br />Tel: +49 (0621) 40 54 670&nbsp;<br />Fax: +49 (0621) 40 54 674 0<br />E-Mail:&nbsp;<a href="mailto:info@muslimehelfen.org" target="_blank">&raquo; info@muslimehelfen.org</a><br />Internet:&nbsp;<a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=222&qid=74059'>&raquo; www.muslimehelfen.org</a></span></p>
</td>
</tr>
</tbody>
</table>
</td>
<td style="line-height: 1.8em;" valign="top" width="340"><span style="font-size: x-small;"><span style="font-family: Arial; color: #333333; line-height: 1.8em;"><br /> </span></span></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding: 20px 0px;" colspan="2" valign="top" width="540">
<p><span style="font-family: Arial; font-size: xx-small; color: #000000;"> muslime<strong>helfen</strong> e.V. ist das freie, gemeinn&uuml;tzige und mildt&auml;tige Hilfswerk von Muslimen, gegr&uuml;ndet 1985. Zweck ist die Unterst&uuml;tzung hilfsbed&uuml;rftiger Menschen in Not- und Katastrophengebieten, bei Krieg, Hungersnot, Naturkatastrophen und anderen Notf&auml;llen durch Hilfsma&szlig;nahmen vor Ort. Die Hilfsorganisation ist unabh&auml;ngig von Regierungen und Parteien. <br /><strong>Spendenkonten:</strong><br /> Deutschland:<br /> Konto: 6030448700 &bull; BLZ: 43060967 &bull; Bank: GLS Bank<br /> IBAN: DE55430609676030448700 &bull; BIC: GENODEM1GLS<br />&Ouml;sterreich:<br /> Konto: 92159385 &bull; BLZ: 60000 &bull; Bank: PSK<br
/> IBAN: AT696000000092159385 &bull; BIC: OPSKATWW<br />Schweiz:<br /> Konto: 60-301601-2 &bull; Bank: Post Finance Bern <br />IBAN: CH8409000000603016012 &bull; BIC: POFICHBEXXX</span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG KONTAKT - ENDE --></tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END OF MAIN -->
<p>&nbsp;</p>
<span style="font-family:Arial;font-size:12px;">Klicke <a href="http://civicrm.muslimehelfen.org/civicrm/mailing/optout?reset=1&amp;jid=59&amp;qid=74059&amp;h=098fb2a643e5ac6d">hier</a> um den Newsletter von muslimehelfen e.V. abzubestellen.</span>
<img src="http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/open.php?q=74059" width='1' height='1' alt='' border='0'>
--=_e57ca34fab37770a3a721bcfc43294ae--

View File

@ -1,210 +0,0 @@
<html><body>
<p>&nbsp;</p>
<table style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #e3e3e8; border-top-width: 1px; border-top-style: solid; border-top-color: #e3e3e8; width: 100%;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#f3f3f3">
<tbody>
<tr>
<td align="center" valign="middle" width="600" height="40px"><span style="font-size: 11px; font-family: Arial; color: #000000;"> Falls der <span class="il">Newsletter</span> nicht korrekt angezeigt wird, <a style="color: #3279bb; text-decoration: underline;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=212&qid=74059' target="_blank">klicken Sie bitte hier</a>. </span></td>
</tr>
</tbody>
</table>
<!-- HEADER - SOCIAL MEDIA & TELEPHONE -->
<table style="width: 100%; padding: 0px 0px 10px 0px;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- START -->
<table style="width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ececec">
<tbody>
<tr>
<td>
<table style="color: #000000; text-align: center; width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-left.png" alt="" width="30" height="85" /></td>
<td valign="top" width="540" height="85">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td width="50" height="42">&nbsp;</td>
<td width="20" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb.gif" alt="" width="20" height="42" /></a></td>
<td width="23" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=214&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/tw.gif" alt="" width="23" height="42" /></a></td>
<td width="20" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=215&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/rs.gif" alt="" width="20" height="42" /></a></td>
<td width="20" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/trennlinie-sm.gif" alt="" width="21" height="42" /></td>
<td width="108" height="42"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb-like.gif" alt="" width="108" height="42" /></a></td>
<td align="left" width="299" height="42"><span style="font-family: Arial; font-size: 12px;">148.040 Personen gef&auml;llt <a style="color: #3b5998; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=213&qid=74059' target="_blank">muslimehelfen e.V.</a></span></td>
</tr>
<tr>
<td colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-duenn.gif" alt="" width="540" height="1" /></td>
</tr>
<tr>
<td colspan="7" width="540" height="42">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" width="270" height="42"><span style="font-family: Arial; font-size: 14px; color: #333333;">Service-Nummer von Mo.-Fr. 9-18 Uhr</span></td>
<td align="right" width="270" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/telephone-icon.gif" alt="" width="24" height="15" /><span style="font-family: Arial; font-size: 19px; color: #333333;"><strong>+49 621- 40 54 670</strong></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-right.png" alt="" width="30" height="85" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END --></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- MAIN -->
<table style="width: 100%; padding: 0px 0pt;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- HEADER // START -->
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody><!-- HEADER // ENDE --> <!-- TOP HIGHTLIGHT CONTENT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; margin-top: 30px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=216&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/NL_Titelbild_winter15_2.png" alt="Winterhilfe muslimehelfen" width="540" height="272" /></a></td>
</tr>
<tr>
<td style="padding: 30px 0 30px 0;" colspan="2" valign="top">
<p><!-- SALUTION --><span style="font-family: Arial; font-size: large; color: #333333;">Assalamu alaikum Systopia,</span></p>
</td>
</tr>
<tr>
<td style="line-height: 1.8em;" valign="top">
<p><span style="font-size: small;"><!-- CONTENT --> <span style="font-family: Arial; color: #333333; line-height: 1.8em;"> die <a style="background: #FFFFCC; color: #000; text-decoration: none; font-weight: bold;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=217&qid=74059' target="_blank">Winterhilfe</a> endet bald. &Uuml;ber 12.000 Bed&uuml;rftigen konnte bereits geholfen werden. Doch noch frieren viele andere bei der K&auml;lte.</span></span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Ende Dezember fielen die Temperaturen auf minus 20 Grad. Blerim im Norden Albaniens war schon nach einem Tag v&ouml;llig zugeschneit und der Weg dorthin abgeschnitten. Aber alhamdulillah, kurz davor haben 160 Familien Lebensmittel, Kleidung und Brennholz bekommen. Zu dieser Winterhilfe haben &uuml;ber 2.200 Spender beigetragen, sei auch Du dabei.</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Systopia, <strong>nutze diese Chance, im Winter zu helfen.</strong> <a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 8px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=216&qid=74059' target="_blank">&raquo; Spende jetzt!</a>&nbsp;&nbsp;</span><span style="color: #333333; font-family: Arial; font-size: 14px; line-height: 1.8em;"><br /></span></p>
</td>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank">&nbsp;</a></td>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- TOP HIGHTLIGHT CONTENT END --> <!-- BLOG WEILMUSLIMEHELFEN - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 1 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540">
<p>&nbsp;</p>
<p><!-- TITLE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/banner_zaehler.jpg" alt="Winterhilfe muslimehelfen" width="540" height="227" /></a></p>
<p><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></p>
<p><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank">Winterk&auml;lte ist kein Zuckerschlecken </a></p>
</td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_1_winterkaelte.jpg" alt="Winterhilfe muslimehelfen" width="290" height="165" /></a></td>
<td style="line-height: 1.8em; padding-top: 10px;" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Der Winter spaltet die Gem&uuml;ter. Was f&uuml;r die einen pure Romantik ist, jagt anderen als Schrecken die Glieder herunter. Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=219&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!--Winterhilfe Banner START-->
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=220&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/content_winter_2014_B.png" alt="Winterhilfe muslimehelfen" width="540" height="155" /></a></td>
</tr>
<!--Winterhilfe Banner END-->
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 2 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank"> Keine Zinsen bei muslime<strong>helfen</strong> </a></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding-top: 10px;" align="left" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Als Muslime d&uuml;rfen wir Zinsen weder verlangen, noch annehmen. Was aber machen wir mit den Zinsen, die wir von unserer Bank bekommen? Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
<td style="padding: 10px 0px 0px 10px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=221&qid=74059' target="_blank"><img title="Zinsen Riba muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_2_zinsen.jpg" alt="Zinsen Riba muslimehelfen" width="290" height="165" /></a></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG WEILMUSLIMEHELFEN - ENDE --> <!-- BLOG KONTAKT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- KONTAKT -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><span style="font-family: Arial; font-size: 20px; color: #333333; line-height: 1.8em;">Kontakt</span></td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="left" valign="bottom" width="200">
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" valign="bottom" width="200"><span><a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=218&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/kontakt-logo-mh.gif" alt="" width="180" height="130" /></a></span></td>
<td valign="top" width="340">
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">&nbsp;</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">muslime<strong>helfen</strong>&nbsp;e.V.<br />Kaiser-Wilhelm-Str. 15<br />67059 Ludwigshafen, Germany<br /><br />Tel: +49 (0621) 40 54 670&nbsp;<br />Fax: +49 (0621) 40 54 674 0<br />E-Mail:&nbsp;<a href="mailto:info@muslimehelfen.org" target="_blank">&raquo; info@muslimehelfen.org</a><br />Internet:&nbsp;<a href='http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/url.php?u=222&qid=74059'>&raquo; www.muslimehelfen.org</a></span></p>
</td>
</tr>
</tbody>
</table>
</td>
<td style="line-height: 1.8em;" valign="top" width="340"><span style="font-size: x-small;"><span style="font-family: Arial; color: #333333; line-height: 1.8em;"><br /> </span></span></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding: 20px 0px;" colspan="2" valign="top" width="540">
<p><span style="font-family: Arial; font-size: xx-small; color: #000000;"> muslime<strong>helfen</strong> e.V. ist das freie, gemeinn&uuml;tzige und mildt&auml;tige Hilfswerk von Muslimen, gegr&uuml;ndet 1985. Zweck ist die Unterst&uuml;tzung hilfsbed&uuml;rftiger Menschen in Not- und Katastrophengebieten, bei Krieg, Hungersnot, Naturkatastrophen und anderen Notf&auml;llen durch Hilfsma&szlig;nahmen vor Ort. Die Hilfsorganisation ist unabh&auml;ngig von Regierungen und Parteien. <br /><strong>Spendenkonten:</strong><br /> Deutschland:<br /> Konto: 6030448700 &bull; BLZ: 43060967 &bull; Bank: GLS Bank<br /> IBAN: DE55430609676030448700 &bull; BIC: GENODEM1GLS<br />&Ouml;sterreich:<br /> Konto: 92159385 &bull; BLZ: 60000 &bull; Bank: PSK<br
/> IBAN: AT696000000092159385 &bull; BIC: OPSKATWW<br />Schweiz:<br /> Konto: 60-301601-2 &bull; Bank: Post Finance Bern <br />IBAN: CH8409000000603016012 &bull; BIC: POFICHBEXXX</span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG KONTAKT - ENDE --></tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END OF MAIN -->
<p>&nbsp;</p>
<span style="font-family:Arial;font-size:12px;">Klicke <a href="http://civicrm.muslimehelfen.org/civicrm/mailing/optout?reset=1&amp;jid=59&amp;qid=74059&amp;h=098fb2a643e5ac6d">hier</a> um den Newsletter von muslimehelfen e.V. abzubestellen.</span>
<img src="http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/open.php?q=74059" width='1' height='1' alt='' border='0'>
--=_e57ca34fab37770a3a721bcfc43294ae--
</body></html>

View File

@ -1,210 +0,0 @@
<html><body>
<p>&nbsp;</p>
<table style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #e3e3e8; border-top-width: 1px; border-top-style: solid; border-top-color: #e3e3e8; width: 100%;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#f3f3f3">
<tbody>
<tr>
<td align="center" valign="middle" width="600" height="40px"><span style="font-size: 11px; font-family: Arial; color: #000000;"> Falls der <span class="il">Newsletter</span> nicht korrekt angezeigt wird, <a style="color: #3279bb; text-decoration: underline;" href='http://localhost:8888/proxy/url.php?u=212&qid=74059' target="_blank">klicken Sie bitte hier</a>. </span></td>
</tr>
</tbody>
</table>
<!-- HEADER - SOCIAL MEDIA & TELEPHONE -->
<table style="width: 100%; padding: 0px 0px 10px 0px;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- START -->
<table style="width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ececec">
<tbody>
<tr>
<td>
<table style="color: #000000; text-align: center; width: 600px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-left.png" alt="" width="30" height="85" /></td>
<td valign="top" width="540" height="85">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td width="50" height="42">&nbsp;</td>
<td width="20" height="42"><a href='http://localhost:8888/proxy/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb.gif" alt="" width="20" height="42" /></a></td>
<td width="23" height="42"><a href='http://localhost:8888/proxy/url.php?u=214&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/tw.gif" alt="" width="23" height="42" /></a></td>
<td width="20" height="42"><a href='http://localhost:8888/proxy/url.php?u=215&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/rs.gif" alt="" width="20" height="42" /></a></td>
<td width="20" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/trennlinie-sm.gif" alt="" width="21" height="42" /></td>
<td width="108" height="42"><a href='http://localhost:8888/proxy/url.php?u=213&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/fb-like.gif" alt="" width="108" height="42" /></a></td>
<td align="left" width="299" height="42"><span style="font-family: Arial; font-size: 12px;">148.040 Personen gef&auml;llt <a style="color: #3b5998; text-decoration: none;" href='http://localhost:8888/proxy/url.php?u=213&qid=74059' target="_blank">muslimehelfen e.V.</a></span></td>
</tr>
<tr>
<td colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-duenn.gif" alt="" width="540" height="1" /></td>
</tr>
<tr>
<td colspan="7" width="540" height="42">
<table style="color: #000000; text-align: center; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" width="270" height="42"><span style="font-family: Arial; font-size: 14px; color: #333333;">Service-Nummer von Mo.-Fr. 9-18 Uhr</span></td>
<td align="right" width="270" height="42"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/telephone-icon.gif" alt="" width="24" height="15" /><span style="font-family: Arial; font-size: 19px; color: #333333;"><strong>+49 621- 40 54 670</strong></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" bgcolor="#f3f3f3" width="30" height="85"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/smBox-right.png" alt="" width="30" height="85" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END --></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- MAIN -->
<table style="width: 100%; padding: 0px 0pt;" border="0" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">
<tbody>
<tr>
<td>
<table style="padding: 0px 0pt; width: 600px; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td><!-- HEADER // START -->
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody><!-- HEADER // ENDE --> <!-- TOP HIGHTLIGHT CONTENT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; margin-top: 30px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://localhost:8888/proxy/url.php?u=216&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/NL_Titelbild_winter15_2.png" alt="Winterhilfe muslimehelfen" width="540" height="272" /></a></td>
</tr>
<tr>
<td style="padding: 30px 0 30px 0;" colspan="2" valign="top">
<p><!-- SALUTION --><span style="font-family: Arial; font-size: large; color: #333333;">Assalamu alaikum Systopia,</span></p>
</td>
</tr>
<tr>
<td style="line-height: 1.8em;" valign="top">
<p><span style="font-size: small;"><!-- CONTENT --> <span style="font-family: Arial; color: #333333; line-height: 1.8em;"> die <a style="background: #FFFFCC; color: #000; text-decoration: none; font-weight: bold;" href='http://localhost:8888/proxy/url.php?u=217&qid=74059' target="_blank">Winterhilfe</a> endet bald. &Uuml;ber 12.000 Bed&uuml;rftigen konnte bereits geholfen werden. Doch noch frieren viele andere bei der K&auml;lte.</span></span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Ende Dezember fielen die Temperaturen auf minus 20 Grad. Blerim im Norden Albaniens war schon nach einem Tag v&ouml;llig zugeschneit und der Weg dorthin abgeschnitten. Aber alhamdulillah, kurz davor haben 160 Familien Lebensmittel, Kleidung und Brennholz bekommen. Zu dieser Winterhilfe haben &uuml;ber 2.200 Spender beigetragen, sei auch Du dabei.</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Systopia, <strong>nutze diese Chance, im Winter zu helfen.</strong> <a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 8px;" href='http://localhost:8888/proxy/url.php?u=216&qid=74059' target="_blank">&raquo; Spende jetzt!</a>&nbsp;&nbsp;</span><span style="color: #333333; font-family: Arial; font-size: 14px; line-height: 1.8em;"><br /></span></p>
</td>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://localhost:8888/proxy/url.php?u=218&qid=74059' target="_blank">&nbsp;</a></td>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- TOP HIGHTLIGHT CONTENT END --> <!-- BLOG WEILMUSLIMEHELFEN - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 1 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540">
<p>&nbsp;</p>
<p><!-- TITLE --><a href='http://localhost:8888/proxy/url.php?u=218&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/banner_zaehler.jpg" alt="Winterhilfe muslimehelfen" width="540" height="227" /></a></p>
<p><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></p>
<p><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://localhost:8888/proxy/url.php?u=219&qid=74059' target="_blank">Winterk&auml;lte ist kein Zuckerschlecken </a></p>
</td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://localhost:8888/proxy/url.php?u=219&qid=74059' target="_blank"><img title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_1_winterkaelte.jpg" alt="Winterhilfe muslimehelfen" width="290" height="165" /></a></td>
<td style="line-height: 1.8em; padding-top: 10px;" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Der Winter spaltet die Gem&uuml;ter. Was f&uuml;r die einen pure Romantik ist, jagt anderen als Schrecken die Glieder herunter. Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://localhost:8888/proxy/url.php?u=219&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!--Winterhilfe Banner START-->
<tr>
<td style="padding: 0px 0 0px 0;" colspan="2" valign="top"><a href='http://localhost:8888/proxy/url.php?u=220&qid=74059' target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" title="Winterhilfe muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/content_winter_2014_B.png" alt="Winterhilfe muslimehelfen" width="540" height="155" /></a></td>
</tr>
<!--Winterhilfe Banner END-->
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- BLOG WMH 2 -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><a style="font-family: Arial; font-size: 25px; color: #333333; text-decoration: none;" href='http://localhost:8888/proxy/url.php?u=221&qid=74059' target="_blank"> Keine Zinsen bei muslime<strong>helfen</strong> </a></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding-top: 10px;" align="left" valign="top" width="270"><!-- CONTENT --> <span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 1.8em;"> Als Muslime d&uuml;rfen wir Zinsen weder verlangen, noch annehmen. Was aber machen wir mit den Zinsen, die wir von unserer Bank bekommen? Mehr dazu liest Du<a style="font-size: 16px; color: #fff; background: #3279bb; text-decoration: none; padding: 2px 8px 4px 4px; margin-left: 4px;" href='http://localhost:8888/proxy/url.php?u=221&qid=74059' target="_blank">&raquo; hier.</a> </span></td>
<td style="padding: 10px 0px 0px 10px;" align="right" valign="top" width="270"><!-- IMAGE --><a href='http://localhost:8888/proxy/url.php?u=221&qid=74059' target="_blank"><img title="Zinsen Riba muslimehelfen" src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/blog_2_zinsen.jpg" alt="Zinsen Riba muslimehelfen" width="290" height="165" /></a></td>
</tr>
<tr>
<td style="padding: 20px 0 20px 0;" colspan="7" width="540" height="1"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/linie-dick.gif" alt="" width="540" height="3" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG WEILMUSLIMEHELFEN - ENDE --> <!-- BLOG KONTAKT - START -->
<tr>
<td>
<table style="color: #000000; padding-bottom: 5px; width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody><!-- KONTAKT -->
<tr>
<td style="padding: 0px 0 10px 0;" colspan="2" valign="top" width="540"><!-- TITLE --><span style="font-family: Arial; font-size: 20px; color: #333333; line-height: 1.8em;">Kontakt</span></td>
</tr>
<tr>
<td style="padding: 10px 10px 0px 0px;" align="left" valign="bottom" width="200">
<table style="width: 540px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="left" valign="bottom" width="200"><span><a href='http://localhost:8888/proxy/url.php?u=218&qid=74059' target="_blank"><img src="https://civicrm.muslimehelfen.org/sites/default/files/civicrm/persist/contribute/image/kontakt-logo-mh.gif" alt="" width="180" height="130" /></a></span></td>
<td valign="top" width="340">
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">&nbsp;</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: x-small;">muslime<strong>helfen</strong>&nbsp;e.V.<br />Kaiser-Wilhelm-Str. 15<br />67059 Ludwigshafen, Germany<br /><br />Tel: +49 (0621) 40 54 670&nbsp;<br />Fax: +49 (0621) 40 54 674 0<br />E-Mail:&nbsp;<a href="mailto:info@muslimehelfen.org" target="_blank">&raquo; info@muslimehelfen.org</a><br />Internet:&nbsp;<a href='http://localhost:8888/proxy/url.php?u=222&qid=74059'>&raquo; www.muslimehelfen.org</a></span></p>
</td>
</tr>
</tbody>
</table>
</td>
<td style="line-height: 1.8em;" valign="top" width="340"><span style="font-size: x-small;"><span style="font-family: Arial; color: #333333; line-height: 1.8em;"><br /> </span></span></td>
</tr>
<tr>
<td style="line-height: 1.8em; padding: 20px 0px;" colspan="2" valign="top" width="540">
<p><span style="font-family: Arial; font-size: xx-small; color: #000000;"> muslime<strong>helfen</strong> e.V. ist das freie, gemeinn&uuml;tzige und mildt&auml;tige Hilfswerk von Muslimen, gegr&uuml;ndet 1985. Zweck ist die Unterst&uuml;tzung hilfsbed&uuml;rftiger Menschen in Not- und Katastrophengebieten, bei Krieg, Hungersnot, Naturkatastrophen und anderen Notf&auml;llen durch Hilfsma&szlig;nahmen vor Ort. Die Hilfsorganisation ist unabh&auml;ngig von Regierungen und Parteien. <br /><strong>Spendenkonten:</strong><br /> Deutschland:<br /> Konto: 6030448700 &bull; BLZ: 43060967 &bull; Bank: GLS Bank<br /> IBAN: DE55430609676030448700 &bull; BIC: GENODEM1GLS<br />&Ouml;sterreich:<br /> Konto: 92159385 &bull; BLZ: 60000 &bull; Bank: PSK<br
/> IBAN: AT696000000092159385 &bull; BIC: OPSKATWW<br />Schweiz:<br /> Konto: 60-301601-2 &bull; Bank: Post Finance Bern <br />IBAN: CH8409000000603016012 &bull; BIC: POFICHBEXXX</span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- BLOG KONTAKT - ENDE --></tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- END OF MAIN -->
<p>&nbsp;</p>
<span style="font-family:Arial;font-size:12px;">Klicke <a href="http://civicrm.muslimehelfen.org/civicrm/mailing/optout?reset=1&amp;jid=59&amp;qid=74059&amp;h=098fb2a643e5ac6d">hier</a> um den Newsletter von muslimehelfen e.V. abzubestellen.</span>
<img src="http://civicrm.muslimehelfen.org/sites/all/modules/civicrm/extern/open.php?q=74059" width='1' height='1' alt='' border='0'>
--=_e57ca34fab37770a3a721bcfc43294ae--
</body></html>

View File

@ -2,7 +2,7 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
@ -76,8 +76,13 @@ curl_setopt($curlSession, CURLOPT_URL, $url);
curl_setopt($curlSession, CURLOPT_HEADER, 1);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlSession, CURLOPT_CAINFO, 'target.pem');
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
if (!empty($target_interface)) {
curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface);
}
if (file_exists(dirname(__FILE__).'/target.pem')) {
curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem');
}
//Send the request and store the result in an array
$response = curl_exec($curlSession);

View File

@ -2,7 +2,7 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
@ -16,7 +16,6 @@ require_once "proxy.php";
<head>
<meta charset="UTF-8">
<title>CiviProxy Version <?php echo $civiproxy_version;?></title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<style type="text/css">
body {
margin: 0;

View File

@ -79,7 +79,7 @@ class Cache_Lite
* @var string $_file
*/
var $_file;
/**
* File name (without path)
*
@ -128,7 +128,7 @@ class Cache_Lite
* @var int $_pearErrorMode
*/
var $_pearErrorMode = CACHE_LITE_ERROR_RETURN;
/**
* Current cache id
*
@ -146,7 +146,7 @@ class Cache_Lite
/**
* Enable / Disable "Memory Caching"
*
* NB : There is no lifetime for memory caching !
* NB : There is no lifetime for memory caching !
*
* @var boolean $_memoryCaching
*/
@ -180,7 +180,7 @@ class Cache_Lite
* @var int $memoryCachingLimit
*/
var $_memoryCachingLimit = 1000;
/**
* File Name protection
*
@ -192,17 +192,17 @@ class Cache_Lite
* @var boolean $fileNameProtection
*/
var $_fileNameProtection = true;
/**
* Enable / disable automatic serialization
*
* it can be used to save directly datas which aren't strings
* (but it's slower)
* (but it's slower)
*
* @var boolean $_serialize
*/
var $_automaticSerialization = false;
/**
* Disable / Tune the automatic cleaning process
*
@ -215,45 +215,45 @@ class Cache_Lite
* @var int $_automaticCleaning
*/
var $_automaticCleaningFactor = 0;
/**
* Nested directory level
*
* Set the hashed directory structure level. 0 means "no hashed directory
* structure", 1 means "one level of directory", 2 means "two levels"...
* This option can speed up Cache_Lite only when you have many thousands of
* cache file. Only specific benchs can help you to choose the perfect value
* Set the hashed directory structure level. 0 means "no hashed directory
* structure", 1 means "one level of directory", 2 means "two levels"...
* This option can speed up Cache_Lite only when you have many thousands of
* cache file. Only specific benchs can help you to choose the perfect value
* for you. Maybe, 1 or 2 is a good start.
*
* @var int $_hashedDirectoryLevel
*/
var $_hashedDirectoryLevel = 0;
/**
* Umask for hashed directory structure
*
* @var int $_hashedDirectoryUmask
*/
var $_hashedDirectoryUmask = 0700;
/**
* API break for error handling in CACHE_LITE_ERROR_RETURN mode
*
*
* In CACHE_LITE_ERROR_RETURN mode, error handling was not good because
* for example save() method always returned a boolean (a PEAR_Error object
* would be better in CACHE_LITE_ERROR_RETURN mode). To correct this without
* breaking the API, this option (false by default) can change this handling.
*
*
* @var boolean
*/
var $_errorHandlingAPIBreak = false;
var $_hashedDirectoryGroup = NULL;
var $_cacheFileMode = NULL;
var $_cacheFileGroup = NULL;
// --- Public methods ---
/**
@ -282,19 +282,19 @@ class Cache_Lite
* 'cacheFileMode' => filesystem mode of newly created cache files (int)
* 'cacheFileGroup' => group of newly created cache files (int | string) (see function chgrp)
* );
*
* If sys_get_temp_dir() is available and the
* 'cacheDir' option is not provided in the
* constructor options array its output is used
*
* If sys_get_temp_dir() is available and the
* 'cacheDir' option is not provided in the
* constructor options array its output is used
* to determine the suitable temporary directory.
*
*
* @see http://de.php.net/sys_get_temp_dir
* @see http://pear.php.net/bugs/bug.php?id=18328
*
* @param array $options options
* @access public
*/
function Cache_Lite($options = array(NULL))
function __construct($options = array(NULL))
{
foreach($options as $key => $value) {
$this->setOption($key, $value);
@ -303,7 +303,17 @@ class Cache_Lite
$this->setOption('cacheDir', sys_get_temp_dir() . DIRECTORY_SEPARATOR);
}
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite($options = array(NULL))
{
self::__construct($options);
}
/**
* Generic way to set a Cache_Lite option
*
@ -313,7 +323,7 @@ class Cache_Lite
* @var mixed $value value of the option
* @access public
*/
function setOption($name, $value)
function setOption($name, $value)
{
$availableOptions = array('errorHandlingAPIBreak', 'hashedDirectoryUmask', 'hashedDirectoryLevel', 'automaticCleaningFactor', 'automaticSerialization', 'fileNameProtection', 'memoryCaching', 'onlyMemoryCaching', 'memoryCachingLimit', 'cacheDir', 'caching', 'lifeTime', 'fileLocking', 'writeControl', 'readControl', 'readControlType', 'pearErrorMode', 'hashedDirectoryGroup', 'cacheFileMode', 'cacheFileGroup');
if (in_array($name, $availableOptions)) {
@ -321,7 +331,7 @@ class Cache_Lite
$this->$property = $value;
}
}
/**
* Test if a cache is available and (if yes) return it
*
@ -349,7 +359,7 @@ class Cache_Lite
}
if ($this->_onlyMemoryCaching) {
return false;
}
}
}
if (($doNotTestCacheValidity) || (is_null($this->_refreshTime))) {
if (file_exists($this->_file)) {
@ -370,7 +380,7 @@ class Cache_Lite
}
return false;
}
/**
* Save some data in a cache file
*
@ -396,24 +406,24 @@ class Cache_Lite
}
}
if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
$this->clean(false, 'old');
$this->clean(false, 'old');
}
if ($this->_writeControl) {
$res = $this->_writeAndControl($data);
if (is_bool($res)) {
if ($res) {
return true;
return true;
}
// if $res if false, we need to invalidate the cache
@touch($this->_file, time() - 2*abs($this->_lifeTime));
return false;
}
}
} else {
$res = $this->_write($data);
}
if (is_object($res)) {
// $res is a PEAR_Error object
if (!($this->_errorHandlingAPIBreak)) {
// $res is a PEAR_Error object
if (!($this->_errorHandlingAPIBreak)) {
return false; // we return false (old API)
}
}
@ -456,7 +466,7 @@ class Cache_Lite
* else only cache files of the specified group will be destroyed
*
* @param string $group name of the cache group
* @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
* @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
* 'callback_myFunction'
* @return boolean true if no problem
* @access public
@ -465,12 +475,12 @@ class Cache_Lite
{
return $this->_cleanDir($this->_cacheDir, $group, $mode);
}
/**
* Set to debug mode
*
* When an error is found, the script will stop and the message will be displayed
* (in debug mode only).
* (in debug mode only).
*
* @access public
*/
@ -528,7 +538,7 @@ class Cache_Lite
}
}
}
/**
* Return the cache last modification time
*
@ -536,11 +546,11 @@ class Cache_Lite
*
* @return int last modification time
*/
function lastModified()
function lastModified()
{
return @filemtime($this->_file);
}
/**
* Trigger a PEAR error
*
@ -554,30 +564,29 @@ class Cache_Lite
*/
function raiseError($msg, $code)
{
include_once('PEAR.php');
return PEAR::raiseError($msg, $code, $this->_pearErrorMode);
}
/**
* Extend the life of a valid cache file
*
*
* see http://pear.php.net/bugs/bug.php?id=6681
*
*
* @access public
*/
function extendLife()
{
@touch($this->_file);
}
// --- Private methods ---
/**
* Compute & set the refresh time
*
* @access private
*/
function _setRefreshTime()
function _setRefreshTime()
{
if (is_null($this->_lifeTime)) {
$this->_refreshTime = null;
@ -585,10 +594,10 @@ class Cache_Lite
$this->_refreshTime = time() - $this->_lifeTime;
}
}
/**
* Remove a file
*
*
* @param string $file complete file path and name
* @return boolean true if no problem
* @access private
@ -598,7 +607,7 @@ class Cache_Lite
if (!@unlink($file)) {
return $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
}
return true;
return true;
}
/**
@ -611,7 +620,7 @@ class Cache_Lite
* @return boolean true if no problem
* @access private
*/
function _cleanDir($dir, $group = false, $mode = 'ingroup')
function _cleanDir($dir, $group = false, $mode = 'ingroup')
{
if ($this->_fileNameProtection) {
$motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_';
@ -629,7 +638,7 @@ class Cache_Lite
return true;
}
}
if (!($dh = opendir($dir))) {
if (!($dh = @opendir($dir))) {
return $this->raiseError('Cache_Lite : Unable to open cache directory !', -4);
}
$result = true;
@ -698,8 +707,10 @@ class Cache_Lite
$this->_touchCacheFile();
$this->_memoryCachingArray[$this->_file] = $data;
if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
list($key, ) = each($this->_memoryCachingArray);
$key = key($this->_memoryCachingArray);
next($this->_memoryCachingArray);
unset($this->_memoryCachingArray[$key]);
} else {
$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
}
@ -714,7 +725,7 @@ class Cache_Lite
*/
function _setFileName($id, $group)
{
if ($this->_fileNameProtection) {
$suffix = 'cache_'.md5($group).'_'.md5($id);
} else {
@ -725,12 +736,12 @@ class Cache_Lite
$hash = md5($suffix);
for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
}
}
}
$this->_fileName = $suffix;
$this->_file = $root.$suffix;
}
/**
* Read the cache file and return the content
*
@ -744,7 +755,7 @@ class Cache_Lite
if ($this->_fileLocking) @flock($fp, LOCK_SH);
clearstatcache();
$length = @filesize($this->_file);
$mqr = get_magic_quotes_runtime();
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
if ($mqr) {
set_magic_quotes_runtime(0);
}
@ -770,7 +781,7 @@ class Cache_Lite
$hashData = $this->_hash($data, $this->_readControlType);
if ($hashData != $hashControl) {
if (!(is_null($this->_lifeTime))) {
@touch($this->_file, time() - 2*abs($this->_lifeTime));
@touch($this->_file, time() - 2*abs($this->_lifeTime));
} else {
@unlink($this->_file);
}
@ -779,9 +790,9 @@ class Cache_Lite
}
return $data;
}
return $this->raiseError('Cache_Lite : Unable to read cache !', -2);
return $this->raiseError('Cache_Lite : Unable to read cache !', -2);
}
/**
* Write the given data in the cache file
*
@ -808,7 +819,7 @@ class Cache_Lite
}
// if both _cacheFileMode and _cacheFileGroup is null, then we don't need to call
// file_exists (see below: if ($is_newfile) ...)
$is_newfile = (! is_null($this->_cacheFileMode) || !is_null($this->_cacheFileGroup))
$is_newfile = (! is_null($this->_cacheFileMode) || !is_null($this->_cacheFileGroup))
&& ! @file_exists($this->_file);
$fp = @fopen($this->_file, "wb");
if ($fp) {
@ -823,7 +834,7 @@ class Cache_Lite
if ($this->_readControl) {
@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
}
$mqr = get_magic_quotes_runtime();
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
if ($mqr) {
set_magic_quotes_runtime(0);
}
@ -834,10 +845,10 @@ class Cache_Lite
if ($this->_fileLocking) @flock($fp, LOCK_UN);
@fclose($fp);
return true;
}
}
return $this->raiseError('Cache_Lite : Unable to write cache file : '.$this->_file, -1);
}
/**
* Write the given data in the cache file and control it just after to avoir corrupted cache entries
*
@ -856,11 +867,11 @@ class Cache_Lite
return $dataRead; # We return the PEAR_Error object
}
if ((is_bool($dataRead)) && (!$dataRead)) {
return false;
return false;
}
return ($dataRead==$data);
}
/**
* Make a control key with the string containing datas
*
@ -882,5 +893,5 @@ class Cache_Lite
return $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5);
}
}
}
}

View File

@ -52,10 +52,10 @@ class Cache_Lite_File extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_File($options = array(NULL))
function __construct($options = array(NULL))
{
$options['lifetime'] = 0;
$this->Cache_Lite($options);
parent::__construct($options);
if (isset($options['masterFile'])) {
$this->_masterFile = $options['masterFile'];
} else {
@ -65,6 +65,16 @@ class Cache_Lite_File extends Cache_Lite
return $this->raiseError('Cache_Lite_File : Unable to read masterFile : '.$this->_masterFile, -3);
}
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_File($options = array(NULL))
{
self::__construct($options);
}
/**
* Test if a cache is available and (if yes) return it

View File

@ -81,17 +81,27 @@ class Cache_Lite_Function extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Function($options = array(NULL))
function __construct($options = array(NULL))
{
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
while (list($name, $value) = each($options)) {
foreach ($options as $name => $value) {
if (in_array($name, $availableOptions)) {
$property = '_'.$name;
$this->$property = $value;
}
}
reset($options);
$this->Cache_Lite($options);
parent::__construct($options);
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_Function($options = array(NULL))
{
self::__construct($options);
}
/**

View File

@ -26,9 +26,19 @@ class Cache_Lite_Output extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Output($options)
function __construct($options)
{
$this->Cache_Lite($options);
parent::__construct($options);
}
/**
* PHP4 constructor for backwards compatibility with older code
*
* @param array $options Options
*/
function Cache_Lite_Output($options = array(NULL))
{
self::__construct($options);
}
/**

View File

@ -1,19 +1,25 @@
# PEAR Cache_Lite
Fast and safe little cache system.
This package is a little cache system optimized for file containers.
t is fast and safe (because it uses file locking and/or anti-corruption tests).
[![Build Status](https://travis-ci.org/pear/Cache_Lite.svg)](https://travis-ci.org/pear/Cache_Lite)
This package is [Cache_Lite](http://pear.php.net/package/Cache_Lite).
Please report all new issues via the [PEAR bug tracker](http://pear.php.net/bugs/).
## Building
To test this package, run
phpunit tests/
To build, simply
To build, simply execute
pear package
## Installation
### PEAR
To install from scratch
pear install package.xml
@ -21,3 +27,15 @@ To install from scratch
To upgrade
pear upgrade -f package.xml
### Composer
composer require pear/cache_lite
## Links
- Homepage: http://pear.php.net/package/Cache_Lite
- Source code: https://github.com/pear/Cache_Lite
- Issue tracker: http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Cache_Lite
- Unit test status: https://travis-ci.org/pear/Cache_Lite
- Packagist: https://packagist.org/packages/pear/cache_lite

89
proxy/mailing/confirm.php Normal file
View File

@ -0,0 +1,89 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mail open tracking is enabled
if (!$mail_subscription_user_key) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('mail-confirm');
// basic restraints
$valid_parameters = array( 'sid' => 'int',
'cid' => 'int',
'h' => 'string');
$parameters = civiproxy_get_parameters($valid_parameters);
// check if parameters specified
if (empty($parameters['sid'])) civiproxy_http_error("Missing/invalid parameter 'sid'.");
if (empty($parameters['cid'])) civiproxy_http_error("Missing/invalid parameter 'cid'.");
if (empty($parameters['h'])) civiproxy_http_error("Missing/invalid parameter 'h'.");
// PERFORM UNSUBSCRIBE
$group_query = civicrm_api3('MailingEventConfirm', 'create',
array( 'subscribe_id' => $parameters['sid'],
'contact_id' => $parameters['cid'],
'hash' => $parameters['h'],
'api_key' => $mail_subscription_user_key,
));
if (!empty($group_query['is_error'])) {
civiproxy_http_error($group_query['error_message'], 500);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CiviProxy Version <?php echo $civiproxy_version;?></title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.container {
position: relative;
width: 100%;
}
.center {
margin-left: auto;
margin-right: auto;
width: 970px;
}
p {
font-family: "Open Sans", sans-serif;
font-size: 160%;
}
#info {
padding-top: 20px;
vertical-align: top;
text-align: center;
width: 462px;
}
</style>
</head>
<body>
<div id="container">
<div id="info" class="center">
<a href="https://www.systopia.de/"><?php echo $civiproxy_logo;?></a>
</div>
<div id="content" class="center">
<p>Thank you. You are now subscribed to the newsletter.</a>
</div>
</div>
</body>
</html>

26
proxy/mailing/mail.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mail open tracking is enabled
if (!$target_mail_view) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('mail-view');
// basic restraints
$valid_parameters = array( 'id' => 'int', 'cid' => 'int', 'cs' => 'string' );
$parameters = civiproxy_get_parameters($valid_parameters);
// check if id specified
if (empty($parameters['id'])) civiproxy_http_error("Resource not found");
civiproxy_redirect($target_mail_view, $parameters);

View File

@ -2,21 +2,18 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mail open tracking is enabled
if (!$target_mail) civiproxy_http_error("Feature disabled", 405);
if (!$mail_subscription_user_key) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('viewmail');
civiproxy_security_check('mail-optout');
// basic restraints
$valid_parameters = array( 'id' => 'int' );
$parameters = civiproxy_get_parameters($valid_parameters);
civiproxy_redirect($target_mail, $parameters);
civiproxy_http_error("Sorry, opt-out not yet implemented", 405);

View File

@ -0,0 +1,89 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mail open tracking is enabled
if (!$mail_subscription_user_key) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('mail-resubscribe');
// basic restraints
$valid_parameters = array( 'jid' => 'int',
'qid' => 'int',
'h' => 'string');
$parameters = civiproxy_get_parameters($valid_parameters);
// check if parameters specified
if (empty($parameters['jid'])) civiproxy_http_error("Missing/invalid parameter 'jid'.");
if (empty($parameters['qid'])) civiproxy_http_error("Missing/invalid parameter 'qid'.");
if (empty($parameters['h'])) civiproxy_http_error("Missing/invalid parameter 'h'.");
// PERFORM UNSUBSCRIBE
$group_query = civicrm_api3('MailingEventResubscribe', 'create',
array( 'job_id' => $parameters['jid'],
'event_queue_id' => $parameters['qid'],
'hash' => $parameters['h'],
'api_key' => $mail_subscription_user_key,
));
if (!empty($group_query['is_error'])) {
civiproxy_http_error($group_query['error_message'], 500);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CiviProxy Version <?php echo $civiproxy_version;?></title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.container {
position: relative;
width: 100%;
}
.center {
margin-left: auto;
margin-right: auto;
width: 970px;
}
p {
font-family: "Open Sans", sans-serif;
font-size: 160%;
}
#info {
padding-top: 20px;
vertical-align: top;
text-align: center;
width: 462px;
}
</style>
</head>
<body>
<div id="container">
<div id="info" class="center">
<a href="https://www.systopia.de/"><?php echo $civiproxy_logo;?></a>
</div>
<div id="content" class="center">
<p>Thank you. You've been re-subscribed to the newsletter.</a>
</div>
</div>
</body>
</html>

150
proxy/mailing/subscribe.php Normal file
View File

@ -0,0 +1,150 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mailing subscribe feature is enabled
if (empty($mail_subscription_user_key)) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('mail-subscribe');
// LOAD VISIBLE GROUPS
$group_query = civicrm_api3('Group', 'get',
array( 'visibility' => 'Public Pages',
'is_hidden' => 0,
'is_active' => 1,
'api_key' => $mail_subscription_user_key,
));
if (!empty($group_query['is_error'])) {
civiproxy_http_error($group_query['error_message'], 500);
} else {
$groups = $group_query['values'];
if (empty($groups)) {
civiproxy_http_error("No newsletter groups found!", 500);
}
}
// VERIFY / CHECK PARAMETERS
$parameter_errors = array();
if (!empty($_REQUEST['email'])) {
// get parameters
$email = $_REQUEST['email'];
if (!preg_match("#^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$#i", $email)) civiproxy_http_error("'$email' is not a valid email address.", 500);
if (empty($_REQUEST['group_id'])) civiproxy_http_error("No newsletter group selected!", 500);
$group_id = $_REQUEST['group_id'];
// ALL FINE. SUBSCRIBE USER!
// first, get/create the contact
$contact_query = civicrm_api3('Contact', 'create',
array( 'email' => $email,
'contact_type' => 'Individual',
'dupe_check' => 1,
'api_key' => $mail_subscription_user_key,
));
if (!empty($contact_query['is_error'])) {
// an error occured during contact generation/identification
if ($contact_query['error_code'] == 'duplicate') {
// there have been multiple duplicates found
$contact_id = $contact_query['ids'][0];
} else {
civiproxy_http_error($contact_query['error_message'], 500);
}
} else {
$contact_id = $contact_query['id'];
}
// then: subscribe
$subscribe_query = civicrm_api3('MailingEventSubscribe', 'create',
array( 'email' => $email,
'contact_id' => $contact_id,
'group_id' => $group_id,
'api_key' => $mail_subscription_user_key,
));
if (!empty($subscribe_query['is_error'])) {
// an error occured during the actual subscription
civiproxy_http_error($subscribe_query['error_message'], 500);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CiviProxy Version <?php echo $civiproxy_version;?></title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.container {
position: relative;
width: 100%;
}
.center {
margin-left: auto;
margin-right: auto;
width: 970px;
}
p {
font-family: "Open Sans", sans-serif;
font-size: 160%;
}
#info {
padding-top: 20px;
vertical-align: top;
text-align: center;
width: 462px;
}
</style>
</head>
<body>
<div id="container">
<div id="info" class="center">
<a href="https://www.systopia.de/"><?php echo $civiproxy_logo;?></a>
<p id="version">Subscribe to Newsletters</p>
</div>
<div id="content" class="center">
<?php
if (empty($_REQUEST['email']) || !empty($parameter_errors)) {
// TODO: show error if no group found
// TODO: show error if email not valid
print "
<form id='subscribe' method='POST'>
<label for='email'>Your email Address:</label>
<input type='text' name='email'></input>
<h3>Select the newsletter you would like to subscribe to:</h3>
<select name='group_id'>
";
foreach ($groups as $group_id => $group) {
print "<option value='{$group_id}'>{$group['title']}</input>";
}
print "
</select>
<input type='submit' value='Subscribe' />
</form>";
} else {
// the subscription was complete
print "<p>Thank you. You will receive an email asking you to confirm your subscription.</p>";
}
?>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,89 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
ini_set('include_path', dirname(dirname(__FILE__)));
require_once "proxy.php";
// see if mailing subscribe feature is enabled
if (empty($mail_subscription_user_key)) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('mail-unsubscribe');
// basic restraints
$valid_parameters = array( 'jid' => 'int',
'qid' => 'int',
'h' => 'string');
$parameters = civiproxy_get_parameters($valid_parameters);
// check if parameters specified
if (empty($parameters['jid'])) civiproxy_http_error("Missing/invalid parameter 'jid'.");
if (empty($parameters['qid'])) civiproxy_http_error("Missing/invalid parameter 'qid'.");
if (empty($parameters['h'])) civiproxy_http_error("Missing/invalid parameter 'h'.");
// PERFORM UNSUBSCRIBE
$group_query = civicrm_api3('MailingEventUnsubscribe', 'create',
array( 'job_id' => $parameters['jid'],
'event_queue_id' => $parameters['qid'],
'hash' => $parameters['h'],
'api_key' => $mail_subscription_user_key,
));
if (!empty($group_query['is_error'])) {
civiproxy_http_error($group_query['error_message'], 500);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CiviProxy Version <?php echo $civiproxy_version;?></title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.container {
position: relative;
width: 100%;
}
.center {
margin-left: auto;
margin-right: auto;
width: 970px;
}
p {
font-family: "Open Sans", sans-serif;
font-size: 160%;
}
#info {
padding-top: 20px;
vertical-align: top;
text-align: center;
width: 462px;
}
</style>
</head>
<body>
<div id="container">
<div id="info" class="center">
<a href="https://www.systopia.de/"><?php echo $civiproxy_logo;?></a>
</div>
<div id="content" class="center">
<p>Thank you. You have been successfully unsubscribed.</a>
</div>
</div>
</body>
</html>

146
proxy/mosaico.php Normal file
View File

@ -0,0 +1,146 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2017-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
require_once "proxy.php";
// see if file caching is enabled
if (!$target_mosaico) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('file');
// basic restraints
$valid_parameters = array( 'id' => 'string', 'template_url' => 'string' );
$parameters = civiproxy_get_parameters($valid_parameters);
if (!empty($parameters['id'])) {
// check restrictions
if (!empty($file_cache_exclude)) {
foreach ($file_cache_exclude as $pattern) {
if (preg_match($pattern, $parameters['id'])) {
civiproxy_http_error("Invalid Resource", 403);
}
}
}
if (!empty($file_cache_include)) {
$accept_id = FALSE;
foreach ($file_cache_include as $pattern) {
if (preg_match($pattern, $parameters['id'])) {
$accept_id = TRUE;
}
}
if (!$accept_id) {
civiproxy_http_error("Invalid Resource", 403);
}
}
// look up the required resource
$header_key = 'header&' . $parameters['id'];
$data_key = 'data&' . $parameters['id'];
$url = $target_mosaico . $parameters['id'];
} elseif (!empty($parameters['template_url'])) {
// check restrictions
if (!empty($file_cache_exclude)) {
foreach ($file_cache_exclude as $pattern) {
if (preg_match($pattern, $parameters['template_url'])) {
civiproxy_http_error("Invalid Resource", 403);
}
}
}
if (!empty($file_cache_include)) {
$accept_id = FALSE;
foreach ($file_cache_include as $pattern) {
if (preg_match($pattern, $parameters['template_url'])) {
$accept_id = TRUE;
}
}
if (!$accept_id) {
civiproxy_http_error("Invalid Resource", 403);
}
}
// look up the required resource
$header_key = 'header&' . $parameters['template_url'];
$data_key = 'data&' . $parameters['template_url'];
$url = $target_mosaico_template_url . $parameters['template_url'];
} else {
civiproxy_http_error("Resource not found");
}
// load PEAR file cache
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'libs');
if (!file_exists($file_cache_options['cacheDir'])) mkdir($file_cache_options['cacheDir']);
require_once('Cache/Lite.php');
$file_cache = new Cache_Lite($file_cache_options);
$header = $file_cache->get($header_key);
$data = $file_cache->get($data_key);
if ($header && $data) {
// error_log("CACHE HIT");
$header_lines = json_decode($header);
foreach ($header_lines as $header_line) {
header($header_line);
}
print $data;
exit();
}
// if we get here, we have a cache miss => load
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, $url);
curl_setopt($curlSession, CURLOPT_HEADER, 1);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
if (!empty($target_interface)) {
curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface);
}
if (file_exists(dirname(__FILE__).'/target.pem')) {
curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem');
}
//Send the request and store the result in an array
$response = curl_exec($curlSession);
// Check that a connection was made
if (curl_error($curlSession)) {
error_log(curl_error($curlSession));
civiproxy_http_error(curl_error($curlSession), curl_errno($curlSession));
}
// process the results
$content = explode("\r\n\r\n", $response, 2);
$header = $content[0];
$body = $content[1];
// extract headers
$header_lines = explode(chr(10), $header);
// Remove chunked encoding header
foreach ($header_lines as $k => $header_line) {
if(strpos($header_line,'Transfer-Encoding: chunked') !== FALSE) {
unset($header_lines[$k]);
}
}
// store the information in the cache
$file_cache->save(json_encode($header_lines), $header_key);
$file_cache->save($body, $data_key);
// and reply
foreach ($header_lines as $header_line) {
header($header_line);
}
print $body;
curl_close ($curlSession);

View File

@ -2,7 +2,7 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
@ -16,8 +16,5 @@ if (!$target_open) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('open');
// basic restraints
$valid_parameters = array( 'q' => 'int' );
$parameters = civiproxy_get_parameters($valid_parameters);
$parameters = civiproxy_get_parameters($valid_open_parameters);
civiproxy_redirect($target_open, $parameters);

View File

@ -2,27 +2,25 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
$civiproxy_version = '0.2';
require_once "config.php";
$civiproxy_version = '1.0.0-beta';
/**
* this will redirect the request to another URL,
* i.e. will pass the reply on to this request
*
*
* @see losely based on https://code.google.com/p/php-proxy/
*
* @param $url the URL to which the
* @param $url the URL to which the
* where type can be 'int', 'string' (unchecked),
*/
function civiproxy_redirect($url_requested, $parameters) {
// error_log('CALLING: '.$url_requested);
// error_log(print_r($parameters,1));
global $target_interface;
$url = $url_requested;
$curlSession = curl_init();
@ -50,8 +48,13 @@ function civiproxy_redirect($url_requested, $parameters) {
curl_setopt($curlSession, CURLOPT_HEADER, 1);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlSession, CURLOPT_CAINFO, 'target.pem');
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
if (!empty($target_interface)) {
curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface);
}
if (file_exists(dirname(__FILE__).'/target.pem')) {
curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem');
}
//Send the request and store the result in an array
$response = curl_exec($curlSession);
@ -63,7 +66,7 @@ function civiproxy_redirect($url_requested, $parameters) {
} else {
//clean duplicate header that seems to appear on fastcgi with output buffer on some servers!!
$response = str_replace("HTTP/1.1 100 Continue\r\n\r\n","",$response);
// split header / content
$content = explode("\r\n\r\n", $response, 2);
$header = $content[0];
@ -87,102 +90,510 @@ function civiproxy_redirect($url_requested, $parameters) {
curl_close ($curlSession);
}
/**
* this will redirect the request to an API4 URL,
* i.e. will pass the reply on to this request
*
* @see losely based on https://code.google.com/p/php-proxy/
*
* @param $url_requested string the URL to which the request should be sent
* @param $parameters array
* @param $credentials array
*/
function civiproxy_redirect4($url_requested, $parameters, $credentials) {
global $target_interface, $authx_internal_flow;
$url = $url_requested;
$curlSession = curl_init();
$credential_params = civiproxy_build_credential_params($credentials, $authx_internal_flow);
$credential_headers = civiproxy_build_credential_headers($credentials, $authx_internal_flow);
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
// POST requests should be passed on as POST
curl_setopt($curlSession, CURLOPT_POST, 1);
$urlparams = 'params=' . urlencode(json_encode($parameters)) . $credential_params;
curl_setopt($curlSession, CURLOPT_POSTFIELDS, $urlparams);
} else {
// GET requests will get the parameters as url params
if (!empty($parameters)) {
$url .= '?params=' . urlencode(json_encode($parameters)) . $credential_params;
}
}
curl_setopt($curlSession, CURLOPT_HTTPHEADER, array_merge([
'Content-Type: application/x-www-form-urlencoded'
], $credential_headers));
curl_setopt($curlSession, CURLOPT_URL, $url);
curl_setopt($curlSession, CURLOPT_HEADER, 1);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
if (!empty($target_interface)) {
curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface);
}
if (file_exists(dirname(__FILE__).'/target.pem')) {
curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem');
}
//Send the request and store the result in an array
$response = curl_exec($curlSession);
// Check that a connection was made
if (curl_error($curlSession)){
civiproxy_http_error(curl_error($curlSession), curl_errno($curlSession));
} else {
//clean duplicate header that seems to appear on fastcgi with output buffer on some servers!!
$response = str_replace("HTTP/1.1 100 Continue\r\n\r\n","",$response);
// split header / content
$content = explode("\r\n\r\n", $response, 2);
$header = $content[0];
$body = $content[1];
// handle headers - simply re-outputing them
$header_ar = explode(chr(10), $header);
foreach ($header_ar as $header_line){
if (!preg_match("/^Transfer-Encoding/", $header_line)){
civiproxy_mend_URLs($header_line);
header(trim($header_line));
}
}
//rewrite all hard coded urls to ensure the links still work!
civiproxy_mend_URLs($body);
print $body;
}
curl_close($curlSession);
}
/**
* Creates a string with the API credentials to be appended to an API4 GET or POST request.
* When $api4_internal_auth_flow is 'header' or 'xheader', returns a blank string
*
* @param array $credentials
* @param string $authx_internal_flow
* @return string credential string, including leading '&'
*/
function civiproxy_build_credential_params(array $credentials, string $authx_internal_flow): string {
switch($authx_internal_flow) {
case 'legacyrest':
$map = ['api_key' => 'api_key', 'key' => 'key'];
break;
case 'param':
$map = ['api_key' => '_authx', 'key' => '_authxSiteKey'];
break;
default:
return '';
}
$params = [];
foreach($map as $credential_key => $param_name) {
if (isset($credentials[$credential_key])) {
$credential_value = $credentials[$credential_key];
if ($param_name === '_authx') {
$credential_value = 'Bearer ' . $credential_value;
}
$params[$param_name] = $credential_value;
}
}
$param_string = http_build_query($params);
if (!empty($param_string)) {
$param_string = '&' . $param_string;
}
return $param_string;
}
/**
* Builds an array of headers to send on an API4 request. When $api4_internal_auth_flow
* is 'param' or 'legacyrest', will always return an empty array.
*
* @param array $credentials
* @param string $authx_internal_flow
* @return array
*/
function civiproxy_build_credential_headers(array $credentials, string $authx_internal_flow): array {
switch($authx_internal_flow) {
case 'header':
$map = ['api_key' => 'Authorization: Bearer', 'key' => 'X-Civi-Key:'];
break;
case 'xheader':
$map = ['api_key' => 'X-Civi-Auth: Bearer', 'key' => 'X-Civi-Key:'];
break;
default:
return [];
}
$headers = [];
foreach($map as $credential_key => $header_prefix) {
if (isset($credentials[$credential_key])) {
$headers[] = $header_prefix . ' ' . $credentials[$credential_key];
}
}
return $headers;
}
/**
* Will mend all the URLs in the string that point to the target,
* so they will point to this proxy instead
*/
function civiproxy_mend_URLs(&$string) {
global $target_rest, $target_url, $target_open, $target_file, $target_mail, $proxy_base;
global $target_rest, $target_url, $target_open, $target_file, $target_mail, $proxy_base, $target_mosaico, $target_civicrm;
if ($target_rest) {
$string = preg_replace("#$target_rest#", $proxy_base . '/rest.php', $string);
$string = preg_replace("#{$target_rest}#", $proxy_base . '/rest.php', $string);
}
if ($target_url) {
$string = preg_replace("#$target_url#", $proxy_base . '/url.php', $string);
$string = preg_replace("#{$target_url}#", $proxy_base . '/url.php', $string);
}
if ($target_open) {
$string = preg_replace("#$target_open#", $proxy_base . '/open.php', $string);
$string = preg_replace("#{$target_open}#", $proxy_base . '/open.php', $string);
}
if ($target_mail) {
$string = preg_replace("#$target_mail#", $proxy_base . '/mail.php', $string);
$string = preg_replace("#{$target_mail}#", $proxy_base . '/mail.php', $string);
}
if ($target_file) {
$string = preg_replace("#$target_file#", $proxy_base . '/file.php?id=', $string);
$string = preg_replace("#{$target_file}#", $proxy_base . '/file.php?id=', $string);
// https://github.com/systopia/CiviProxy/issues/38
// fix for relative
if ($target_mosaico) {
$string = preg_replace("#src=\"\/sites\/default\/files\/civicrm\/persist\/#", 'src="' . $proxy_base . '/file.php?id=', $string);
}
}
if ($target_mosaico) {
// replace full, and relative URL
// $string = preg_replace("#{$target_mosaico}#", $proxy_base . '/mosaico.php?id=', $string);
$string = preg_replace("#{$target_civicrm}/civicrm/mosaico/img\?src=#", $proxy_base . '/mosaico.php?id=', $string);
}
}
/**
* Will check the incoming connection.
* This hook allowes for (future) checks for flooding, spoofing,
* This hook allowes for (future) checks for flooding, spoofing,
* unauthorized access quantities, etc.
*
* @param $target
* @param $quit if TRUE, quit immediately if access denied
*
* @param $target
* @param $quit bool if TRUE, quit immediately if access denied
* @param $log_headers array add these headers (sanitized) to log data
*
* @return TRUE if allowed, FALSE if not (or quits if $quit is set)
*/
function civiproxy_security_check($target, $quit=TRUE) {
function civiproxy_security_check($target, $quit=TRUE, $log_headers = []) {
// verify that we're SSL encrypted
if ($_SERVER['HTTPS'] != "on") {
civiproxy_http_error("This CiviProxy installation requires SSL encryption.", 400);
}
global $debug;
if (!empty($debug)) {
// filter log data
$log_data = $_REQUEST;
$sanitize_params = ['api_key', 'key', '_authxSiteKey', '_authx'];
foreach ($sanitize_params as $param) {
if (isset($log_data[$param])) {
$log_data[$param] = substr($log_data[$param], 0, 4) . '...';
}
}
foreach($log_headers as $header) {
if (!empty($_SERVER[$header]))
$log_data[$header] = substr($_SERVER[$header], 0, 4) . '...';
}
// log
civiproxy_log("REQUEST FROM " . $_SERVER['REMOTE_ADDR'] . " ON " . date('Y-m-d H:i:s') . ' -- ' . print_r($log_data ,1));
}
// TODO: implement
return TRUE;
}
/**
* Log a message to the proxy log - if enabled
*
* @param $message string the log message
*/
function civiproxy_log($message) {
global $debug;
if (!empty($debug)) {
$file = fopen($debug, 'a');
fwrite($file, "REQUEST FROM " . $_SERVER['REMOTE_ADDR'] . " ON " . date('Y-m-d H:i:s') . ' -- ' . print_r($_REQUEST,1));
fwrite($file, $message);
fclose($file);
}
// TODO: implement
return TRUE;
}
/**
* extract and type check the parameters from the call params
*
*
* @param $valid_parameters array '<parameter name> => '<expected type>'
* where type can be 'int', 'string' (unchecked),
* @param $request provides the request data to use,
* defaults to $_REQUEST
*/
function civiproxy_get_parameters($valid_parameters) {
function civiproxy_get_parameters($valid_parameters, $request = NULL) {
if ($request === NULL) {
$request = $_REQUEST;
}
$result = array();
$default_sanitation = NULL;
foreach ($valid_parameters as $name => $type) {
if (isset($_REQUEST[$name])) {
$value = $_REQUEST[$name];
if ($type=='int') {
$value = (int) $value;
} elseif ($type == 'string') {
// TODO: sanitize? SQL?
$value = $value;
} elseif ($type == 'float2') {
// TODO: check if safe wrt l10n. rather use sprintf
$value = number_format($value, 2, '.', '');
} elseif (is_array($type)) {
// this is a list of valid options
$requested_value = $value;
$value = '';
foreach ($type as $allowed_value) {
if ($requested_value === $allowed_value) {
$value = $requested_value;
break;
}
}
} else {
error_log("CiviProxy: unknown type '$type'. Ignored.");
$value = '';
if ($name == '*') {
// this sets default_sanitation
$default_sanitation = $type;
continue;
}
if (isset($request[$name])) {
$result[$name] = civiproxy_sanitise($request[$name], $type);
}
}
// process wildcard elements
if ($default_sanitation !== NULL) {
// i.e. we want the others too
$remove_parameters = array('key', 'api_key', '_authx', '_authxSiteKey', 'version', 'entity', 'action');
foreach ($request as $name => $value) {
if (!in_array($name, $remove_parameters) && !isset($valid_parameters[$name])) {
$result[$name] = civiproxy_sanitise($value, $default_sanitation);
}
$result[$name] = $value;
}
}
return $result;
}
/**
* Get the value of a header on the incoming request
*
* @param string $header name of the header, in all uppercase
* @param string $prefix to be stripped off the value of the header
* @return string|null value of the header, or null if not found.
*/
function civiproxy_get_header($header, $prefix = ''): ?string {
if (!empty($_SERVER['HTTP_' . $header])) {
$value = $_SERVER['HTTP_' . $header];
if ($prefix === '') {
return $value;
}
if (strpos($value, $prefix) === 0) {
return trim(substr($value, strlen($prefix)));
}
}
return NULL;
}
/**
* sanitise the given value with the given sanitiation type
*/
function civiproxy_sanitise($value, $type) {
if ($type=='int') {
$value = (int) $value;
} elseif ($type == 'string') {
// TODO: sanitize? SQL?
$value = $value;
} elseif ($type == 'float2') {
// TODO: check if safe wrt l10n. rather use sprintf
$value = number_format($value, 2, '.', '');
} elseif ($type == 'hex') {
// hex code
if (!preg_match("#^[0-9a-f]*$#i", $value)) {
error_log("CiviProxy: removed invalid hex parameter: " . $value);
$value = '';
}
} elseif ($type == 'email') {
// valid email
if (!preg_match("#^[_a-z0-9-]+[._a-z0-9-+]*@[a-z0-9-]+[.a-z0-9-]*\.[a-z]{2,3}$#i", $value)) {
error_log("CiviProxy: removed invalid email parameter: " . $value);
$value = '';
}
} elseif ($type == 'json') {
// valid json
$json_data = json_decode($value, true);
if ($json_data === NULL) {
$value = '';
} else {
$value = json_encode($value);
}
} elseif ($type == 'array') {
// this should only happen _inside_ the json field
if (!is_array($value)) {
$value = '';
}
} elseif (is_array($type)) {
// this is a list of valid options
$requested_value = $value;
$value = '';
foreach ($type as $allowed_value) {
if ($requested_value === $allowed_value) {
$value = $requested_value;
break;
}
}
} else {
error_log("CiviProxy: unknown type '$type'. Ignored.");
$value = '';
}
return $value;
}
/**
* generates a CiviCRM REST API compliant error
* and ends processing
*/
function civiproxy_http_error($message, $code = 404) {
global $civiproxy_version;
header("HTTP/1.1 $code $message (CiviProxy {$civiproxy_version})");
// TODO: create error msg body
global $error_message;
global $civiproxy_logo;
$civiproxy_error_message = $message;
header("HTTP/1.1 $code $civiproxy_error_message (CiviProxy {$civiproxy_version})");
require "error.php";
exit();
}
/**
* call the CiviCRM REST API via CURL
*/
function civicrm_api3($entity, $action, $data) {
global $target_rest, $sys_key_map, $target_interface;
// extract site key
$site_keys = array_values($sys_key_map);
if (empty($site_keys)) civiproxy_http_error('No site key set.');
$query = $data; // array copy(!)
$query['key'] = $site_keys[0];
$query['json'] = 1;
$query['version'] = 3;
$query['entity'] = $entity;
$query['action'] = $action;
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_POST, 1);
curl_setopt($curlSession, CURLOPT_POSTFIELDS, $query);
curl_setopt($curlSession, CURLOPT_URL, $target_rest);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
if (!empty($target_interface)) {
curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface);
}
// curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
if (file_exists(dirname(__FILE__).'/target.pem')) {
curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem');
}
$response = curl_exec($curlSession);
if (curl_error($curlSession)){
civiproxy_http_error(curl_error($curlSession));
} else {
return json_decode($response, true);
}
}
/**
* Function to get the valid rest_allowed_actions key
*
* @param $action
* @param $rest_allowed_actions
* @return bool
*/
function civiproxy_get_valid_allowed_actions_key($action, $rest_allowed_actions) {
$remote_addr = $_SERVER['REMOTE_ADDR'];
// check IP specific whitelisting if specified for this address
if (isset($rest_allowed_actions[$remote_addr])) {
if (civiproxy_validate_api_entity_and_action($remote_addr, $action['entity'], $action['action'], $rest_allowed_actions)) {
$valid_key = $remote_addr;
} else {
$valid_key = 'all';
}
} else {
$valid_key = 'all';
}
return $valid_key;
}
/**
* Function to check whether the api entity and api action are valid for the remote address.
* This function does a case insensitive comparison.
*
* @param $remote_addr
* 'all', or the remote address.
* @param $api_entity
* The api entity.
* @param $api_action
* The api action.
* @param $rest_allowed_actions
* The array with the allowed actions.
* @return bool
*/
function civiproxy_validate_api_entity_and_action($remote_addr, $api_entity, $api_action, $rest_allowed_actions) {
if (!isset($rest_allowed_actions[$remote_addr])) {
return false;
}
$api_entity = strtolower($api_entity);
$api_action = strtolower($api_action);
if (isset($rest_allowed_actions[$remote_addr][$api_entity]) && isset($rest_allowed_actions[$remote_addr][$api_entity][$api_action])) {
return true;
}
// Did not find the lower case variant.
// loop through the array
foreach($rest_allowed_actions[$remote_addr] as $allowed_entity => $allowed_actions) {
if (strtolower($allowed_entity) == $api_entity) {
foreach($allowed_actions as $allowed_action => $fields) {
if (strtolower($allowed_action) == $api_action) {
return true;
}
}
}
}
return false;
}
/**
* Function to retrieve the valid parameters of an api call
* This function does a case insensitive comparison.
*
* @param $remote_addr
* 'all', or the remote address.
* @param $api_entity
* The api entity.
* @param $api_action
* The api action.
* @param $rest_allowed_actions
* The array with the allowed actions.
* @return array()|null
**/
function civiproxy_retrieve_api_parameters($remote_addr, $api_entity, $api_action, $rest_allowed_actions) {
if (!isset($rest_allowed_actions[$remote_addr])) {
return null;
}
$api_entity = strtolower($api_entity);
$api_action = strtolower($api_action);
if (isset($rest_allowed_actions[$remote_addr][$api_entity]) && isset($rest_allowed_actions[$remote_addr][$api_entity][$api_action])) {
return $rest_allowed_actions[$remote_addr][$api_entity][$api_action];
}
// Did not find the lower case variant.
// loop through the array
foreach($rest_allowed_actions[$remote_addr] as $allowed_entity => $allowed_actions) {
if (strtolower($allowed_entity) == $api_entity) {
foreach($allowed_actions as $allowed_action => $parameters) {
if (strtolower($allowed_action) == $api_action) {
return $parameters;
}
}
}
}
return null;
}

View File

@ -2,18 +2,18 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
require_once "proxy.php";
require_once "checks.php";
// see if REST API is enabled
if (!$target_rest) civiproxy_http_error("Feature disabled", 405);
// basic check
if (!civiproxy_security_check('rest')) {
civiproxy_rest_error("Access denied.");
@ -21,37 +21,18 @@ if (!civiproxy_security_check('rest')) {
// check credentials
$credentials = civiproxy_get_parameters(array('key' => 'string', 'api_key' => 'string'));
if (empty($credentials['key'])) {
civiproxy_rest_error("No site key given");
} else {
if (isset($sys_key_map[$credentials['key']])) {
$credentials['key'] = $sys_key_map[$credentials['key']];
} else {
civiproxy_rest_error("Invalid site key");
}
}
if (empty($credentials['api_key'])) {
civiproxy_rest_error("No API key given");
} else {
if (isset($api_key_map[$credentials['api_key']])) {
$credentials['api_key'] = $api_key_map[$credentials['api_key']];
} else {
civiproxy_rest_error("Invalid api key");
}
}
civiproxy_map_site_key($credentials, $sys_key_map);
civiproxy_map_api_key($credentials, $api_key_map);
// check if the call itself is allowed
$action = civiproxy_get_parameters(array('entity' => 'string', 'action' => 'string', 'version' => 'int', 'json' => 'int', 'sequential' => 'int'));
if (!isset($action['version']) || $action['version'] != 3) {
civiproxy_rest_error("Invalid entity/action.");
}
if (isset($rest_allowed_actions[$action['entity']]) && isset($rest_allowed_actions[$action['entity']][$action['action']])) {
$valid_parameters = $rest_allowed_actions[$action['entity']][$action['action']];
} else {
civiproxy_rest_error("Invalid entity/action.");
civiproxy_rest_error("API 'version' information missing.");
}
$valid_parameters= civiproxy_get_valid_parameters($action, $rest_allowed_actions);
// extract parameters and add credentials and action data
$parameters = civiproxy_get_parameters($valid_parameters);
foreach ($credentials as $key => $value) {
@ -61,19 +42,18 @@ foreach ($action as $key => $value) {
$parameters[$key] = $value;
}
// finally execute query
civiproxy_redirect($target_rest, $parameters);
/**
* generates a CiviCRM REST API compliant error
* and ends processing
*/
function civiproxy_rest_error($message) {
$error = array( 'is_error' => 1,
'error_message' => $message);
// TODO: Implement
//header();
print json_encode($error);
exit();
// evaluate the JSON parameter
global $rest_evaluate_json_parameter;
if ($rest_evaluate_json_parameter) {
if (isset($_REQUEST['json'])) {
$json_data = json_decode($_REQUEST['json'], true);
if (!empty($json_data) && is_array($json_data)) {
$json_parameters = civiproxy_get_parameters($valid_parameters, $json_data);
$parameters['json'] = json_encode($json_parameters);
}
}
}
// finally execute query
civiproxy_log($target_rest);
civiproxy_redirect($target_rest, $parameters);

89
proxy/rest4.php Normal file
View File

@ -0,0 +1,89 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
require_once "proxy.php";
require_once "checks.php";
// see if REST API is enabled
if (!$target_rest4) {
civiproxy_http_error("Feature disabled");
}
$valid_flows = ['header', 'xheader', 'legacyrest', 'param'];
$headers_by_flow = [
'header' => ['HTTP_AUTHORIZATION', 'HTTP_X_CIVI_KEY'],
'xheader' => ['HTTP_X_CIVI_AUTH', 'HTTP_X_CIVI_KEY'],
'legacyrest' => [],
'param' => [],
];
if (!in_array($authx_internal_flow, $valid_flows)) {
civiproxy_http_error("Invalid internal auth flow '$authx_internal_flow'", 500);
}
$headers_to_log = [];
foreach ($authx_external_flow as $external_flow) {
if (!in_array($external_flow, $valid_flows)) {
civiproxy_http_error("Invalid external auth flow '$external_flow'", 500);
}
$headers_to_log = array_merge($headers_to_log, $headers_by_flow[$external_flow]);
}
// basic check
if (!civiproxy_security_check('rest', TRUE, $headers_to_log)) {
civiproxy_rest_error("Access denied.");
}
$credentials = [];
// Find credentials on the incoming request
foreach ($authx_external_flow as $external_flow) {
switch($external_flow) {
case 'header':
$credentials['api_key'] = civiproxy_get_header('AUTHORIZATION', 'Bearer ');
$credentials['key'] = civiproxy_get_header('HTTP_X_CIVI_KEY');
break;
case 'xheader':
$credentials['api_key'] = civiproxy_get_header('X_CIVI_AUTH', 'Bearer ');
$credentials['key'] = civiproxy_get_header('HTTP_X_CIVI_KEY');
break;
case 'legacyrest':
$credentials = civiproxy_get_parameters(array('api_key' => 'string', 'key' => 'string'));
break;
case 'param':
$authx_credentials = civiproxy_get_parameters(array('_authx' => 'string', '_authxSiteKey' => 'string'));
if (!empty($authx_credentials['_authx'])) {
// Snip off leading 'Bearer ' or 'Bearer+'
if (substr($authx_credentials['_authx'], 0, 6) === 'Bearer') {
$credentials['api_key'] = substr($authx_credentials['_authx'], 7);
}
}
if (!empty($authx_credentials['_authxSiteKey'])) {
$credentials['key'] = $authx_credentials['_authxSiteKey'];
}
break;
}
if (!empty($credentials['api_key'])) {
break;
}
}
civiproxy_map_api_key($credentials, $api_key_map);
if (!empty($credentials['key'])) {
civiproxy_map_site_key( $credentials, $sys_key_map);
}
// check if the call itself is allowed
$action = civiproxy_get_parameters(array('entity' => 'string', 'action' => 'string'));
$valid_parameters = civiproxy_get_valid_parameters($action, $rest_allowed_actions);
// extract parameters and add action data
$parameters = civiproxy_get_parameters($valid_parameters, json_decode($_REQUEST['params'], true));
// finally execute query
civiproxy_log($target_rest4);
civiproxy_redirect4($target_rest4 . $action['entity'] . '/' . $action['action'] , $parameters, $credentials);

View File

@ -2,7 +2,7 @@
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2015 SYSTOPIA |
| Copyright (C) 2015-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
@ -16,10 +16,5 @@ if (!$target_url) civiproxy_http_error("Feature disabled", 405);
// basic check
civiproxy_security_check('url');
// basic restraints
$valid_parameters = array( 'u' => 'int',
'q' => 'int',
'qid' => 'int');
$parameters = civiproxy_get_parameters($valid_parameters);
$parameters = civiproxy_get_parameters($valid_url_parameters);
civiproxy_redirect($target_url, $parameters);

298
proxy/webhook2api.php Normal file
View File

@ -0,0 +1,298 @@
<?php
/*--------------------------------------------------------+
| SYSTOPIA CiviProxy |
| a simple proxy solution for external access to CiviCRM |
| Copyright (C) 2019-2021 SYSTOPIA |
| Author: B. Endres (endres -at- systopia.de) |
| http://www.systopia.de/ |
+---------------------------------------------------------*/
require_once "config.php";
require_once "proxy.php";
// first check if webhooks are enabled
if (empty($webhook2api)) civiproxy_http_error("Feature disabled", 405);
// basic check
if (!civiproxy_security_check('webhook2api')) {
civiproxy_http_error("Access denied", 403);
}
// find the right configuration
if (!empty($_REQUEST['id']) && isset($webhook2api['configurations'][$_REQUEST['id']])) {
// we found the if in the configurations
$configurations = [$webhook2api['configurations'][$_REQUEST['id']]];
} elseif (empty($_REQUEST['id']) && isset($webhook2api['configurations']['default'])) {
// this is teh default configuration
$configurations = [$webhook2api['configurations']['default']];
} else {
// use all of them (first one matching is executed)
$configurations = $webhook2api['configurations'];
}
// read some input
$post_input = @file_get_contents('php://input');
// MAIN: iterate through all (eligible) configurations
$last_error = ["No handler found", 501];
foreach ($configurations as $configuration) {
$last_error = webhook2api_processConfiguration($configuration, $post_input);
if ($last_error == NULL) {
// success!
break;
}
}
// finally - if there was only errors, return the last one
if ($last_error) {
civiproxy_http_error($last_error[0], $last_error[1]);
}
/**
* Apply the given configuration. If it matches and executes,
* it returns NULL, otherwise
*
* @param $configuration array configuration/specification
* @return null|array [status_code, error message]
*/
function webhook2api_processConfiguration($configuration, $post_input) {
// check the IP/range restrictions
if (!empty($configuration['ip_sources']) && is_array($configuration['ip_sources'])) {
$ip = $_SERVER['REMOTE_ADDR'];
$access_granted = FALSE;
foreach ($configuration['ip_sources'] as $netmask) {
// copied from https://secure.php.net/manual/de/ref.network.php
list ($net, $mask) = explode("/", $netmask);
$ip_net = ip2long ($net);
$ip_mask = ~((1 << (32 - $mask)) - 1);
$ip_ip = ip2long ($ip);
$ip_ip_net = $ip_ip & $ip_mask;
if ($ip_ip_net == $ip_net) {
$access_granted = TRUE;
break;
}
}
if (!$access_granted) {
// this configuration is not eligible
return ["Access denied", 403];
}
}
// gather source data
$data = [];
if (!empty($configuration['data_sources']) && is_array($configuration['data_sources'])) {
foreach ($configuration['data_sources'] as $data_source) {
switch ($data_source) {
case 'POST/json': # JSON data in POST field
$more_data = json_decode($post_input, TRUE);
$data = array_merge_recursive($data, $more_data);
break;
case 'REQUEST': # simple request parameters
$data = array_merge_recursive($data, $_REQUEST);
break;
default:
civiproxy_log("Webhook2API[{$configuration['name']}]: unknown source '{$data_source}' in configuration. Ignored.");
}
}
}
// default return code if everything goes according to plan
$http_code = 200;
// check if we have a json_array and react accordingly
if (isset($data[0]) && is_array($data[0])) {
foreach ($data as $d) {
$result = webhook2api_callCiviApi($configuration, $d);
if(isset($result['internal_error'])) {
// internal communication Error occurred. Aborting process
civiproxy_log("Webhook2API[{$configuration['name']}]: internal error occurred: " . json_encode($result['internal_error']));
return $result['internal_error'];
}
if (!empty($result['values']['http_code'])) {
$http_code = $result['values']['http_code'];
} else {
$http_code = 403;
break;
}
}
} else {
$result = webhook2api_callCiviApi($configuration, $data);
if(isset($result['internal_error'])) {
// internal communication Error occurred. Aborting process
civiproxy_log("Webhook2API[{$configuration['name']}]: internal error occurred: " . json_encode($result['internal_error']));
return $result['internal_error'];
}
if (!empty($result['values']['http_code'])) {
$http_code = $result['values']['http_code'];
} elseif ($result['is_error'] != 0) {
$http_code = 403;
}
}
if ($http_code != '200') {
// we received and parsed the webhook event successfully, but an error occurred with civicrm:
civiproxy_log("Webhook2API[{$configuration['name']}]: Internal CiviCRM Error. Error Code: {$http_code}. Full Message: " . json_encode($result));
}
// process result
if (!empty($configuration['response_mapping']) && is_array($configuration['response_mapping'])) {
// TODO: implement
http_response_code('200');
civiproxy_log("Webhook successful, response mapped.");
} else {
// default behaviour:
http_response_code('200');
civiproxy_log("Webhook successful.");
}
// all done
exit();
}
/**
* Parse Configuration and given data set, apply it and send it to civicrm.
* Returns an internal error if communication to civicrm isn't successful
*
* @param $configuration
* @param $data
*
* @return array|mixed|void
* @throws \CiviCRM_API3_Exception
*/
function webhook2api_callCiviApi($configuration, $data) {
// evaluate sentinels
if (!empty($configuration['sentinel']) && is_array($configuration['sentinel'])) {
foreach ($configuration['sentinel'] as $sentinel) {
list($value_source, $check) = $sentinel;
$value = webhook2api_getValue($data, $value_source);
if (substr($check, 0, 6) == "equal:") {
// check if terms a equal
if (substr($check, 6) != $value) {
return ["internal_error" => "Access denied", 403];
}
} else {
echo "Error";
// unknown instruction
civiproxy_log("Webhook2API[{$configuration['name']}]: don't understand sentinel '{$check}'. Ignored.");
}
}
}
// compile API query
$params = [];
if (!empty($configuration['parameter_mapping']) && is_array($configuration['parameter_mapping'])) {
foreach ($configuration['parameter_mapping'] as $mapping) {
$source_path = $mapping[0];
$target_path = $mapping[1];
$modifiers = isset($mapping[2]) ? $mapping[2] : [];
// get value
$value = webhook2api_getValue($data, $source_path);
// run modifiers
foreach ($modifiers as $modifier) {
// TODO: implement
civiproxy_log("Webhook2API.modifiers: not implemented!");
}
// set to target
webhook2api_setValue($params, $target_path, $value);
}
} else {
$params = $data;
}
// sanitise data
if (!empty($configuration['parameter_sanitation']) && is_array($configuration['parameter_sanitation'])) {
// TODO: implement
civiproxy_log("Webhook2API.sanitation: not implemented!");
}
// send to target REST API
if (empty($configuration['entity']) || empty($configuration['action'])) {
civiproxy_log("Webhook2API[{$configuration['name']}]: Missing entity/action.");
return ["internal_error" => "Configuration error", 403];
}
if (empty($configuration['api_key'])) {
civiproxy_log("Webhook2API[{$configuration['name']}]: Missing api_key.");
return ["internal_error" => "Configuration error", 403];
}
$params['api_key'] = $configuration['api_key'];
// run API call
return civicrm_api3($configuration['entity'], $configuration['action'], $params);
}
/**
* Get the value from a multidimensional array,
* specified by the path
*
* @param $data array multidimensional data array
* @param $path array|string path description
* @return mixed value
*/
function webhook2api_getValue($data, $path) {
if (is_string($path)) {
if (isset($data[$path])) {
return $data[$path];
} else {
return NULL;
}
} elseif (is_array($path)) {
if (count($path) == 0) {
return NULL;
} elseif (count($path) == 1) {
return webhook2api_getValue($data, $path[0]);
} else {
$path_element = array_shift($path);
$sub_data = webhook2api_getValue($data, $path_element);
if (is_array($sub_data)) {
return webhook2api_getValue($sub_data, $path);
} else {
return NULL;
}
}
}
}
/**
* Set the value from a multidimensional array as specified by the path
*
* @param $data array the data
* @param $target_path array destination
* @param $value mixed value
*/
function webhook2api_setValue(&$data, $target_path, $value) {
if (is_array($target_path)) {
if (count($target_path) == 0) {
civiproxy_log("Webhook2API.setValue: Empty target path!");
return;
} elseif (count($target_path) == 1) {
// last element -> set value
$data[$target_path[0]] = $value;
} else {
// not last element
$element = array_shift($target_path);
if (!isset($data[$element])) {
$data[$element] = [];
}
if (is_array($data[$element])) {
webhook2api_setValue($data[$element], $target_path, $value);
} else {
civiproxy_log("Webhook2API.setValue: path node is not an array!");
}
}
} elseif (is_string($target_path)) {
webhook2api_setValue($data, [$target_path], $value);
} else {
civiproxy_log("Webhook2API.setValue: path neither string nor array!");
}
}