dolibarr 21.0.0-alpha
subscriptionok.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2021 Waël Almoman <info@almoman.com>
6 * Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
31if (!defined('NOLOGIN')) {
32 define("NOLOGIN", 1); // This means this output page does not require to be logged.
33}
34if (!defined('NOCSRFCHECK')) {
35 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
36}
37if (!defined('NOIPCHECK')) {
38 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
39}
40if (!defined('NOBROWSERNOTIF')) {
41 define('NOBROWSERNOTIF', '1');
42}
43
44// For MultiCompany module.
45// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
46// Because 2 entities can have the same ref.
47$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
48if (is_numeric($entity)) {
49 define("DOLENTITY", $entity);
50}
51
52// Load Dolibarr environment
53require '../../main.inc.php';
54require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
55require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
56
57if (isModEnabled('paypal')) {
58 require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
59 require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
60}
61
62global $dolibarr_main_url_root, $mysoc;
63
64$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
65
66$object = new stdClass(); // For triggers
67
68$error = 0;
69
70// Security check
71$id = GETPOSTINT("id");
72$securekeyreceived = GETPOST("securekey");
73$securekeytocompare = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, '2');
74
75if ($securekeyreceived != $securekeytocompare) {
76 print $langs->trans('MissingOrBadSecureKey');
77 exit;
78}
79
80// Module check
81if (empty($conf->eventorganization->enabled)) {
82 httponly_accessforbidden('Module Event organization not enabled');
83}
84
96function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
97{
98 global $user, $conf, $langs, $mysoc;
99
100 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
101
102 print '<body id="mainbody" class="publicnewmemberform">';
103
104 // Define urllogo
105 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
106
107 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
108 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
109 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
110 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
111 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
112 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
113 }
114
115 print '<div class="center">';
116 // Output html code for logo
117 if ($urllogo) {
118 print '<div class="backgreypublicpayment">';
119 print '<div class="logopublicpayment">';
120 print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
121 print '>';
122 print '</div>';
123 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
124 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
125 }
126 print '</div>';
127 }
128
129 if (getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE')) {
130 print '<div class="backimagepubliceventorganizationsubscription">';
131 print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">';
132 print '</div>';
133 }
134
135 print '</div>';
136
137 print '<div class="divmainbodylarge">';
138}
139
140
141/*
142 * Actions
143 */
144
145
146
147/*
148 * View
149 */
150
151$now = dol_now();
152
153dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"]) ? dol_escape_htmltag($_SERVER["SCRIPT_URI"]) : ''), LOG_DEBUG, 0, '_payment');
154
155$tracepost = "";
156foreach ($_POST as $k => $v) {
157 $tracepost .= "$k - $v\n";
158}
159dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
160
161$head = '';
162if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
163 $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
164}
165
166$conf->dol_hide_topmenu = 1;
167$conf->dol_hide_leftmenu = 1;
168
169llxHeaderVierge($langs->trans("PaymentForm"));
170
171
172// Show message
173print '<span id="dolpaymentspan"></span>'."\n";
174print '<div id="dolpaymentdiv" class="center">'."\n";
175
176
177// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
178// Define logo and logosmall
179$logosmall = $mysoc->logo_small;
180$logo = $mysoc->logo;
181$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
182if (getDolGlobalString($paramlogo)) {
183 $logosmall = getDolGlobalString($paramlogo);
184} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
185 $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');
186}
187//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
188// Define urllogo
189$urllogo = '';
190$urllogofull = '';
191if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
192 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
193 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
194} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
195 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
196 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
197}
198
199// Output html code for logo
200if ($urllogo) {
201 print '<div class="backgreypublicpayment">';
202 print '<div class="logopublicpayment">';
203 print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
204 print '>';
205 print '</div>';
206 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
207 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
208 }
209 print '</div>';
210}
211
212if (getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE')) {
213 print '<div class="backimagepubliceventorganizationsubscription">';
214 print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">';
215 print '</div>';
216}
217
218print '<br><br><br>';
219
220print $langs->trans("SubscriptionOk");
221
222print "\n</div>\n";
223
224
225htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
226
227
228// Clean session variables to avoid duplicate actions if post is resent
229unset($_SESSION["FinalPaymentAmt"]);
230unset($_SESSION["TRANSACTIONID"]);
231
232
233llxFooter('', 'public');
234
235$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge()
Header function.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
llxFooter()
Footer empty.
Definition document.php:107
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.