dolibarr  17.0.4
subscriptionok.php
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  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
30 if (!defined('NOLOGIN')) {
31  define("NOLOGIN", 1); // This means this output page does not require to be logged.
32 }
33 if (!defined('NOCSRFCHECK')) {
34  define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
35 }
36 if (!defined('NOIPCHECK')) {
37  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
38 }
39 if (!defined('NOBROWSERNOTIF')) {
40  define('NOBROWSERNOTIF', '1');
41 }
42 
43 // For MultiCompany module.
44 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
45 // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
46 $entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
47 if (is_numeric($entity)) {
48  define("DOLENTITY", $entity);
49 }
50 
51 // Load Dolibarr environment
52 require '../../main.inc.php';
53 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
54 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
55 
56 if (isModEnabled('paypal')) {
57  require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
58  require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
59 }
60 
61 global $dolibarr_main_url_root, $mysoc;
62 
63 $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
64 
65 $object = new stdClass(); // For triggers
66 
67 $error = 0;
68 
69 // Security check
70 $id = GETPOST("id", 'int');
71 $securekeyreceived = GETPOST("securekey");
72 $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
73 
74 if ($securekeyreceived != $securekeytocompare) {
75  print $langs->trans('MissingOrBadSecureKey');
76  exit;
77 }
78 
79 // Security check
80 if (empty($conf->eventorganization->enabled)) {
81  httponly_accessforbidden('Module Event organization not enabled');
82 }
83 
84 
85 /*
86  * Actions
87  */
88 
89 
90 
91 /*
92  * View
93  */
94 
95 $now = dol_now();
96 
97 dol_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');
98 
99 $tracepost = "";
100 foreach ($_POST as $k => $v) {
101  $tracepost .= "{$k} - {$v}\n";
102 }
103 dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
104 
105 $head = '';
106 if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
107  $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
108 }
109 
110 $conf->dol_hide_topmenu = 1;
111 $conf->dol_hide_leftmenu = 1;
112 
113 $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
114 llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
115 
116 
117 // Show message
118 print '<span id="dolpaymentspan"></span>'."\n";
119 print '<div id="dolpaymentdiv" class="center">'."\n";
120 
121 
122 // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
123 // Define logo and logosmall
124 $logosmall = $mysoc->logo_small;
125 $logo = $mysoc->logo;
126 $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
127 if (!empty($conf->global->$paramlogo)) {
128  $logosmall = $conf->global->$paramlogo;
129 } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
130  $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
131 }
132 //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
133 // Define urllogo
134 $urllogo = '';
135 $urllogofull = '';
136 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
137  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
138  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
139 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
140  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
141  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
142 }
143 
144 // Output html code for logo
145 if ($urllogo) {
146  print '<div class="backgreypublicpayment">';
147  print '<div class="logopublicpayment">';
148  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
149  print '>';
150  print '</div>';
151  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
152  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>';
153  }
154  print '</div>';
155 }
156 
157 if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) {
158  print '<div class="backimagepubliceventorganizationsubscription">';
159  print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE.'">';
160  print '</div>';
161 }
162 
163 print '<br><br><br>';
164 
165 print $langs->trans("SubscriptionOk");
166 
167 print "\n</div>\n";
168 
169 
170 htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix);
171 
172 
173 // Clean session variables to avoid duplicate actions if post is resent
174 unset($_SESSION["FinalPaymentAmt"]);
175 unset($_SESSION["TRANSACTIONID"]);
176 
177 
178 llxFooter('', 'public');
179 
180 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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')
Returns a hash (non reversible encryption) of a string.