dolibarr  16.0.5
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 require '../../main.inc.php';
52 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
53 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
54 
55 if (!empty($conf->paypal->enabled)) {
56  require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
57  require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
58 }
59 
60 global $dolibarr_main_url_root, $mysoc;
61 
62 $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
63 
64 $object = new stdClass(); // For triggers
65 
66 $error = 0;
67 
68 // Security check
69 $id = GETPOST("id", 'int');
70 $securekeyreceived = GETPOST("securekey");
71 $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
72 
73 if ($securekeyreceived != $securekeytocompare) {
74  print $langs->trans('MissingOrBadSecureKey');
75  exit;
76 }
77 
78 // Security check
79 if (empty($conf->eventorganization->enabled)) {
80  accessforbidden('', 0, 0, 1);
81 }
82 
83 
84 /*
85  * Actions
86  */
87 
88 
89 
90 /*
91  * View
92  */
93 
94 $now = dol_now();
95 
96 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');
97 
98 $tracepost = "";
99 foreach ($_POST as $k => $v) {
100  $tracepost .= "{$k} - {$v}\n";
101 }
102 dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
103 
104 $head = '';
105 if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
106  $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
107 }
108 
109 $conf->dol_hide_topmenu = 1;
110 $conf->dol_hide_leftmenu = 1;
111 
112 $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
113 llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
114 
115 
116 // Show message
117 print '<span id="dolpaymentspan"></span>'."\n";
118 print '<div id="dolpaymentdiv" class="center">'."\n";
119 
120 
121 // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
122 // Define logo and logosmall
123 $logosmall = $mysoc->logo_small;
124 $logo = $mysoc->logo;
125 $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
126 if (!empty($conf->global->$paramlogo)) {
127  $logosmall = $conf->global->$paramlogo;
128 } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
129  $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
130 }
131 //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
132 // Define urllogo
133 $urllogo = '';
134 $urllogofull = '';
135 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
136  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
137  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
138 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
139  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
140  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
141 }
142 
143 // Output html code for logo
144 if ($urllogo) {
145  print '<div class="backgreypublicpayment">';
146  print '<div class="logopublicpayment">';
147  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
148  print '>';
149  print '</div>';
150  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
151  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>';
152  }
153  print '</div>';
154 }
155 
156 if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) {
157  print '<div class="backimagepubliceventorganizationsubscription">';
158  print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE.'">';
159  print '</div>';
160 }
161 
162 print '<br><br><br>';
163 
164 print $langs->trans("SubscriptionOk");
165 
166 print "\n</div>\n";
167 
168 
169 htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix);
170 
171 
172 // Clean session variables to avoid duplicate actions if post is resent
173 unset($_SESSION["FinalPaymentAmt"]);
174 unset($_SESSION["TRANSACTIONID"]);
175 
176 
177 llxFooter('', 'public');
178 
179 $db->close();
dol_escape_htmltag
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.
Definition: functions.lib.php:1468
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_hash
dol_hash($chain, $type='0')
Returns a hash of a string.
Definition: security.lib.php:104
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59