Payment Form for PayPal Pro - Version 1.0.1

Version Description

  • First stable version released.

=

Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Payment Form for PayPal Pro
Version 1.0.1
Comparing to
See all releases

Version 1.0.1

Files changed (246) hide show
  1. README.txt +166 -0
  2. captcha/captcha.php +173 -0
  3. captcha/font-1.ttf +0 -0
  4. captcha/font-2.ttf +0 -0
  5. captcha/font-3.ttf +0 -0
  6. captcha/font-4.ttf +0 -0
  7. cp_ppp.php +1452 -0
  8. cp_ppp_admin_int.php +723 -0
  9. cp_ppp_admin_int_list.inc.php +300 -0
  10. cp_ppp_admin_int_message_list.inc.php +230 -0
  11. cp_ppp_data_source.inc.php +342 -0
  12. cp_ppp_paypal_pro_int.inc.php +379 -0
  13. cp_ppp_public_int.inc.php +148 -0
  14. cp_ppp_scripts.js +3 -0
  15. css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
  16. css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
  17. css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
  18. css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
  19. css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
  20. css/cupertino/images/ui-bg_glass_80_eebd4d_1x400.png +0 -0
  21. css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
  22. css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
  23. css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
  24. css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
  25. css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
  26. css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
  27. css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
  28. css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
  29. css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
  30. css/cupertino/jquery-ui-1.8.20.custom.css +565 -0
  31. css/style.css +105 -0
  32. css/stylepublic.css +80 -0
  33. images/Thumbs.db +0 -0
  34. images/blank.gif +0 -0
  35. images/colorpicker_background.png +0 -0
  36. images/colorpicker_hex.png +0 -0
  37. images/colorpicker_hsb_b.png +0 -0
  38. images/colorpicker_hsb_h.png +0 -0
  39. images/colorpicker_hsb_s.png +0 -0
  40. images/colorpicker_indic.gif +0 -0
  41. images/colorpicker_overlay.png +0 -0
  42. images/colorpicker_rgb_b.png +0 -0
  43. images/colorpicker_rgb_g.png +0 -0
  44. images/colorpicker_rgb_r.png +0 -0
  45. images/colorpicker_select.gif +0 -0
  46. images/colorpicker_submit.png +0 -0
  47. images/cp_form.gif +0 -0
  48. images/custom_background.png +0 -0
  49. images/custom_hex.png +0 -0
  50. images/custom_hsb_b.png +0 -0
  51. images/custom_hsb_h.png +0 -0
  52. images/custom_hsb_s.png +0 -0
  53. images/custom_indic.gif +0 -0
  54. images/custom_rgb_b.png +0 -0
  55. images/custom_rgb_g.png +0 -0
  56. images/custom_rgb_r.png +0 -0
  57. images/custom_submit.png +0 -0
  58. images/loading.gif +0 -0
  59. images/recycle_bin.png +0 -0
  60. images/select.png +0 -0
  61. images/select2.png +0 -0
  62. images/slider.png +0 -0
  63. images/tooltop.gif +0 -0
  64. js/fbuilder-loader-admin.php +83 -0
  65. js/fbuilder-loader-public.php +90 -0
  66. js/fbuilder-pro-admin.jquery.js +918 -0
  67. js/fbuilder-pro-public.jquery.js +338 -0
  68. js/fields-admin/000_category.form.js +4 -0
  69. js/fields-admin/001_category.ds.js +4 -0
  70. js/fields-admin/003_category.containers.js +4 -0
  71. js/fields-admin/00_jquery.parse.min.js +6 -0
  72. js/fields-admin/01_fbuilder.ftext.js +30 -0
  73. js/fields-admin/02_fbuilder.fcurrency.js +35 -0
  74. js/fields-admin/02_fbuilder.fnumber.js +33 -0
  75. js/fields-admin/03_fbuilder.femail.js +56 -0
  76. js/fields-admin/04_fbuilder.fdate.js +51 -0
  77. js/fields-admin/05_fbuilder.ftextarea.js +30 -0
  78. js/fields-admin/06_fbuilder.fcheck.js +26 -0
  79. js/fields-admin/07_fbuilder.fradio.js +27 -0
  80. js/fields-admin/08_fbuilder.fdropdown.js +27 -0
  81. js/fields-admin/09_fbuilder.ffile.js +28 -0
  82. js/fields-admin/10_fbuilder.fpassword.js +30 -0
  83. js/fields-admin/11_fbuilder.fphone.js +26 -0
  84. js/fields-admin/12_fbuilder.fcommentarea.js +24 -0
  85. js/fields-admin/13_fbuilder.fhidden.js +24 -0
  86. js/fields-admin/14_fbuilder.fsectionbreak.js +24 -0
  87. js/fields-admin/15_fbuilder.fpagebreak.js +23 -0
  88. js/fields-admin/16_fbuilder.fsummary.js +26 -0
  89. js/fields-admin/17_fbuilder.datasource.js +560 -0
  90. js/fields-admin/18_fbuilder.ftext.ds.js +23 -0
  91. js/fields-admin/19_fbuilder.femail.ds.js +22 -0
  92. js/fields-admin/20_fbuilder.ftextarea.ds.js +23 -0
  93. js/fields-admin/21_fbuilder.fcheck.ds.js +22 -0
  94. js/fields-admin/22_fbuilder.fradio.ds.js +23 -0
  95. js/fields-admin/23_fbuilder.fphone.ds.js +23 -0
  96. js/fields-admin/26_fbuilder.fdropdown.ds.js +23 -0
  97. js/fields-admin/27_fbuilder.fhidden.ds.js +24 -0
  98. js/fields-admin/28_fbuilder.fcontainer.js +96 -0
  99. js/fields-admin/29_fbuilder.ffieldset.fc.js +25 -0
  100. js/fields-admin/30_fbuilder.fdiv.fc.js +25 -0
  101. js/fields-public/03_fbuilder.femail.js +24 -0
  102. js/jQuery.stringify.js +50 -0
  103. js/jquery.caret.js +55 -0
  104. js/jquery.validate.js +1253 -0
  105. js/modules/index.html +0 -0
  106. languages/cpppp-af.mo +0 -0
  107. languages/cpppp-af.po +78 -0
  108. languages/cpppp-ar.mo +0 -0
  109. languages/cpppp-ar.po +75 -0
  110. languages/cpppp-az.mo +0 -0
  111. languages/cpppp-az.po +74 -0
  112. languages/cpppp-be_BY.mo +0 -0
  113. languages/cpppp-be_BY.po +80 -0
  114. languages/cpppp-bg_BG.mo +0 -0
  115. languages/cpppp-bg_BG.po +73 -0
  116. languages/cpppp-bn_IN.mo +0 -0
  117. languages/cpppp-bn_IN.po +76 -0
  118. languages/cpppp-bs_BA.mo +0 -0
  119. languages/cpppp-bs_BA.po +65 -0
  120. languages/cpppp-ca.mo +0 -0
  121. languages/cpppp-ca.po +73 -0
  122. languages/cpppp-ckb.mo +0 -0
  123. languages/cpppp-ckb.po +79 -0
  124. languages/cpppp-cs_CZ.mo +0 -0
  125. languages/cpppp-cs_CZ.po +73 -0
  126. languages/cpppp-da_DK.mo +0 -0
  127. languages/cpppp-da_DK.po +67 -0
  128. languages/cpppp-de_DE.mo +0 -0
  129. languages/cpppp-de_DE.po +71 -0
  130. languages/cpppp-el.mo +0 -0
  131. languages/cpppp-el.po +73 -0
  132. languages/cpppp-eo_EO.mo +0 -0
  133. languages/cpppp-eo_EO.po +69 -0
  134. languages/cpppp-es_ES.mo +0 -0
  135. languages/cpppp-es_ES.po +62 -0
  136. languages/cpppp-et.mo +0 -0
  137. languages/cpppp-et.po +73 -0
  138. languages/cpppp-eu.mo +0 -0
  139. languages/cpppp-eu.po +70 -0
  140. languages/cpppp-fa_IR.mo +0 -0
  141. languages/cpppp-fa_IR.po +73 -0
  142. languages/cpppp-fi.mo +0 -0
  143. languages/cpppp-fi.po +84 -0
  144. languages/cpppp-fr_FR.mo +0 -0
  145. languages/cpppp-fr_FR.po +72 -0
  146. languages/cpppp-ga_IE.mo +0 -0
  147. languages/cpppp-ga_IE.po +72 -0
  148. languages/cpppp-gl_ES.mo +0 -0
  149. languages/cpppp-gl_ES.po +74 -0
  150. languages/cpppp-gu_IN.mo +0 -0
  151. languages/cpppp-gu_IN.po +74 -0
  152. languages/cpppp-he_IL.mo +0 -0
  153. languages/cpppp-he_IL.po +73 -0
  154. languages/cpppp-hi_IN.mo +0 -0
  155. languages/cpppp-hi_IN.po +77 -0
  156. languages/cpppp-hr.mo +0 -0
  157. languages/cpppp-hr.po +73 -0
  158. languages/cpppp-hu_HU.mo +0 -0
  159. languages/cpppp-hu_HU.po +77 -0
  160. languages/cpppp-hy_AM.mo +0 -0
  161. languages/cpppp-hy_AM.po +69 -0
  162. languages/cpppp-id_ID.mo +0 -0
  163. languages/cpppp-id_ID.po +76 -0
  164. languages/cpppp-it_IT.mo +0 -0
  165. languages/cpppp-it_IT.po +72 -0
  166. languages/cpppp-ja.mo +0 -0
  167. languages/cpppp-ja.po +76 -0
  168. languages/cpppp-ka_GE.mo +0 -0
  169. languages/cpppp-ka_GE.po +73 -0
  170. languages/cpppp-ko_KR.mo +0 -0
  171. languages/cpppp-ko_KR.po +75 -0
  172. languages/cpppp-lt_LT.mo +0 -0
  173. languages/cpppp-lt_LT.po +75 -0
  174. languages/cpppp-lv.mo +0 -0
  175. languages/cpppp-lv.po +77 -0
  176. languages/cpppp-mk_MK.mo +0 -0
  177. languages/cpppp-mk_MK.po +73 -0
  178. languages/cpppp-ml_IN.mo +0 -0
  179. languages/cpppp-ml_IN.po +66 -0
  180. languages/cpppp-ms_MY.mo +0 -0
  181. languages/cpppp-ms_MY.po +70 -0
  182. languages/cpppp-mt_MT.mo +0 -0
  183. languages/cpppp-mt_MT.po +68 -0
  184. languages/cpppp-nb_NO.mo +0 -0
  185. languages/cpppp-nb_NO.po +71 -0
  186. languages/cpppp-nl_NL.mo +0 -0
  187. languages/cpppp-nl_NL.po +70 -0
  188. languages/cpppp-pa_IN.mo +0 -0
  189. languages/cpppp-pa_IN.po +75 -0
  190. languages/cpppp-pl_PL.mo +0 -0
  191. languages/cpppp-pl_PL.po +71 -0
  192. languages/cpppp-pt_BR.mo +0 -0
  193. languages/cpppp-pt_BR.po +65 -0
  194. languages/cpppp-pt_PT.mo +0 -0
  195. languages/cpppp-pt_PT.po +65 -0
  196. languages/cpppp-ro_RO.mo +0 -0
  197. languages/cpppp-ro_RO.po +79 -0
  198. languages/cpppp-ru_RU.mo +0 -0
  199. languages/cpppp-ru_RU.po +73 -0
  200. languages/cpppp-sk_SK.mo +0 -0
  201. languages/cpppp-sk_SK.po +72 -0
  202. languages/cpppp-sl_SI.mo +0 -0
  203. languages/cpppp-sl_SI.po +75 -0
  204. languages/cpppp-sq.mo +0 -0
  205. languages/cpppp-sq.po +72 -0
  206. languages/cpppp-sr_RS.mo +0 -0
  207. languages/cpppp-sr_RS.po +74 -0
  208. languages/cpppp-sv_SE.mo +0 -0
  209. languages/cpppp-sv_SE.po +78 -0
  210. languages/cpppp-ta.mo +0 -0
  211. languages/cpppp-ta.po +76 -0
  212. languages/cpppp-th.mo +0 -0
  213. languages/cpppp-th.po +76 -0
  214. languages/cpppp-tl.mo +0 -0
  215. languages/cpppp-tl.po +69 -0
  216. languages/cpppp-tr_TR.mo +0 -0
  217. languages/cpppp-tr_TR.po +74 -0
  218. languages/cpppp-uk.mo +0 -0
  219. languages/cpppp-uk.po +74 -0
  220. languages/cpppp-vi.mo +0 -0
  221. languages/cpppp-vi.po +73 -0
  222. languages/cpppp-zh_CN.mo +0 -0
  223. languages/cpppp-zh_CN.po +72 -0
  224. languages/cpppp-zh_TW.mo +0 -0
  225. languages/cpppp-zh_TW.po +72 -0
  226. templates/01/bg_top.png +0 -0
  227. templates/01/config.ini +5 -0
  228. templates/01/style.css +13 -0
  229. templates/01/thumbnail.jpg +0 -0
  230. templates/02/config.ini +5 -0
  231. templates/02/style.css +54 -0
  232. templates/02/thumbnail.png +0 -0
  233. templates/03/config.ini +5 -0
  234. templates/03/style.css +16 -0
  235. templates/03/thumbnail.jpg +0 -0
  236. templates/03/top_bg.png +0 -0
  237. templates/04/config.ini +5 -0
  238. templates/04/style.css +21 -0
  239. templates/04/thumbnail.jpg +0 -0
  240. templates/05/config.ini +5 -0
  241. templates/05/form_bg.jpg +0 -0
  242. templates/05/style.css +23 -0
  243. templates/05/thumbnail.png +0 -0
  244. templates/06/config.ini +5 -0
  245. templates/06/style.css +36 -0
  246. templates/06/thumbnail.jpg +0 -0
README.txt ADDED
@@ -0,0 +1,166 @@
1
+ === Payment Form for PayPal Pro ===
2
+ Contributors: codepeople
3
+ Donate link: http://wordpress.dwbooster.com/forms/paypal-payment-pro-form
4
+ Tags: paypal,paypal pro,paypal advanced,pro,accept,credit,cards,card,payment,processing
5
+ Requires at least: 3.0.5
6
+ Tested up to: 4.2
7
+ Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Payment Form for PayPal Pro for accepting credit cards directly into your website without navigating to a PayPal page. Official Paypal Partner.
12
+
13
+ == Description ==
14
+
15
+ This plugin is for integrating **PayPal Pro** to accept credit cards directly into your website without navigating to a PayPal hosted payment page.
16
+
17
+ The PayPal integration available in this plugin **requires a PayPal Pro account**.
18
+
19
+ If you aren't sure if you have a **PayPal Pro account** or if you are looking for a classic **PayPal Standard** integration then use the [CP Contact Form with PayPal](http://wordpress.org/extend/plugins/cp-contact-form-with-paypal/) plugin.
20
+
21
+ You can check the differences betwen **PayPal Pro** and **PayPal Standard** at https://www.paypal.com/webapps/mpp/compare-business-products
22
+
23
+ **Special note:** This plugin has been developed by an Official PayPal Partner and it includes a special offer: Your PayPal Pro account fee will be waived by PayPal when you use this extension to accept the payments.
24
+
25
+ With **Payment Form for PayPal Pro** you can insert a form into a WordPress website and use it to process credit card payments **directly into your website** without navigating to an external payment page.
26
+
27
+ This plugin uses the PayPal Pro API to process the credit cards. The credit card related data is used only to process the payment through the payment API, it isn't stored in the website for keeping it secure.
28
+
29
+ Once the user has filled the form fields and clicks the submit button the payment is processed and the posted data (excluding the credit card related information) is saved into the WordPress database. The website administrator (the email indicated from the settings) will receive an email with the form data and the user will receive a confirmation/thank you email.
30
+
31
+ = Features: =
32
+
33
+ * Supports PayPal Pro to accept payments directly into your website without navigating to PayPal
34
+ * Supports many contact forms into the same WP website, each one with its own prices and settings.
35
+ * You can customize the notification email details, including from address, subject and content.
36
+ * Includes optional captcha verification.
37
+ * Supports HTML formatted emails (*)
38
+ * Can be tested with the PayPal Sandbox
39
+ * Exports the submissions to CSV/Excel
40
+ * Developer by an [Official PayPal Partner](https://www.paypal-marketing.com/paypal/html/hosted/emarketing/partner/directory/#k=net+factor&n=2000009361343&m=p).
41
+
42
+ = Proffesional Version Features: =
43
+
44
+ The following features aren't part of the free version. The following features are present only in the pro version
45
+
46
+ * Visual form builder: The free version includes the payment form with an email field plus the required PayPal fields. If you need a different form you should opt for the commercial version.
47
+ * In the commercial version PayPal Standard is supported in addition to PayPal Pro.
48
+
49
+ If you are interested in a version with the pro features you can get it here: http://wordpress.dwbooster.com/forms/paypal-payment-pro-form
50
+
51
+ = Language Support =
52
+
53
+ The Payment Form for PayPal Pro plugin is compatible with all charsets. The troubleshoot area contains options to change the encoding of the plugin database tables if needed.
54
+
55
+ Translations are supported through PO/MO files located in the Payment Form for PayPal Pro plugin folder "languages".
56
+
57
+ The following translations are already included in the plugin:
58
+
59
+ * Afrikaans (af)
60
+ * Albanian (sq)
61
+ * Arabic (ar)
62
+ * Armenian (hy_AM)
63
+ * Azerbaijani (az)
64
+ * Basque (eu)
65
+ * Belarusian (be_BY)
66
+ * Bosnian (bs_BA)
67
+ * Bulgarian (bg_BG)
68
+ * Catalan (ca)
69
+ * Central Kurdish (ckb)
70
+ * Chinese (China zh_CN)
71
+ * Chinese (Taiwan zh_TW)
72
+ * Croatian (hr)
73
+ * Czech (cs_CZ)
74
+ * Danish (da_DK)
75
+ * Dutch (nl_NL)
76
+ * Esperanto (eo_EO)
77
+ * Estonian (et)
78
+ * Finnish (fi)
79
+ * French (fr_FR)
80
+ * Galician (gl_ES)
81
+ * Georgian (ka_GE)
82
+ * German (de_DE)
83
+ * Greek (el)
84
+ * Gujarati (gu_IN)
85
+ * Hebrew (he_IL)
86
+ * Hindi (hi_IN)
87
+ * Hungarian (hu_HU)
88
+ * Indian Bengali (bn_IN)
89
+ * Indonesian (id_ID)
90
+ * Irish (ga_IE)
91
+ * Italian (it_IT)
92
+ * Japanese (ja)
93
+ * Korean (ko_KR)
94
+ * Latvian (lv)
95
+ * Lithuanian (lt_LT)
96
+ * Macedonian (mk_MK)
97
+ * Malay (ms_MY)
98
+ * Malayalam (ml_IN)
99
+ * Maltese (mt_MT)
100
+ * Norwegian (nb_NO)
101
+ * Persian (fa_IR)
102
+ * Polish (pl_PL)
103
+ * Portuguese Brazil(pt_BR)
104
+ * Portuguese (pt_PT)
105
+ * Punjabi (pa_IN)
106
+ * Russian (ru_RU)
107
+ * Romanian (ro_RO)
108
+ * Serbian (sr_RS)
109
+ * Slovak (sk_SK)
110
+ * Slovene (sl_SI)
111
+ * Spanish (es_ES)
112
+ * Swedish (sv_SE)
113
+ * Tagalog (tl)
114
+ * Tamil (ta)
115
+ * Thai (th)
116
+ * Turkish (tr_TR)
117
+ * Ukrainian (uk)
118
+ * Vietnamese (vi)
119
+
120
+
121
+ == Installation ==
122
+
123
+ To install Payment Form for PayPal Pro, follow these steps:
124
+
125
+ 1. Download and unzip the Payment Form for PayPal Pro plugin
126
+ 2. Upload the entire paypal-payment-pro-form/ directory to the /wp-content/plugins/ directory
127
+ 3. Activate the Payment Form for PayPal Pro plugin through the Plugins menu in WordPress
128
+ 4. Configure the PayPal contact form settings at the administration menu >> Settings >> Payment Form for PayPal Pro
129
+ 5. To insert the PayPal contact form into some content or post use the icon that will appear when editing contents
130
+
131
+ == Frequently Asked Questions ==
132
+
133
+ = Q: Where can I find more info about this plugin? =
134
+
135
+ A: The product's page contains more information:
136
+
137
+ http://wordpress.dwbooster.com/forms/paypal-payment-pro-form
138
+
139
+ = Q: Where can I publish the PayPal Pro form with the PayPal button? =
140
+
141
+ A: You can publish the PayPal contact forms / PayPal button into pages, posts and as a widget in the sidebar.
142
+
143
+ = Q: I'm not receiving the emails after PayPal payment. =
144
+
145
+ A: Try first using a "from" email address that belongs to your website domain, this is the most common restriction applied in most hosting services.
146
+
147
+ If that doesn't work please check if your hosting service requires some specific configuration to send emails from PHP/WordPress websites. The plugin uses the settings specified into the WordPress website to deliver the emails, if your hosting has some specific requirements like a fixed "from" address or a custom "SMTP" server those settings must be configured into the WordPress website.
148
+
149
+
150
+ == Screenshots ==
151
+
152
+ 1. PayPal Pro Forms List
153
+ 2. PayPal Pro Form Settings
154
+ 3. Inserting a PayPal Pro form into a page
155
+ 4. Sample
156
+
157
+ == Changelog ==
158
+
159
+ = 1.0.1 =
160
+ * First stable version released.
161
+
162
+
163
+ == Upgrade Notice ==
164
+
165
+ = 1.0.1 =
166
+ * First stable version released.
captcha/captcha.php ADDED
@@ -0,0 +1,173 @@
1
+ <?php
2
+ /*
3
+ PHP Captcha by Codepeople.net
4
+ http://www.codepeople.net
5
+ */
6
+
7
+ if (!ini_get("zlib.output_compression")) ob_clean();
8
+
9
+ if (!isset($_GET["ps"])) $_GET["ps"] = '';
10
+
11
+ if ($_GET["hdwtest"] == "sessiontest")
12
+ {
13
+ session_start();
14
+ session_register("tmpvar");
15
+ if ($_GET["autocall"]!=1){
16
+ $_SESSION["tmpvar"] = "ok";
17
+ } else {
18
+ if ($_SESSION["tmpvar"]!="ok") {
19
+ die("Session Error");
20
+ } else {
21
+ die("Sessions works on your server!");
22
+ }
23
+ }
24
+ header("Location: ".$PHP_SELF."?hdwtest=sessiontest&autocall=1" );
25
+ exit;
26
+ }
27
+
28
+ if ($_GET["width"] == '' || !is_numeric($_GET["width"])) $_GET["width"] = "180";
29
+ if ($_GET["height"] == '' || !is_numeric($_GET["height"])) $_GET["height"] = "60";
30
+ if ($_GET["letter_count"] == ''|| !is_numeric($_GET["letter_count"])) $_GET["letter_count"] = "5";
31
+ if ($_GET["min_size"] == ''|| !is_numeric($_GET["min_size"])) $_GET["min_size"] = "35";
32
+ if ($_GET["max_size"] == ''|| !is_numeric($_GET["max_size"])) $_GET["max_size"] = "45";
33
+ if ($_GET["noise"] == ''|| !is_numeric($_GET["noise"])) $_GET["noise"] = "200";
34
+ if ($_GET["noiselength"] == ''|| !is_numeric($_GET["noiselength"])) $_GET["noiselength"] = "5";
35
+ if ($_GET["bcolor"] == '') $_GET["bcolor"] = "FFFFFF";
36
+ if ($_GET["border"] == '') $_GET["border"] = "000000";
37
+
38
+ //configuration
39
+ $imgX = $_GET["width"];
40
+ $imgY = $_GET["height"];
41
+
42
+ $letter_count = $_GET["letter_count"];
43
+ $min_size = $_GET["min_size"];
44
+ $max_size = $_GET["max_size"];
45
+ $noise = $_GET["noise"];
46
+ $noiselength = $_GET["noiselength"];
47
+ $bcolor = cpcff_decodeColor($_GET["bcolor"]);
48
+ $border = cpcff_decodeColor($_GET["border"]);
49
+
50
+ $noisecolor = 0xcdcdcd;
51
+ $random_noise_color= true;
52
+ $tcolor = cpcff_decodeColor("666666");
53
+ $random_text_color= true;
54
+
55
+
56
+ header("Cache-Control: no-store, no-cache, must-revalidate");
57
+ header("Pragma: no-cache");
58
+
59
+ function cpcff_decodeColor($hexcolor)
60
+ {
61
+ $color = hexdec($hexcolor);
62
+ $c["b"] = $color % 256;
63
+ $color = $color / 256;
64
+ $c["g"] = $color % 256;
65
+ $color = $color / 256;
66
+ $c["r"] = $color % 256;
67
+ return $c;
68
+ }
69
+
70
+ function cpcff_similarColors($c1, $c2)
71
+ {
72
+ return sqrt( pow($c1["r"]-$c2["r"],2) + pow($c1["g"]-$c2["g"],2) + pow($c1["b"]-$c2["b"],2)) < 125;
73
+ }
74
+
75
+
76
+ // USAGE
77
+ // if (empty($_POST['hdcaptcha']) || $_POST['hdcaptcha'] != $_SESSION['rand_code']) header("Location: /form.html");
78
+
79
+ session_start();
80
+
81
+ function cpcff_make_seed() {
82
+ list($usec, $sec) = explode(' ', microtime());
83
+ return (float) $sec + ((float) $usec * 100000);
84
+ }
85
+ mt_srand(cpcff_make_seed());
86
+ $randval = mt_rand();
87
+
88
+ $str = "";
89
+ $length = 0;
90
+ for ($i = 0; $i < $letter_count; $i++) {
91
+ $str .= chr(mt_rand(97, 122))." ";
92
+ }
93
+ $_SESSION['rand_code'.$_GET["ps"]] = str_replace(" ", "", $str);
94
+
95
+ setCookie('rand_code'.$_GET["ps"], md5(str_replace(" ", "", $str)), time()+36000,"/");
96
+
97
+ $image = imagecreatetruecolor($imgX, $imgY);
98
+ $backgr_col = imagecolorallocate($image, $bcolor["r"],$bcolor["g"],$bcolor["b"]);
99
+ $border_col = imagecolorallocate($image, $border["r"],$border["g"],$border["b"]);
100
+
101
+ if ($random_text_color)
102
+ {
103
+ do
104
+ {
105
+ $selcolor = mt_rand(0,256*256*256);
106
+ } while ( cpcff_similarColors(cpcff_decodeColor($selcolor), $bcolor) );
107
+ $tcolor = cpcff_decodeColor($selcolor);
108
+ }
109
+
110
+ $text_col = imagecolorallocate($image, $tcolor["r"],$tcolor["g"],$tcolor["b"]);
111
+
112
+ imagefilledrectangle($image, 0, 0, $imgX, $imgY, $backgr_col);
113
+ imagerectangle($image, 0, 0, $imgX-1, $imgY-1, $border_col);
114
+ for ($i=0;$i<$noise;$i++)
115
+ {
116
+ if ($random_noise_color)
117
+ $color = mt_rand(0, 256*256*256);
118
+ else
119
+ $color = $noisecolor;
120
+ $x1 = mt_rand(2,$imgX-2);
121
+ $y1 = mt_rand(2,$imgY-2);
122
+ imageline ( $image, $x1, $y1, mt_rand($x1-$noiselength,$x1+$noiselength), mt_rand($y1-$noiselength,$y1+$noiselength), $color);
123
+ }
124
+
125
+ $font = dirname( __FILE__ ) . "/font-1.ttf"; // font
126
+ if ($_GET["font"]) $font = dirname( __FILE__ ) . "/".$_GET["font"];
127
+ /**if (!file_exists($font))
128
+ $font = $_SERVER["DOCUMENT_ROOT"]."/HDWFormCaptcha/".$font;
129
+ if (!file_exists($font))
130
+ $font = dirname(__FILE__)."/".$font;
131
+ */
132
+
133
+ $font_size = rand($min_size, $max_size);
134
+
135
+ $angle = rand(-15, 15);
136
+
137
+ if (function_exists("imagettfbbox") && function_exists("imagettftext"))
138
+ {
139
+ $box = imagettfbbox($font_size, $angle, $font, $str);
140
+ $x = (int)($imgX - $box[4]) / 2;
141
+ $y = (int)($imgY - $box[5]) / 2;
142
+ imagettftext($image, $font_size, $angle, $x, $y, $text_col, $font, $str);
143
+ }
144
+ else if (function_exists("imageFtBBox") && function_exists("imageFTText"))
145
+ {
146
+ $box = imageFtBBox($font_size, $angle, $font, $str);
147
+ $x = (int)($imgX - $box[4]) / 2;
148
+ $y = (int)($imgY - $box[5]) / 2;
149
+ imageFTText ($image, $font_size, $angle, $x, $y, $text_col, $font, $str);
150
+ }
151
+ else
152
+ {
153
+ $angle = 0;
154
+ $font = 6;
155
+ $wf = ImageFontWidth(6) * strlen($str);
156
+ $hf = ImageFontHeight(6);
157
+ $x = (int)($imgX - $wf) / 2;
158
+ $y = (int)($imgY - $hf) / 2;
159
+ imagestring ( $image, $font, $x, $y, $str, $text_col);
160
+ }
161
+
162
+ function ppp_output_handler($img) {
163
+ header('Content-type: image/png');
164
+ header('Content-Length: ' . strlen($img));
165
+ return $img;
166
+ }
167
+
168
+ ob_start("ppp_output_handler");
169
+ imagepng($image);
170
+ ob_end_flush();
171
+ imagedestroy ($image);
172
+ exit;
173
+ ?>
captcha/font-1.ttf ADDED
Binary file
captcha/font-2.ttf ADDED
Binary file
captcha/font-3.ttf ADDED
Binary file
captcha/font-4.ttf ADDED
Binary file
cp_ppp.php ADDED
@@ -0,0 +1,1452 @@
1
+ <?php
2
+ /*
3
+ Plugin Name: Payment Form for PayPal Pro
4
+ Plugin URI: http://wordpress.dwbooster.com/forms/paypal-payment-pro-form
5
+ Description: Payment Form for PayPal Pro to accept credit cards directly into your website. Official PayPal Partner.
6
+ Version: 1.0.1
7
+ Author: CodePeople.net
8
+ Author URI: http://codepeople.net
9
+ License: GPL
10
+ */
11
+
12
+
13
+ /* initialization / install / uninstall functions */
14
+
15
+
16
+ // Payment Form for PayPal Pro constants
17
+
18
+ define('CP_PPP_DEFAULT_CURRENCY_SYMBOL','#x27;);
19
+ define('CP_PPP_GBP_CURRENCY_SYMBOL',chr(163));
20
+ define('CP_PPP_EUR_CURRENCY_SYMBOL_A',chr(226)); //'EUR '
21
+ define('CP_PPP_EUR_CURRENCY_SYMBOL_B',chr(128));
22
+
23
+ define('CP_PPP_DEFAULT_DEFER_SCRIPTS_LOADING', (get_option('CP_CFPP_LOAD_SCRIPTS',"1") == "1"?true:false));
24
+ define('CP_PPP_DEFAULT_DEFER_SCRIPTS_LOADING_ADMIN', (get_option('CP_CFPP_LOAD_SCRIPTS_ADMIN',"1") == "1"?true:false));
25
+
26
+ define('CP_PPP_DEFAULT_form_structure', '[[{"form_identifier":"","name":"email","shortlabel":"","index":0,"ftype":"femail","userhelp":"","userhelpTooltip":false,"csslayout":"","title":"Email","predefined":"","predefinedClick":false,"required":true,"size":"medium","equalTo":"","fBuild":{}}],[{"title":"","description":"","formlayout":"top_aligned","formtemplate":"","evalequations":1,"autocomplete":1}]]');
27
+
28
+ define('CP_PPP_DEFAULT_fp_subject', 'Payment received...');
29
+ define('CP_PPP_DEFAULT_fp_inc_additional_info', 'true');
30
+ define('CP_PPP_DEFAULT_fp_return_page', get_site_url());
31
+ define('CP_PPP_DEFAULT_fp_message', "The following payment has been received:\n\n<"."%INFO%".">\n\n");
32
+
33
+ define('CP_PPP_DEFAULT_cu_enable_copy_to_user', 'true');
34
+ define('CP_PPP_DEFAULT_cu_user_email_field', '');
35
+ define('CP_PPP_DEFAULT_cu_subject', 'Confirmation: Message received...');
36
+ define('CP_PPP_DEFAULT_cu_message', "Thank you for your message. We will reply you as soon as possible.\n\nThis is a copy of the data sent:\n\n<"."%INFO%".">\n\nBest Regards.");
37
+ define('CP_PPP_DEFAULT_email_format','text');
38
+
39
+ define('CP_PPP_DEFAULT_vs_use_validation', 'true');
40
+
41
+ define('CP_PPP_DEFAULT_vs_text_is_required', 'This field is required.');
42
+ define('CP_PPP_DEFAULT_vs_text_is_email', 'Please enter a valid email address.');
43
+
44
+ define('CP_PPP_DEFAULT_vs_text_datemmddyyyy', 'Please enter a valid date with this format(mm/dd/yyyy)');
45
+ define('CP_PPP_DEFAULT_vs_text_dateddmmyyyy', 'Please enter a valid date with this format(dd/mm/yyyy)');
46
+ define('CP_PPP_DEFAULT_vs_text_number', 'Please enter a valid number.');
47
+ define('CP_PPP_DEFAULT_vs_text_digits', 'Please enter only digits.');
48
+ define('CP_PPP_DEFAULT_vs_text_max', 'Please enter a value less than or equal to {0}.');
49
+ define('CP_PPP_DEFAULT_vs_text_min', 'Please enter a value greater than or equal to {0}.');
50
+
51
+
52
+ define('CP_PPP_DEFAULT_cv_enable_captcha', 'true');
53
+ define('CP_PPP_DEFAULT_cv_width', '180');
54
+ define('CP_PPP_DEFAULT_cv_height', '60');
55
+ define('CP_PPP_DEFAULT_cv_chars', '5');
56
+ define('CP_PPP_DEFAULT_cv_font', 'font-1.ttf');
57
+ define('CP_PPP_DEFAULT_cv_min_font_size', '25');
58
+ define('CP_PPP_DEFAULT_cv_max_font_size', '35');
59
+ define('CP_PPP_DEFAULT_cv_noise', '200');
60
+ define('CP_PPP_DEFAULT_cv_noise_length', '4');
61
+ define('CP_PPP_DEFAULT_cv_background', 'ffffff');
62
+ define('CP_PPP_DEFAULT_cv_border', '000000');
63
+ define('CP_PPP_DEFAULT_cv_text_enter_valid_captcha', 'Please enter a valid captcha code.');
64
+
65
+ define('CP_PPP_PAYPAL_OPTION_YES', 'Pay with PayPal.');
66
+ define('CP_PPP_PAYPAL_OPTION_NO', 'Pay later.');
67
+
68
+ define('CP_PPP_DEFAULT_ENABLE_PAYPAL', 3);
69
+ define('CP_PPP_DEFAULT_PAYPAL_MODE', 'production');
70
+ define('CP_PPP_DEFAULT_PAYPAL_RECURRENT', '0');
71
+ define('CP_PPP_DEFAULT_PAYPAL_IDENTIFY_PRICES', '0');
72
+ define('CP_PPP_DEFAULT_PAYPAL_ZERO_PAYMENT', '0');
73
+ define('CP_PPP_DEFAULT_PAYPAL_EMAIL','put_your@email_here.com');
74
+ define('CP_PPP_DEFAULT_PRODUCT_NAME','Reservation');
75
+ define('CP_PPP_DEFAULT_COST','25');
76
+ define('CP_PPP_DEFAULT_CURRENCY','USD');
77
+ define('CP_PPP_DEFAULT_PAYPAL_LANGUAGE','EN');
78
+
79
+ // database
80
+ define('CP_PPP_FORMS_TABLE', 'cp_ppp_settings');
81
+
82
+ define('CP_PPP_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX', "cp_ppp_discount_codes");
83
+ define('CP_PPP_DISCOUNT_CODES_TABLE_NAME', @$wpdb->prefix ."cp_ppp_discount_codes");
84
+
85
+ define('CP_PPP_POSTS_TABLE_NAME_NO_PREFIX', "cp_ppp_posts");
86
+ define('CP_PPP_POSTS_TABLE_NAME', @$wpdb->prefix ."cp_ppp_posts");
87
+
88
+ require_once 'cp_ppp_data_source.inc.php';
89
+
90
+ // end Payment Form for PayPal Pro constants
91
+
92
+ // code initialization, hooks
93
+ // -----------------------------------------
94
+
95
+ register_activation_hook(__FILE__,'cp_ppp_install');
96
+
97
+ add_action( 'init', 'cp_ppp_check_posted_data', 11 );
98
+ add_action( 'widgets_init', create_function('', 'return register_widget("CP_PPP_Widget");') );
99
+
100
+ function cpppp_plugin_init() {
101
+ load_plugin_textdomain( 'cpppp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
102
+ }
103
+ add_action('plugins_loaded', 'cpppp_plugin_init');
104
+
105
+
106
+ if ( is_admin() ) {
107
+ add_action('media_buttons', 'set_cp_ppp_insert_button', 100);
108
+ add_action('admin_enqueue_scripts', 'set_cp_ppp_insert_adminScripts', 1);
109
+ add_action('admin_menu', 'cp_ppp_admin_menu');
110
+
111
+ $plugin = plugin_basename(__FILE__);
112
+ add_filter("plugin_action_links_".$plugin, 'cp_ppp_customAdjustmentsLink');
113
+ add_filter("plugin_action_links_".$plugin, 'cp_ppp_settingsLink');
114
+ add_filter("plugin_action_links_".$plugin, 'cp_ppp_helpLink');
115
+
116
+ function cp_ppp_admin_menu() {
117
+ add_options_page('Payment Form for PayPal Pro Options', 'Payment Form for PayPal Pro', 'manage_options', 'cp_ppp', 'cp_ppp_html_post_page' );
118
+ add_menu_page( 'Payment Form for PayPal Pro', 'Payment Form for PayPal Pro', 'read', 'cp_ppp', 'cp_ppp_html_post_page' );
119
+
120
+ add_submenu_page( 'cp_ppp', 'Manage Forms', 'Manage Forms', 'manage_options', "cp_ppp", 'cp_ppp_html_post_page' );
121
+ add_submenu_page( 'cp_ppp', 'Upgrade', 'Upgrade', 'edit_pages', "cp_ppp_upgrade", 'cp_ppp_html_post_page' );
122
+ }
123
+ } else { // if not admin
124
+ add_shortcode( 'CP_PPP', 'cp_ppp_filter_content' );
125
+ add_shortcode( 'CP_PPP_LIST', 'cp_ppp_filter_list' );
126
+ }
127
+
128
+
129
+ // functions
130
+ //------------------------------------------
131
+
132
+ function cp_ppp_install($networkwide) {
133
+ global $wpdb;
134
+
135
+ if (function_exists('is_multisite') && is_multisite()) {
136
+ // check if it is a network activation - if so, run the activation function for each blog id
137
+ if ($networkwide) {
138
+ $old_blog = $wpdb->blogid;
139
+ // Get all blog ids
140
+ $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs"));
141
+ foreach ($blogids as $blog_id) {
142
+ switch_to_blog($blog_id);
143
+ _cp_ppp_install();
144
+ }
145
+ switch_to_blog($old_blog);
146
+ return;
147
+ }
148
+ }
149
+ _cp_ppp_install();
150
+ }
151
+
152
+ function _cp_ppp_install() {
153
+ global $wpdb;
154
+
155
+ define('CP_PPP_DEFAULT_fp_from_email', get_the_author_meta('user_email', get_current_user_id()) );
156
+ define('CP_PPP_DEFAULT_fp_destination_emails', CP_PPP_DEFAULT_fp_from_email);
157
+
158
+ $table_name = $wpdb->prefix.CP_PPP_FORMS_TABLE;
159
+
160
+ $sql = "CREATE TABLE ".$wpdb->prefix.CP_PPP_POSTS_TABLE_NAME_NO_PREFIX." (
161
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
162
+ formid INT NOT NULL,
163
+ time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
164
+ ipaddr VARCHAR(32) DEFAULT '' NOT NULL,
165
+ notifyto VARCHAR(250) DEFAULT '' NOT NULL,
166
+ data mediumtext,
167
+ paypal_post mediumtext,
168
+ posted_data mediumtext,
169
+ paid INT DEFAULT 0 NOT NULL,
170
+ UNIQUE KEY id (id)
171
+ );";
172
+ $wpdb->query( $wpdb->prepare ($sql, array()) );
173
+
174
+ $sql = "CREATE TABLE ".$wpdb->prefix.CP_PPP_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." (
175
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
176
+ form_id mediumint(9) NOT NULL DEFAULT 1,
177
+ code VARCHAR(250) DEFAULT '' NOT NULL,
178
+ discount VARCHAR(250) DEFAULT '' NOT NULL,
179
+ dc_times VARCHAR(10) DEFAULT '0' NOT NULL,
180
+ expires datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
181
+ availability int(10) unsigned NOT NULL DEFAULT 0,
182
+ used int(10) unsigned NOT NULL DEFAULT 0,
183
+ UNIQUE KEY id (id)
184
+ );";
185
+ $wpdb->query( $wpdb->prepare ($sql, array()) );
186
+
187
+
188
+ $sql = "CREATE TABLE $table_name (
189
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
190
+
191
+ form_name VARCHAR(250) DEFAULT '' NOT NULL,
192
+
193
+ form_structure mediumtext,
194
+
195
+ fp_from_email VARCHAR(250) DEFAULT '' NOT NULL,
196
+ fp_destination_emails text,
197
+ fp_subject VARCHAR(250) DEFAULT '' NOT NULL,
198
+ fp_inc_additional_info VARCHAR(10) DEFAULT '' NOT NULL,
199
+ fp_return_page VARCHAR(250) DEFAULT '' NOT NULL,
200
+ fp_message text,
201
+ fp_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
202
+
203
+ cu_enable_copy_to_user VARCHAR(10) DEFAULT '' NOT NULL,
204
+ cu_user_email_field VARCHAR(250) DEFAULT '' NOT NULL,
205
+ cu_subject VARCHAR(250) DEFAULT '' NOT NULL,
206
+ cu_message text,
207
+ cu_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
208
+
209
+ enable_paypal_option_yes VARCHAR(250) DEFAULT '' NOT NULL,
210
+ enable_paypal_option_no VARCHAR(250) DEFAULT '' NOT NULL,
211
+ paypal_recurrent_setup VARCHAR(20) DEFAULT '' NOT NULL,
212
+ vs_use_validation VARCHAR(10) DEFAULT '' NOT NULL,
213
+ vs_text_is_required VARCHAR(250) DEFAULT '' NOT NULL,
214
+ vs_text_is_email VARCHAR(250) DEFAULT '' NOT NULL,
215
+ vs_text_datemmddyyyy VARCHAR(250) DEFAULT '' NOT NULL,
216
+ vs_text_dateddmmyyyy VARCHAR(250) DEFAULT '' NOT NULL,
217
+ vs_text_number VARCHAR(250) DEFAULT '' NOT NULL,
218
+ vs_text_digits VARCHAR(250) DEFAULT '' NOT NULL,
219
+ vs_text_max VARCHAR(250) DEFAULT '' NOT NULL,
220
+ vs_text_min VARCHAR(250) DEFAULT '' NOT NULL,
221
+ vs_text_submitbtn VARCHAR(250) DEFAULT '' NOT NULL,
222
+ vs_text_previousbtn VARCHAR(250) DEFAULT '' NOT NULL,
223
+ vs_text_nextbtn VARCHAR(250) DEFAULT '' NOT NULL,
224
+
225
+ enable_paypal varchar(10) DEFAULT '' NOT NULL,
226
+ paypal_notiemails varchar(10) DEFAULT '' NOT NULL,
227
+ paypal_email varchar(255) DEFAULT '' NOT NULL ,
228
+ request_cost varchar(255) DEFAULT '' NOT NULL ,
229
+ paypal_price_field varchar(255) DEFAULT '' NOT NULL ,
230
+ request_taxes varchar(20) DEFAULT '' NOT NULL ,
231
+ request_address varchar(20) DEFAULT '' NOT NULL ,
232
+ paypal_product_name varchar(255) DEFAULT '' NOT NULL,
233
+ currency varchar(10) DEFAULT '' NOT NULL,
234
+ paypal_language varchar(10) DEFAULT '' NOT NULL,
235
+ paypal_mode varchar(20) DEFAULT '' NOT NULL ,
236
+ paypal_recurrent varchar(20) DEFAULT '' NOT NULL ,
237
+ paypal_identify_prices varchar(20) DEFAULT '' NOT NULL ,
238
+ paypal_zero_payment varchar(10) DEFAULT '' NOT NULL ,
239
+
240
+ paypalpro_api_username varchar(255) DEFAULT '' NOT NULL ,
241
+ paypalpro_api_password varchar(255) DEFAULT '' NOT NULL ,
242
+ paypalpro_api_signature varchar(255) DEFAULT '' NOT NULL ,
243
+
244
+ cp_user_access text,
245
+
246
+ script_load_method varchar(10) DEFAULT '' NOT NULL ,
247
+
248
+ cv_enable_captcha VARCHAR(20) DEFAULT '' NOT NULL,
249
+ cv_width VARCHAR(20) DEFAULT '' NOT NULL,
250
+ cv_height VARCHAR(20) DEFAULT '' NOT NULL,
251
+ cv_chars VARCHAR(20) DEFAULT '' NOT NULL,
252
+ cv_font VARCHAR(20) DEFAULT '' NOT NULL,
253
+ cv_min_font_size VARCHAR(20) DEFAULT '' NOT NULL,
254
+ cv_max_font_size VARCHAR(20) DEFAULT '' NOT NULL,
255
+ cv_noise VARCHAR(20) DEFAULT '' NOT NULL,
256
+ cv_noise_length VARCHAR(20) DEFAULT '' NOT NULL,
257
+ cv_background VARCHAR(20) DEFAULT '' NOT NULL,
258
+ cv_border VARCHAR(20) DEFAULT '' NOT NULL,
259
+ cv_text_enter_valid_captcha VARCHAR(200) DEFAULT '' NOT NULL,
260
+
261
+ UNIQUE KEY id (id)
262
+ );";
263
+ $wpdb->query( $wpdb->prepare ($sql, array()) );
264
+
265
+ $count = $wpdb->get_var( "SELECT COUNT(id) FROM ".$table_name );
266
+ if (!$count)
267
+ {
268
+ $wpdb->insert( $table_name, array( 'id' => 1,
269
+ 'form_name' => 'Form 1',
270
+
271
+ 'form_structure' => cp_ppp_get_option('form_structure', CP_PPP_DEFAULT_form_structure),
272
+
273
+ 'fp_from_email' => cp_ppp_get_option('fp_from_email', CP_PPP_DEFAULT_fp_from_email),
274
+ 'fp_destination_emails' => cp_ppp_get_option('fp_destination_emails', CP_PPP_DEFAULT_fp_destination_emails),
275
+ 'fp_subject' => cp_ppp_get_option('fp_subject', CP_PPP_DEFAULT_fp_subject),
276
+ 'fp_inc_additional_info' => cp_ppp_get_option('fp_inc_additional_info', CP_PPP_DEFAULT_fp_inc_additional_info),
277
+ 'fp_return_page' => cp_ppp_get_option('fp_return_page', CP_PPP_DEFAULT_fp_return_page),
278
+ 'fp_message' => cp_ppp_get_option('fp_message', CP_PPP_DEFAULT_fp_message),
279
+ 'fp_emailformat' => cp_ppp_get_option('fp_emailformat', CP_PPP_DEFAULT_email_format),
280
+
281
+ 'cu_enable_copy_to_user' => cp_ppp_get_option('cu_enable_copy_to_user', CP_PPP_DEFAULT_cu_enable_copy_to_user),
282
+ 'cu_user_email_field' => cp_ppp_get_option('cu_user_email_field', CP_PPP_DEFAULT_cu_user_email_field),
283
+ 'cu_subject' => cp_ppp_get_option('cu_subject', CP_PPP_DEFAULT_cu_subject),
284
+ 'cu_message' => cp_ppp_get_option('cu_message', CP_PPP_DEFAULT_cu_message),
285
+ 'cu_emailformat' => cp_ppp_get_option('cu_emailformat', CP_PPP_DEFAULT_email_format),
286
+
287
+ 'vs_use_validation' => cp_ppp_get_option('vs_use_validation', CP_PPP_DEFAULT_vs_use_validation),
288
+ 'vs_text_is_required' => cp_ppp_get_option('vs_text_is_required', CP_PPP_DEFAULT_vs_text_is_required),
289
+ 'vs_text_is_email' => cp_ppp_get_option('vs_text_is_email', CP_PPP_DEFAULT_vs_text_is_email),
290
+ 'vs_text_datemmddyyyy' => cp_ppp_get_option('vs_text_datemmddyyyy', CP_PPP_DEFAULT_vs_text_datemmddyyyy),
291
+ 'vs_text_dateddmmyyyy' => cp_ppp_get_option('vs_text_dateddmmyyyy', CP_PPP_DEFAULT_vs_text_dateddmmyyyy),
292
+ 'vs_text_number' => cp_ppp_get_option('vs_text_number', CP_PPP_DEFAULT_vs_text_number),
293
+ 'vs_text_digits' => cp_ppp_get_option('vs_text_digits', CP_PPP_DEFAULT_vs_text_digits),
294
+ 'vs_text_max' => cp_ppp_get_option('vs_text_max', CP_PPP_DEFAULT_vs_text_max),
295
+ 'vs_text_min' => cp_ppp_get_option('vs_text_min', CP_PPP_DEFAULT_vs_text_min),
296
+ 'vs_text_submitbtn' => cp_ppp_get_option('vs_text_submitbtn', 'Submit'),
297
+ 'vs_text_previousbtn' => cp_ppp_get_option('vs_text_previousbtn', 'Previous'),
298
+ 'vs_text_nextbtn' => cp_ppp_get_option('vs_text_nextbtn', 'Next'),
299
+
300
+ 'script_load_method' => cp_ppp_get_option('script_load_method', '0'),
301
+
302
+ 'enable_paypal' => cp_ppp_get_option('enable_paypal', CP_PPP_DEFAULT_ENABLE_PAYPAL),
303
+ 'paypal_notiemails' => cp_ppp_get_option('paypal_notiemails', '0'),
304
+ 'paypal_email' => cp_ppp_get_option('paypal_email', CP_PPP_DEFAULT_PAYPAL_EMAIL),
305
+ 'request_cost' => cp_ppp_get_option('request_cost', CP_PPP_DEFAULT_COST),
306
+ 'paypal_price_field' => cp_ppp_get_option('paypal_price_field', ''),
307
+ 'request_taxes' => cp_ppp_get_option('request_taxes', '0'),
308
+ 'request_address' => cp_ppp_get_option('request_address', '0'),
309
+ 'paypal_product_name' => cp_ppp_get_option('paypal_product_name', CP_PPP_DEFAULT_PRODUCT_NAME),
310
+ 'currency' => cp_ppp_get_option('currency', CP_PPP_DEFAULT_CURRENCY),
311
+ 'paypal_language' => cp_ppp_get_option('paypal_language', CP_PPP_DEFAULT_PAYPAL_LANGUAGE),
312
+ 'paypal_mode' => cp_ppp_get_option('paypal_mode', CP_PPP_DEFAULT_PAYPAL_MODE),
313
+ 'paypal_recurrent' => cp_ppp_get_option('paypal_recurrent', CP_PPP_DEFAULT_PAYPAL_RECURRENT),
314
+ 'paypal_identify_prices' => cp_ppp_get_option('paypal_identify_prices', CP_PPP_DEFAULT_PAYPAL_IDENTIFY_PRICES),
315
+ 'paypal_zero_payment' => cp_ppp_get_option('paypal_zero_payment', CP_PPP_DEFAULT_PAYPAL_ZERO_PAYMENT),
316
+
317
+ 'cv_enable_captcha' => cp_ppp_get_option('cv_enable_captcha', CP_PPP_DEFAULT_cv_enable_captcha),
318
+ 'cv_width' => cp_ppp_get_option('cv_width', CP_PPP_DEFAULT_cv_width),
319
+ 'cv_height' => cp_ppp_get_option('cv_height', CP_PPP_DEFAULT_cv_height),
320
+ 'cv_chars' => cp_ppp_get_option('cv_chars', CP_PPP_DEFAULT_cv_chars),
321
+ 'cv_font' => cp_ppp_get_option('cv_font', CP_PPP_DEFAULT_cv_font),
322
+ 'cv_min_font_size' => cp_ppp_get_option('cv_min_font_size', CP_PPP_DEFAULT_cv_min_font_size),
323
+ 'cv_max_font_size' => cp_ppp_get_option('cv_max_font_size', CP_PPP_DEFAULT_cv_max_font_size),
324
+ 'cv_noise' => cp_ppp_get_option('cv_noise', CP_PPP_DEFAULT_cv_noise),
325
+ 'cv_noise_length' => cp_ppp_get_option('cv_noise_length', CP_PPP_DEFAULT_cv_noise_length),
326
+ 'cv_background' => cp_ppp_get_option('cv_background', CP_PPP_DEFAULT_cv_background),
327
+ 'cv_border' => cp_ppp_get_option('cv_border', CP_PPP_DEFAULT_cv_border),
328
+ 'cv_text_enter_valid_captcha' => cp_ppp_get_option('cv_text_enter_valid_captcha', CP_PPP_DEFAULT_cv_text_enter_valid_captcha)
329
+ )
330
+ );
331
+ }
332
+
333
+ }
334
+
335
+ function cp_ppp_filter_list($atts) {
336
+ global $wpdb;
337
+ extract( shortcode_atts( array(
338
+ 'id' => '',
339
+ 'from' => 'today -30 days',
340
+ 'to' => 'today +30 days',
341
+ 'fields' => 'time,email,fieldname1,fieldname2',
342
+ ), $atts ) );
343
+ ob_start();
344
+
345
+ $from = date("Y-m-d 00:00:00", strtotime($from));
346
+ $to = date("Y-m-d 23:59:59", strtotime($to));
347
+ $cond = "(`time` >= '".esc_sql($from)."')";
348
+ $cond .= " AND (`time` <= '".esc_sql($to)."')";
349
+
350
+ if ($id != '')
351
+ $myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE." WHERE id=%d",$id) );
352
+ else
353
+ $myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE,array()) );
354
+
355
+
356
+ if ($id == '') $id = $myrows[0]->id;
357
+ $cond = "(`formid` = %d)";
358
+
359
+ $events = $wpdb->get_results( $wpdb->prepare(
360
+ "SELECT * FROM ".CP_PPP_POSTS_TABLE_NAME." WHERE ".$cond." ORDER BY `time` DESC",
361
+ $id
362
+ )
363
+ );
364
+
365
+ $fields = explode(",",$fields);
366
+
367
+ for ($k=0; $k<count($fields); $k++)
368
+ $fields[$k] = trim($fields[$k]);
369
+
370
+ wp_enqueue_style ('cp_ppp_buikder_script_f_list_styles', plugins_url('css/stylepublic.css', __FILE__));
371
+ foreach ($events as $event)
372
+ {
373
+ $posted_data = unserialize($event->posted_data);
374
+
375
+ for ($k=0;$k<count($fields); $k++)
376
+ if ($fields[$k] == 'time')
377
+ echo '<div class="cfpp_field_'.$k.'">'.date("Y-m-d H:i:s", strtotime($event->time) ).'</div>';
378
+ else
379
+ echo '<div class="cfpp_field_'.$k.'">'.(isset($posted_data[$fields[$k]])?$posted_data[$fields[$k]]:"&nbsp;").'</div>';
380
+ echo '<div class="cfpp_field_clear"></div>';
381
+ }
382
+
383
+ $buffered_contents = ob_get_contents();
384
+ ob_end_clean();
385
+ return $buffered_contents;
386
+ }
387
+
388
+ function cp_ppp_available_templates(){
389
+ global $CP_CFPP_global_templates;
390
+
391
+ if( empty( $CP_CFPP_global_templates ) )
392
+ {
393
+ // Get available designs
394
+ $tpls_dir = dir( plugin_dir_path( __FILE__ ).'templates' );
395
+ $CP_CFPP_global_templates = array();
396
+ while( false !== ( $entry = $tpls_dir->read() ) )
397
+ {
398
+ if ( $entry != '.' && $entry != '..' && is_dir( $tpls_dir->path.'/'.$entry ) && file_exists( $tpls_dir->path.'/'.$entry.'/config.ini' ) )
399
+ {
400
+ if( ( $ini_array = parse_ini_file( $tpls_dir->path.'/'.$entry.'/config.ini' ) ) !== false )
401
+ {
402
+ if( !empty( $ini_array[ 'file' ] ) ) $ini_array[ 'file' ] = plugins_url( 'templates/'.$entry.'/'.$ini_array[ 'file' ], __FILE__ );
403
+ if( !empty( $ini_array[ 'thumbnail' ] ) ) $ini_array[ 'thumbnail' ] = plugins_url( 'templates/'.$entry.'/'.$ini_array[ 'thumbnail' ], __FILE__ );
404
+ $CP_CFPP_global_templates[ $ini_array[ 'prefix' ] ] = $ini_array;
405
+ }
406
+ }
407
+ }
408
+ }
409
+
410
+ return $CP_CFPP_global_templates;
411
+ }
412
+
413
+ function cp_ppp_filter_content($atts) {
414
+ global $wpdb;
415
+ extract( shortcode_atts( array(
416
+ 'id' => '',
417
+ ), $atts ) );
418
+ //if ($id != '')
419
+ // define ('CP_PPP_ID',$id);
420
+ ob_start();
421
+ cp_ppp_get_public_form($id);
422
+ $buffered_contents = ob_get_contents();
423
+ ob_end_clean();
424
+ return $buffered_contents;
425
+ }
426
+
427
+ $CP_CFPP_global_form_count_number = 0;
428
+ $CP_CPP_global_form_count = "_".$CP_CFPP_global_form_count_number;
429
+
430
+ function cp_ppp_get_public_form($id) {
431
+ global $wpdb;
432
+ global $CP_CPP_global_form_count;
433
+ global $CP_CFPP_global_form_count_number;
434
+ $CP_CFPP_global_form_count_number++;
435
+ $CP_CPP_global_form_count = "_".$CP_CFPP_global_form_count_number;
436
+ if (!defined('CP_AUTH_INCLUDE')) define('CP_AUTH_INCLUDE', true);
437
+
438
+ if ($id != '')
439
+ $myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE." WHERE id=%d", $id) );
440
+ else
441
+ $myrows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_PPP_FORMS_TABLE, array()) );
442
+
443
+ $previous_label = cp_ppp_get_option('vs_text_previousbtn', 'Previous',$id);
444
+ $previous_label = ($previous_label==''?'Previous':$previous_label);
445
+ $next_label = cp_ppp_get_option('vs_text_nextbtn', 'Next',$id);
446
+ $next_label = ($next_label==''?'Next':$next_label);
447
+ if ($id == '') $id = $myrows[0]->id;
448
+ if (CP_PPP_DEFAULT_DEFER_SCRIPTS_LOADING)
449
+ {
450
+ wp_deregister_script('query-stringify');
451
+ wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
452
+
453
+ wp_deregister_script('cp_ppp_validate_script');
454
+ wp_register_script('cp_ppp_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
455
+
456
+ wp_enqueue_script( 'cp_ppp_buikder_script',
457
+ get_site_url( get_current_blog_id() ).'?cp_ppp_resources=public',array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify","cp_ppp_validate_script"), false, true );
458
+
459
+
460
+ wp_localize_script('cp_ppp_buikder_script', 'cp_ppp_fbuilder_config'.$CP_CPP_global_form_count, array('obj' =>
461
+ '{"pub":true,"identifier":"'.$CP_CPP_global_form_count.'","messages": {
462
+ "required": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_is_required', CP_PPP_DEFAULT_vs_text_is_required,$id)).'",
463
+ "email": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_is_email', CP_PPP_DEFAULT_vs_text_is_email,$id)).'",
464
+ "datemmddyyyy": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_datemmddyyyy', CP_PPP_DEFAULT_vs_text_datemmddyyyy,$id)).'",
465
+ "dateddmmyyyy": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_dateddmmyyyy', CP_PPP_DEFAULT_vs_text_dateddmmyyyy,$id)).'",
466
+ "number": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_number', CP_PPP_DEFAULT_vs_text_number,$id)).'",
467
+ "digits": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_digits', CP_PPP_DEFAULT_vs_text_digits,$id)).'",
468
+ "max": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_max', CP_PPP_DEFAULT_vs_text_max,$id)).'",
469
+ "min": "'.str_replace(array('"'),array('\\"'),cp_ppp_get_option('vs_text_min', CP_PPP_DEFAULT_vs_text_min,$id)).'",
470
+ "previous": "'.str_replace(array('"'),array('\\"'),$previous_label).'",
471
+ "next": "'.str_replace(array('"'),array('\\"'),$next_label).'"
472
+ }}'
473
+ ));
474
+ }
475
+ else
476
+ {
477
+ wp_enqueue_script( "jquery" );
478
+ wp_enqueue_script( "jquery-ui-core" );
479
+ wp_enqueue_script( "jquery-ui-datepicker" );
480
+ }
481
+
482
+ wp_enqueue_style ('cp_ppp_buikder_script_f_p_styles', plugins_url('css/stylepublic.css', __FILE__));
483
+ wp_enqueue_style('cp_ppp_buikder_script_jq_styles', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
484
+
485
+ $codes = array();
486
+
487
+ $button_label = cp_ppp_get_option('vs_text_submitbtn', 'Submit',$id);
488
+ $button_label = ($button_label==''?'Submit':$button_label);
489
+ @include dirname( __FILE__ ) . '/cp_ppp_public_int.inc.php';
490
+ if (!CP_PPP_DEFAULT_DEFER_SCRIPTS_LOADING) {
491
+ $prefix_ui = '';
492
+ if (file_exists(dirname( __FILE__ ).'/../../../wp-includes/js/jquery/ui/jquery.ui.core.min.js'))
493
+ $prefix_ui = 'jquery.ui.';
494
+ ?>
495
+ <?php $plugin_url = plugins_url('', __FILE__); ?>
496
+ <script> if( typeof jQuery != 'undefined' ) var jQueryBK = jQuery.noConflict(); </script>
497
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/jquery.js'; ?>'></script>
498
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'core.min.js'; ?>'></script>
499
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'datepicker.min.js'; ?>'></script>
500
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'widget.min.js'; ?>'></script>
501
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'position.min.js'; ?>'></script>
502
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'tooltip.min.js'; ?>'></script>
503
+ <script>
504
+ var fbuilderjQuery = jQuery.noConflict( );
505
+ if( typeof jQueryBK != 'undefined' ) jQuery = jQueryBK;
506
+ </script>
507
+ <script type='text/javascript' src='<?php echo plugins_url('js/jQuery.stringify.js', __FILE__); ?>'></script>
508
+ <script type='text/javascript' src='<?php echo plugins_url('js/jquery.validate.js', __FILE__); ?>'></script>
509
+ <script type='text/javascript'>
510
+ /* <![CDATA[ */
511
+ var cp_ppp_fbuilder_config<?php echo $CP_CPP_global_form_count; ?> = {"obj":"{\"pub\":true,\"identifier\":\"<?php echo $CP_CPP_global_form_count; ?>\",\"messages\": {\n \t \t\"required\": \"This field is required.\",\n \t \t\"email\": \"Please enter a valid email address.\",\n \t \t\"datemmddyyyy\": \"Please enter a valid date with this format(mm\/dd\/yyyy)\",\n \t \t\"dateddmmyyyy\": \"Please enter a valid date with this format(dd\/mm\/yyyy)\",\n \t \t\"number\": \"Please enter a valid number.\",\n \t \t\"digits\": \"Please enter only digits.\",\n \t \t\"max\": \"Please enter a value less than or equal to {0}.\",\n \t \t\"min\": \"Please enter a value greater than or equal to {0}.\",\"previous\": \"<?php echo str_replace(array('"'),array('\\"'),$previous_label); ?>\",\"next\": \"<?php echo str_replace(array('"'),array('\\"'),$next_label); ?>\"\n \t }}"};
512
+ /* ]]> */
513
+ </script>
514
+ <script type='text/javascript' src='<?php echo get_site_url( get_current_blog_id() ).'?cp_ppp_resources=public'; ?>'></script>
515
+ <?php
516
+ }
517
+ }
518
+
519
+
520
+ function cp_ppp_settingsLink($links) {
521
+ $settings_link = '<a href="options-general.php?page=cp_ppp">'.__('Settings').'</a>';
522
+ array_unshift($links, $settings_link);
523
+ return $links;
524
+ }
525
+
526
+
527
+ function cp_ppp_helpLink($links) {
528
+ $help_link = '<a href="http://wordpress.dwbooster.com/forms/cp-contact-form-with-paypal">'.__('Help').'</a>';
529
+ array_unshift($links, $help_link);
530
+ return $links;
531
+ }
532
+
533
+
534
+ function cp_ppp_customAdjustmentsLink($links) {
535
+ $customAdjustments_link = '<a href="http://wordpress.dwbooster.com/contact-us">'.__('Request custom changes').'</a>';
536
+ array_unshift($links, $customAdjustments_link);
537
+ return $links;
538
+ }
539
+
540
+
541
+ function set_cp_ppp_insert_button() {
542
+ print '<a href="javascript:cp_ppp_insertForm();" title="'.__('Insert Payment Form for PayPal Pro').'"><img hspace="5" src="'.plugins_url('/images/cp_form.gif', __FILE__).'" alt="'.__('Insert Payment Form for PayPal Pro').'" /></a>';
543
+ }
544
+
545
+
546
+ function cp_ppp_html_post_page() {
547
+ if (isset($_GET["cal"]) && $_GET["cal"] != '')
548
+ {
549
+ if (isset($_GET["list"]) && $_GET["list"] == '1')
550
+ @include_once dirname( __FILE__ ) . '/cp_ppp_admin_int_message_list.inc.php';
551
+ else if (current_user_can('manage_options'))
552
+ @include_once dirname( __FILE__ ) . '/cp_ppp_admin_int.php';
553
+ else
554
+ echo 'Current user permissions aren\'t enough for accesing this page.';
555
+ }
556
+ else
557
+ {
558
+ if (isset($_GET["page"]) &&$_GET["page"] == 'cp_ppp_upgrade')
559
+ {
560
+ echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/forms/paypal-payment-pro-form#download';</script>");
561
+ exit;
562
+ }
563
+ else if (isset($_GET["page"]) &&$_GET["page"] == 'cp_ppp_demo')
564
+ {
565
+ echo("Redirecting to demo page...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/forms/cp-contact-form-with-paypal#demo';</script>");
566
+ exit;
567
+ }
568
+ else
569
+ @include_once dirname( __FILE__ ) . '/cp_ppp_admin_int_list.inc.php';
570
+ }
571
+ }
572
+
573
+
574
+ function set_cp_ppp_insert_adminScripts($hook) {
575
+ if (isset($_GET["page"]) && $_GET["page"] == "cp_ppp")
576
+ {
577
+ wp_deregister_script('query-stringify');
578
+ wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
579
+ wp_enqueue_script( 'cp_ppp_buikder_script', get_site_url( get_current_blog_id() ).'?cp_ppp_resources=admin',array("jquery","jquery-ui-core","jquery-ui-sortable","jquery-ui-tabs","jquery-ui-droppable","jquery-ui-button","jquery-ui-datepicker","query-stringify") );
580
+
581
+ wp_enqueue_style('cp_ppp_buikder_script_f_styles', plugins_url('css/style.css', __FILE__));
582
+ wp_enqueue_style('cp_ppp_buikder_script_jq_styles', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
583
+ }
584
+
585
+ if( 'post.php' != $hook && 'post-new.php' != $hook )
586
+ return;
587
+ wp_enqueue_script( 'cp_ppp_script', plugins_url('/cp_ppp_scripts.js', __FILE__) );
588
+ }
589
+
590
+
591
+ function cp_ppp_get_site_url($admin = false)
592
+ {
593
+ $blog = get_current_blog_id();
594
+ if( $admin )
595
+ $url = get_admin_url( $blog );
596
+ else
597
+ $url = get_home_url( $blog );
598
+
599
+ $url = parse_url($url);
600
+ $url = rtrim(@$url["path"],"/");
601
+ return $url;
602
+ }
603
+
604
+ function cp_ppp_get_FULL_site_url($admin = false)
605
+ {
606
+ $url = cp_ppp_get_site_url($admin);
607
+ $pos = strpos($url, "://");
608
+ if ($pos === false)
609
+ $url = 'http://'.$_SERVER["HTTP_HOST"].$url;
610
+ // if (!empty($_SERVER['HTTPS']))
611
+ // $url = str_replace("http://","https://",$url);
612
+ return $url;
613
+ }
614
+
615
+ function cp_ppp_cleanJSON($str)
616
+ {
617
+ $str = str_replace('&qquot;','"',$str);
618
+ $str = str_replace(' ',' ',$str);
619
+ $str = str_replace("\n",'\n',$str);
620
+ $str = str_replace("\r",'',$str);
621
+ return $str;
622
+ }
623
+
624
+
625
+ function cp_ppp_load_discount_codes() {
626
+ global $wpdb;
627
+
628
+ if ( ! current_user_can('edit_pages') ) // prevent loading coupons from outside admin area
629
+ {
630
+ echo 'No enough privilegies to load this content.';
631
+ exit;
632
+ }
633
+
634
+ if (!defined('CP_PPP_ID'))
635
+ define ('CP_PPP_ID',intval($_GET["dex_item"]));
636
+
637
+ cp_ppp_add_field_verify($wpdb->prefix.CP_PPP_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX ,"dc_times", "varchar(10) DEFAULT '0' NOT NULL");
638
+
639
+ if (isset($_GET["add"]) && $_GET["add"] == "1")
640
+ $wpdb->insert( CP_PPP_DISCOUNT_CODES_TABLE_NAME, array('form_id' => CP_PPP_ID,
641
+ 'code' => esc_sql($_GET["code"]),
642
+ 'discount' => $_GET["discount"],
643
+ 'availability' => $_GET["discounttype"],
644
+ 'dc_times' => $_GET["tm"],
645
+ 'expires' => esc_sql($_GET["expires"]),
646
+ ));
647
+
648
+ if (isset($_GET["delete"]) && $_GET["delete"] == "1")
649
+ $wpdb->query( $wpdb->prepare( "DELETE FROM ".CP_PPP_DISCOUNT_CODES_TABLE_NAME." WHERE id = %d", $_GET["code"] ));
650
+
651
+ $codes = $wpdb->get_results( $wpdb->prepare('SELECT * FROM '.CP_PPP_DISCOUNT_CODES_TABLE_NAME.' WHERE `form_id`=%d', CP_PPP_ID) );
652
+ if (count ($codes))
653
+ {
654
+ echo '<table>';
655
+ echo '<tr>';
656
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;">Cupon Code</th>';
657
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;">Discount</th>';
658
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;">Type</th>';
659
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;" nowrap>Can be used?</th>';
660
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;" nowrap>Used so far</th>';
661
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;">Valid until</th>';
662
+ echo ' <th style="padding:2px;background-color: #cccccc;font-weight:bold;">Options</th>';
663
+ echo '</tr>';
664
+ foreach ($codes as $value)
665
+ {
666
+ echo '<tr>';
667
+ echo '<td>'.$value->code.'</td>';
668
+ echo '<td>'.$value->discount.'</td>';
669
+ echo '<td>'.($value->availability==1?"Fixed Value":"Percent").'</td>';
670
+ echo '<td nowrap>'.($value->dc_times=='0'?'Unlimited':$value->dc_times.' times').'</td>';
671
+ echo '<td nowrap>'.$value->used.' times</td>';
672
+ echo '<td>'.substr($value->expires,0,10).'</td>';
673
+ echo '<td>[<a href="javascript:dex_delete_coupon('.$value->id.')">Delete</a>]</td>';
674
+ echo '</tr>';
675
+ }
676
+ echo '</table>';
677
+ }
678
+ else
679
+ echo 'No discount codes listed for this form yet.';
680
+ exit;
681
+ }
682
+
683
+
684
+ function cp_ppp_check_posted_data() {
685
+
686
+ global $wpdb;
687
+
688
+
689
+ if( isset( $_REQUEST[ 'cp_ppp_resources' ] ) )
690
+ {
691
+ if( $_REQUEST[ 'cp_ppp_resources' ] == 'admin' )
692
+ {
693
+ require_once dirname( __FILE__ ).'/js/fbuilder-loader-admin.php';
694
+ }
695
+ else
696
+ {
697
+ require_once dirname( __FILE__ ).'/js/fbuilder-loader-public.php';
698
+ }
699
+ exit;
700
+ }
701
+
702
+ if (isset( $_GET['cp_ppp_encodingfix'] ) && $_GET['cp_ppp_encodingfix'] == '1')
703
+ {
704
+ $wpdb->query( $wpdb->prepare('alter table '.CP_PPP_DISCOUNT_CODES_TABLE_NAME.' convert to character set utf8 collate utf8_unicode_ci;', array()) );
705
+ $wpdb->query( $wpdb->prepare('alter table '.CP_PPP_FORMS_TABLE.' convert to character set utf8 collate utf8_unicode_ci;', array()) );
706
+ $wpdb->query( $wpdb->prepare('alter table '.CP_PPP_POSTS_TABLE_NAME.' convert to character set utf8 collate utf8_unicode_ci;', array()) );
707
+ echo 'Ok, encoding fixed.';
708
+ exit;
709
+ }
710
+
711
+ if(isset($_GET) && array_key_exists('cp_ppp_post',$_GET)) {
712
+ if ($_GET["cp_ppp_post"] == 'loadcoupons')
713
+ cp_ppp_load_discount_codes();
714
+ }
715
+
716
+ if (isset( $_GET['cp_ppp'] ) && $_GET['cp_ppp'] == 'captcha' )
717
+ {
718
+ @include_once dirname( __FILE__ ) . '/captcha/captcha.php';
719
+ exit;
720
+ }
721
+
722
+ if (isset( $_GET['cp_ppp_csv'] ) && is_admin() )
723
+ {
724
+ cp_ppp_export_csv();
725
+ return;
726
+ }
727
+
728
+ if (isset( $_GET['script_load_method'] ) )
729
+ {
730
+ cp_ppp_update_script_method();
731
+ return;
732
+ }
733
+
734
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_ppp_post_options'] ) && is_admin() )
735
+ {
736
+ cp_ppp_save_options();
737
+ return;
738
+ }
739
+
740
+ if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST['cp_ppp_pform_process'] ) )
741
+ if ( 'GET' != $_SERVER['REQUEST_METHOD'] || !isset( $_GET['hdcaptcha_cp_ppp_post'] ) )
742
+ return;
743
+
744
+ if (isset($_GET["cp_ppp_id"])) $_POST["cp_ppp_id"] = intval($_GET["cp_ppp_id"]);
745
+ if (isset($_POST["cp_ppp_id"])) define("CP_PPP_ID",intval($_POST["cp_ppp_id"]));
746
+
747
+ @session_start();
748
+ if (isset($_GET["ps"])) $sequence = $_GET["ps"]; else if (isset($_POST["cp_pform_psequence"])) $sequence = $_POST["cp_pform_psequence"];
749
+ if (!isset($_GET['hdcaptcha_cp_ppp_post']) || $_GET['hdcaptcha_cp_ppp_post'] == '') $_GET['hdcaptcha_cp_ppp_post'] = @$_POST['hdcaptcha_cp_ppp_post'];
750
+ if (
751
+ (cp_ppp_get_option('cv_enable_captcha', CP_PPP_DEFAULT_cv_enable_captcha) != 'false') &&
752
+ ( (strtolower($_GET['hdcaptcha_cp_ppp_post']) != strtolower(@$_SESSION['rand_code'.$sequence])) ||
753
+ ($_SESSION['rand_code'.$sequence] == '')
754
+ )
755
+ &&
756
+ ( (md5(strtolower($_GET['hdcaptcha_cp_ppp_post'])) != $_COOKIE['rand_code'.$sequence]) ||
757
+ ($_COOKIE['rand_code'.$sequence] == '')
758
+ )
759
+ )
760
+ {
761
+ echo 'captchafailed';
762
+ exit;
763
+ }
764
+
765
+ // if this isn't the real post (it was the captcha verification) then echo ok and exit
766
+ if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST['cp_ppp_pform_process'] ) )
767
+ {
768
+ echo 'ok';
769
+ exit;
770
+ }
771
+
772
+
773
+ // get base price
774
+ $price = cp_ppp_get_option('request_cost', CP_PPP_DEFAULT_COST);
775
+ $price = trim(str_replace(',','', str_replace(CP_PPP_DEFAULT_CURRENCY_SYMBOL,'',
776
+ str_replace(CP_PPP_GBP_CURRENCY_SYMBOL,'',
777
+ str_replace(CP_PPP_EUR_CURRENCY_SYMBOL_A, '',
778
+ str_replace(CP_PPP_EUR_CURRENCY_SYMBOL_B,'', $price )))) ));
779
+ $added_cost = @$_POST[cp_ppp_get_option('paypal_price_field', '').$sequence];
780
+ $added_cost = str_replace('#x27;,'',$added_cost);
781
+ $added_cost = str_replace('USD','',$added_cost);
782
+ $added_cost = str_replace('EUR','',$added_cost);
783
+ $added_cost = str_replace('GBP','',$added_cost);
784
+ $added_cost = trim($added_cost);
785
+ if (!is_numeric($added_cost))
786
+ $added_cost = 0;
787
+ $price += $added_cost;
788
+ $taxes = trim(str_replace("%","",cp_ppp_get_option('request_taxes', '0')));
789
+
790
+ // get form info
791
+ //---------------------------
792
+ $identify_prices = cp_ppp_get_option('paypal_identify_prices',CP_PPP_DEFAULT_PAYPAL_IDENTIFY_PRICES);
793
+ $paypal_zero_payment = cp_ppp_get_option('paypal_zero_payment',CP_PPP_DEFAULT_PAYPAL_ZERO_PAYMENT);
794
+ require_once(ABSPATH . "wp-admin" . '/includes/file.php');
795
+ $form_data = json_decode(cp_ppp_cleanJSON(cp_ppp_get_option('form_structure', CP_PPP_DEFAULT_form_structure)));
796
+ $fields = array();
797
+ foreach ($form_data[0] as $item)
798
+ {
799
+ $fields[$item->name] = $item->title;
800
+ if ($item->predefined == $_POST[$item->name.$sequence] && $item->predefinedClick == '1')
801
+ $_POST[$item->name.$sequence] = '';
802
+ if ($item->ftype == 'fPhone') // join fields for phone fields
803
+ {
804
+ if (isset($_POST[$item->name.$sequence."_0"]))
805
+ {
806
+ $_POST[$item->name.$sequence] = '';
807
+ for($i=0; $i<=substr_count($item->dformat," "); $i++)
808
+ {
809
+ $_POST[$item->name.$sequence] .= ($_POST[$item->name.$sequence."_".$i]!=''?($i==0?'':'-').$_POST[$item->name.$sequence."_".$i]:'');
810
+ unset($_POST[$item->name.$sequence."_".$i]);
811
+ }
812
+ }
813
+ }
814
+ else if (isset($_POST[$item->name.$sequence]) && $identify_prices && ($item->ftype == 'fcheck' || $item->ftype == 'fradio' || $item->ftype == 'fdropdown'))
815
+ {
816
+ $values = ( is_array($_POST[$item->name.$sequence]) ? $_POST[$item->name.$sequence] : array($_POST[$item->name.$sequence]) );
817
+
818
+ foreach ($values as $value)
819
+ {
820
+ $matches_eur_a = array();
821
+ preg_match_all ('/([0-9,]+(\.[0-9]{2})?)/', $value, $matches_eur_a);
822
+ $matches = $matches_eur_a[0];
823
+
824
+ foreach ($matches as $item)
825
+ {
826
+ $item = trim(str_replace(',','', str_replace(CP_PPP_DEFAULT_CURRENCY_SYMBOL,'',
827
+ str_replace(CP_PPP_GBP_CURRENCY_SYMBOL,'',
828
+ str_replace(CP_PPP_EUR_CURRENCY_SYMBOL_A, '',
829
+ str_replace(CP_PPP_EUR_CURRENCY_SYMBOL_B,'', $item )))) ));
830
+ if (is_numeric($item)) {
831
+ $nindex = strpos($value, " ".$item);
832
+ $nindex2 = substr($value,0,strlen($item));
833
+ if ($nindex === false && $nindex2 != $item) // exclude items with a black space before it
834
+ $price += $item;
835
+ }
836
+ }
837
+ }
838
+ }
839
+ }
840
+
841
+ // calculate discounts if any
842
+ //---------------------------
843
+ $discount_note = "";
844
+ $coupon = false;
845
+ $codes = $wpdb->get_results( $wpdb->prepare(
846
+ "SELECT * FROM ".CP_PPP_DISCOUNT_CODES_TABLE_NAME." WHERE ((dc_times>used) OR dc_times='0') AND code=%s AND expires>=%s AND `form_id`=%d",
847
+ @$_POST["couponcode"], date("Y-m-d")." 00:00:00", CP_PPP_ID
848
+ )
849
+ );
850
+ if (count($codes))
851
+ {
852
+ $coupon = $codes[0];
853
+ if ($coupon->availability==1)
854
+ {
855
+ $price = number_format (floatval ($price) - $coupon->discount,2);
856
+ $discount_note = " (".cp_ppp_get_option('currency', CP_PPP_DEFAULT_CURRENCY)." ".$coupon->discount." discount applied)";
857
+ }
858
+ else
859
+ {
860
+ $price = number_format (floatval ($price) - $price*$coupon->discount/100,2);
861
+ $discount_note = " (".$coupon->discount."% discount applied)";
862
+ }
863
+ }
864
+
865
+ if ( cp_ppp_get_option('enable_paypal',CP_PPP_DEFAULT_ENABLE_PAYPAL) == "3" && ($_POST['cp_ppp_paymentspro'.$sequence] == "1") )
866
+ {
867
+ cp_ppp_payments_pro($price);
868
+ exit;
869
+ }
870
+
871
+ // grab posted data
872
+ //---------------------------
873
+ $buffer = "";
874
+ foreach ($_POST as $item => $value)
875
+ if (isset($fields[str_replace($sequence,'',$item)]))
876
+ {
877
+ $buffer .= $fields[str_replace($sequence,'',$item)] . ": ". (is_array($value)?(implode(", ",$value)):($value)) . "\n\n";
878
+ $params[str_replace($sequence,'',$item)] = $value;
879
+ }
880
+
881
+ $buffer_A = $buffer;
882
+
883
+ $paypal_product_name = cp_ppp_get_option('paypal_product_name', CP_PPP_DEFAULT_PRODUCT_NAME).$discount_note;
884
+ $params["PayPal Product Name"] = $paypal_product_name;
885
+ $params["Cost"] = $price;
886
+ $params["Costtax"] = $price + round($price * ($taxes/100),2);
887
+ $params["coupon"] = ($coupon?$coupon->code:"");
888
+
889
+ $current_user = wp_get_current_user();
890
+ $params["user_login"] = $current_user->user_login;
891
+ $params["user_id"] = $current_user->ID;
892
+ $params["user_email"] = $current_user->user_email;
893
+ $params["user_firstname"] = $current_user->user_firstname;
894
+ $params["user_lastname"] = $current_user->user_lastname;
895
+ $params["display_name"] = $current_user->display_name;
896
+
897
+ if (isset($_POST["bccf_payment_option_paypal"]) && $_POST["bccf_payment_option_paypal"] == '0')
898
+ $params["payment_type"] = 'Other';
899
+ else
900
+ $params["payment_type"] = 'PayPal';
901
+
902
+ cp_ppp_add_field_verify(CP_PPP_POSTS_TABLE_NAME,'posted_data');
903
+
904
+ // insert into database
905
+ //---------------------------
906
+ $to = cp_ppp_get_option('cu_user_email_field', CP_PPP_DEFAULT_cu_user_email_field).$sequence;
907
+ $rows_affected = $wpdb->insert( CP_PPP_POSTS_TABLE_NAME, array( 'formid' => CP_PPP_ID,
908
+ 'time' => current_time('mysql'),
909
+ 'ipaddr' => $_SERVER['REMOTE_ADDR'],
910
+ 'notifyto' => @$_POST[$to],
911
+ 'paypal_post' => serialize($params),
912
+ 'posted_data' => serialize($params),
913
+ 'data' =>$buffer_A .($coupon?"\n\nCoupon code:".$coupon->code.$discount_note:"")
914
+ ) );
915
+ if (!$rows_affected)
916
+ {
917
+ echo 'Error saving data! Please try again.';
918
+ echo '<br /><br />Error debug information: '.mysql_error();
919
+ exit;
920
+ }
921
+
922
+ $myrows = $wpdb->get_results( "SELECT MAX(id) as max_id FROM ".CP_PPP_POSTS_TABLE_NAME );
923
+
924
+
925
+ // save data here
926
+ $item_number = $myrows[0]->max_id;
927
+
928
+ $paypal_optional = (cp_ppp_get_option('enable_paypal',CP_PPP_DEFAULT_ENABLE_PAYPAL) == '2');
929
+ $paypal_recurrent = cp_ppp_get_option('paypal_recurrent_setup','0');
930
+
931
+ //if (cp_ppp_get_option('enable_paypal',CP_PPP_DEFAULT_ENABLE_PAYPAL) == "3")
932
+ $wpdb->query( $wpdb->prepare(
933
+ "UPDATE ".CP_PPP_POSTS_TABLE_NAME." SET paid=1,paypal_post='' WHERE id=%d",
934
+ $item_number
935
+ )
936
+ );
937
+
938
+ cp_ppp_process_ready_to_go_reservation($item_number, "", $params);
939
+ header("Location: ".cp_ppp_get_option('fp_return_page', CP_PPP_DEFAULT_fp_return_page));
940
+ exit;
941
+
942
+ }
943
+
944
+ function cp_ppp_add_field_verify ($table, $field, $type = "text")
945
+ {
946
+ global $wpdb;
947
+ $results = $wpdb->get_results( $wpdb->prepare(
948
+ "SHOW columns FROM `".$table."` where field=%s",
949
+ $field
950
+ )
951
+ );
952
+ if (!count($results))
953
+ {
954
+ $sql = "ALTER TABLE `".$table."` ADD `".$field."` ".$type;
955
+ $wpdb->query($sql);
956
+ }
957
+ }
958
+
959
+ function cp_ppp_check_upload($uploadfiles) {
960
+ $filetmp = $uploadfiles['tmp_name'];
961
+ //clean filename and extract extension
962
+ $filename = $uploadfiles['name'];
963
+ // get file info
964
+ $filetype = wp_check_filetype( basename( $filename ), null );
965
+
966
+ if ( in_array ($filetype["ext"],array("php","asp","aspx","cgi","pl","perl","exe")) )
967
+ return false;
968
+ else
969
+ return true;
970
+ }
971
+
972
+ function cp_ppp_payments_pro_POST($methodName_, $nvpStr_) {
973
+ global $wpdb;
974
+
975
+
976
+ // Set up your API credentials, PayPal end point, and API version.
977
+ $API_UserName = urlencode(cp_ppp_get_option('paypalpro_api_username',''));
978
+ $API_Password = urlencode(cp_ppp_get_option('paypalpro_api_password',''));
979
+ $API_Signature = urlencode(cp_ppp_get_option('paypalpro_api_signature',''));
980
+ if (cp_ppp_get_option('paypal_mode',CP_PPP_DEFAULT_PAYPAL_MODE) == "sandbox")
981
+ $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
982
+ else
983
+ $API_Endpoint = "https://api-3t.paypal.com/nvp";
984
+ $version = urlencode('51.0');
985
+
986
+ // Set the curl parameters.
987
+ $ch = curl_init();
988
+ curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
989
+ curl_setopt($ch, CURLOPT_VERBOSE, 1);
990
+
991
+ // Turn off the server and peer verification (TrustManager Concept).
992
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
993
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
994
+
995
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
996
+ curl_setopt($ch, CURLOPT_POST, 1);
997
+
998
+ // Set the API operation, version, and API signature in the request.
999
+ $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
1000
+
1001
+ // Set the request as a POST FIELD for curl.
1002
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
1003
+
1004
+ // Get response from the server.
1005
+ $httpResponse = curl_exec($ch);
1006
+
1007
+ if(!$httpResponse) {
1008
+ exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
1009
+ }
1010
+
1011
+ // Extract the response details.
1012
+ $httpResponseAr = explode("&", $httpResponse);
1013
+
1014
+ $httpParsedResponseAr = array();
1015
+ foreach ($httpResponseAr as $i => $value) {
1016
+ $tmpAr = explode("=", $value);
1017
+ if(sizeof($tmpAr) > 1) {
1018
+ $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
1019
+ }
1020
+ }
1021
+
1022
+ if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
1023
+ exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
1024
+ }
1025
+
1026
+ return $httpParsedResponseAr;
1027
+ }
1028
+
1029
+ function cp_ppp_payments_pro($price) {
1030
+ global $wpdb;
1031
+
1032
+ // Set request-specific fields.
1033
+ $paymentType = urlencode('Sale'); // or 'Authorization'
1034
+
1035
+ $firstName = urlencode($_POST['cfpp_customer_first_name']);
1036
+ $lastName = urlencode($_POST['cfpp_customer_last_name']);
1037
+ $creditCardType = urlencode($_POST['cfpp_customer_credit_card_type']);
1038
+ $creditCardNumber = urlencode($_POST['cfpp_customer_credit_card_number']);
1039
+ $expDateMonth = $_POST['cfpp_cc_expiration_month'];
1040
+ // Month must be padded with leading zero
1041
+ $padDateMonth = urlencode(str_pad($expDateMonth, 2, '0', STR_PAD_LEFT));
1042
+
1043
+ $expDateYear = urlencode($_POST['cfpp_cc_expiration_year']);
1044
+ $cvv2Number = urlencode($_POST['cfpp_cc_cvv2_number']);
1045
+ $address1 = urlencode($_POST['cfpp_customer_address1']);
1046
+ $address2 = urlencode($_POST['cfpp_customer_address2']);
1047
+ $city = urlencode($_POST['cfpp_customer_city']);
1048
+ $state = urlencode($_POST['cfpp_customer_state']);
1049
+ $zip = urlencode($_POST['cfpp_customer_zip']);
1050
+ $country = urlencode($_POST['cfpp_customer_country']); // US or other valid country code
1051
+
1052
+ $amount = urlencode($price);
1053
+ $currencyID = urlencode(strtoupper(cp_ppp_get_option('currency', CP_PPP_DEFAULT_CURRENCY)));
1054
+
1055
+ // Add request-specific fields to the request string.
1056
+ $nvpStr = "&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber".
1057
+ "&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName".
1058
+ "&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID&BUTTONSOURCE=NetFactorSL_SI_Custom";
1059
+
1060
+ // Execute the API operation; see the PPHttpPost function above.
1061
+ $httpParsedResponseAr = cp_ppp_payments_pro_POST('DoDirectPayment', $nvpStr);
1062
+ foreach ($httpParsedResponseAr as $item => $value)
1063
+ $httpParsedResponseAr[$item] = urldecode($value);
1064
+ if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
1065
+ exit('OK');
1066
+ } else {
1067
+ exit("Payment failed: ".$httpParsedResponseAr["L_LONGMESSAGE0"]."\n\nError Code: " . $httpParsedResponseAr["L_ERRORCODE0"]." (". $httpParsedResponseAr["L_SHORTMESSAGE0"].")");
1068
+ }
1069
+
1070
+ }
1071
+
1072
+
1073
+ function cp_ppp_process_ready_to_go_reservation($itemnumber, $payer_email = "", $params = array())
1074
+ {
1075
+
1076
+ global $wpdb;
1077
+
1078
+ if (!defined('CP_PPP_DEFAULT_fp_from_email')) define('CP_PPP_DEFAULT_fp_from_email', get_the_author_meta('user_email', get_current_user_id()) );
1079
+ if (!defined('CP_PPP_DEFAULT_fp_destination_emails')) define('CP_PPP_DEFAULT_fp_destination_emails', CP_PPP_DEFAULT_fp_from_email);
1080
+
1081
+ $myrows = $wpdb->get_results( $wpdb->prepare(
1082
+ "SELECT * FROM ".CP_PPP_POSTS_TABLE_NAME." WHERE id=%d",
1083
+ $itemnumber
1084
+ )
1085
+ );
1086
+
1087
+ $mycalendarrows = $wpdb->get_results( $wpdb->prepare(
1088
+ 'SELECT * FROM '. $wpdb->prefix.CP_PPP_FORMS_TABLE .' WHERE `id`=%d',
1089
+ $myrows[0]->formid
1090
+ )
1091
+ );
1092
+
1093
+ if (!defined('CP_PPP_ID'))
1094
+ define ('CP_PPP_ID',$myrows[0]->formid);
1095
+
1096
+ $buffer_A = $myrows[0]->data;
1097
+ $buffer = $buffer_A;
1098
+
1099
+ if ($params["coupon"] != '')
1100
+ $wpdb->query( $wpdb->prepare(
1101
+ "UPDATE ".CP_PPP_DISCOUNT_CODES_TABLE_NAME." SET used=used+1 WHERE code=%s AND expires>=%s AND `form_id`=%d",
1102
+ @$params["coupon"], date("Y-m-d")." 00:00:00", $myrows[0]->formid
1103
+ )
1104
+ );
1105
+
1106
+ if ('true' == cp_ppp_get_option('fp_inc_additional_info', CP_PPP_DEFAULT_fp_inc_additional_info))
1107
+ {
1108
+ $buffer .="ADDITIONAL INFORMATION\n"
1109
+ ."*********************************\n"
1110
+ ."IP: ".$myrows[0]->ipaddr."\n"
1111
+ ."Server Time: ".date("Y-m-d H:i:s")."\n";
1112
+ }
1113
+
1114
+ // 1- Send email
1115
+ //---------------------------
1116
+
1117
+ /**
1118
+ $username = "user".$itemnumber;
1119
+ $password = wp_generate_password( $length=12, $include_standard_special_chars=false );
1120
+ $email = trim($myrows[0]->notifyto);
1121
+ wp_create_user( $username, $password, $email );
1122
+ */
1123
+ $attachments = array();
1124
+ if ('html' == cp_ppp_get_option('fp_emailformat', CP_PPP_DEFAULT_email_format))
1125
+ $message = str_replace('<'.'%INFO%'.'>',str_replace("\n","<br />",str_replace('<','&lt;',$buffer)),cp_ppp_get_option('fp_message', CP_PPP_DEFAULT_fp_message));
1126
+ else
1127
+ $message = str_replace('<'.'%INFO%'.'>',$buffer,cp_ppp_get_option('fp_message', CP_PPP_DEFAULT_fp_message));
1128
+ foreach ($params as $item => $value)
1129
+ {
1130
+ $message = str_replace('<'.'%'.$item.'%'.'>',(is_array($value)?(implode(", ",$value)):($value)),$message);
1131
+ if (strpos($item,"_link"))
1132
+ {
1133
+ foreach ($value as $filevalue)
1134
+ $attachments[] = $filevalue;
1135
+ }
1136
+ }
1137
+ for ($i=0;$i<500;$i++)
1138
+ $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
1139
+ $message = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$message);
1140
+
1141
+ $message = str_replace('<'.'%username%'.'>',$username,$message);
1142
+ $message = str_replace('<'.'%password%'.'>',$password,$message);
1143
+
1144
+ $subject = cp_ppp_get_option('fp_subject', CP_PPP_DEFAULT_fp_subject);
1145
+ $from = cp_ppp_get_option('fp_from_email', CP_PPP_DEFAULT_fp_from_email);
1146
+ $to = explode(",",cp_ppp_get_option('fp_destination_emails', CP_PPP_DEFAULT_fp_destination_emails));
1147
+ if ('html' == cp_ppp_get_option('fp_emailformat', CP_PPP_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
1148
+ $replyto = $myrows[0]->notifyto;
1149
+
1150
+ foreach ($to as $item)
1151
+ if (trim($item) != '')
1152
+ {
1153
+ wp_mail(trim($item), $subject, $message,
1154
+ "From: \"$from\" <".$from.">\r\n".
1155
+ ($replyto!=''?"Reply-To: \"$replyto\" <".$replyto.">\r\n":'').
1156
+ $content_type.
1157
+ "X-Mailer: PHP/" . phpversion(), $attachments);
1158
+ }
1159
+
1160
+ // 2- Send copy to user
1161
+ //---------------------------
1162
+
1163
+
1164
+
1165
+ $to = cp_ppp_get_option('cu_user_email_field', CP_PPP_DEFAULT_cu_user_email_field);
1166
+ $_POST[$to] = $myrows[0]->notifyto;
1167
+ if ((trim($_POST[$to]) != '' || $payer_email != '') && 'true' == cp_ppp_get_option('cu_enable_copy_to_user', CP_PPP_DEFAULT_cu_enable_copy_to_user))
1168
+ {
1169
+
1170
+ if ('html' == cp_ppp_get_option('cu_emailformat', CP_PPP_DEFAULT_email_format))
1171
+ $message = str_replace('<'.'%INFO%'.'>',str_replace("\n","<br />",str_replace('<','&lt;',$buffer_A)).'</pre>',cp_ppp_get_option('cu_message', CP_PPP_DEFAULT_cu_message));
1172
+ else
1173
+ $message = str_replace('<'.'%INFO%'.'>',$buffer_A,cp_ppp_get_option('cu_message', CP_PPP_DEFAULT_cu_message));
1174
+ foreach ($params as $item => $value)
1175
+ $message = str_replace('<'.'%'.$item.'%'.'>',(is_array($value)?(implode(", ",$value)):($value)),$message);
1176
+ for ($i=0;$i<500;$i++)
1177
+ $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
1178
+
1179
+ $message = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$message);
1180
+
1181
+ $message = str_replace('<'.'%username%'.'>',$username,$message);
1182
+ $message = str_replace('<'.'%password%'.'>',$password,$message);
1183
+
1184
+
1185
+ $subject = cp_ppp_get_option('cu_subject', CP_PPP_DEFAULT_cu_subject);
1186
+ if ('html' == cp_ppp_get_option('cu_emailformat', CP_PPP_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
1187
+ if ($_POST[$to] != '')
1188
+ wp_mail(trim($_POST[$to]), $subject, $message,
1189
+ "From: \"$from\" <".$from.">\r\n".
1190
+ $content_type.
1191
+ "X-Mailer: PHP/" . phpversion());
1192
+ if ($_POST[$to] != $payer_email && $payer_email != '')
1193
+ wp_mail(trim($payer_email), $subject, $message,
1194
+ "From: \"$from\" <".$from.">\r\n".
1195
+ $content_type.
1196
+ "X-Mailer: PHP/" . phpversion());
1197
+ }
1198
+
1199
+ }
1200
+
1201
+ function cp_ppp_get_field_name ($fieldid, $form)
1202
+ {
1203
+ if (is_array($form))
1204
+ foreach($form as $item)
1205
+ if ($item->name == $fieldid)
1206
+ return $item->title;
1207
+ return $fieldid;
1208
+ }
1209
+
1210
+ function cp_ppp_export_csv ()
1211
+ {
1212
+ if (!is_admin())
1213
+ return;
1214
+ global $wpdb;
1215
+
1216
+ if (!defined('CP_PPP_ID'))
1217
+ define ('CP_PPP_ID',intval($_GET["cal"]));
1218
+
1219
+ $form_data = json_decode(cp_ppp_cleanJSON(cp_ppp_get_option('form_structure', CP_PPP_DEFAULT_form_structure)));
1220
+
1221
+ $cond = '';
1222
+ if ($_GET["search"] != '') $cond .= " AND (data like '%".esc_sql($_GET["search"])."%' OR paypal_post LIKE '%".esc_sql($_GET["search"])."%')";
1223
+ if ($_GET["dfrom"] != '') $cond .= " AND (`time` >= '".esc_sql($_GET["dfrom"])."')";
1224
+ if ($_GET["dto"] != '') $cond .= " AND (`time` <= '".esc_sql($_GET["dto"])." 23:59:59')";
1225
+ if (CP_PPP_ID != 0) $cond .= " AND formid=".CP_PPP_ID;
1226
+
1227
+ $events = $wpdb->get_results( "SELECT * FROM ".CP_PPP_POSTS_TABLE_NAME." WHERE 1=1 ".$cond." ORDER BY `time` DESC" );
1228
+
1229
+ $fields = array("Form ID", "ItemNumber","Time", "IP Address", "email", "Paid");
1230
+ $values = array();
1231
+ foreach ($events as $item)
1232
+ {
1233
+ $value = array($item->formid, $item->id, $item->time, $item->ipaddr, $item->notifyto, ($item->paid?"Yes":"No"));
1234
+ $data = array();
1235
+ if ($item->posted_data)
1236
+ $data = unserialize($item->posted_data);
1237
+ else if (!$item->paid)
1238
+ $data = unserialize($item->paypal_post);
1239
+
1240