dolibarr  18.0.6
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 
95 function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
96 {
97  global $user, $conf, $langs, $mysoc;
98 
99  top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
100 
101  print '<body id="mainbody" class="publicnewmemberform">';
102 
103  // Define urllogo
104  $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
105 
106  if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
107  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
108  } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
109  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
110  } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
111  $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
112  }
113 
114  print '<div class="center">';
115  // Output html code for logo
116  if ($urllogo) {
117  print '<div class="backgreypublicpayment">';
118  print '<div class="logopublicpayment">';
119  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
120  print '>';
121  print '</div>';
122  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
123  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>';
124  }
125  print '</div>';
126  }
127 
128  if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) {
129  print '<div class="backimagepubliceventorganizationsubscription">';
130  print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE.'">';
131  print '</div>';
132  }
133 
134  print '</div>';
135 
136  print '<div class="divmainbodylarge">';
137 }
138 
139 
140 /*
141  * Actions
142  */
143 
144 
145 
146 /*
147  * View
148  */
149 
150 $now = dol_now();
151 
152 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');
153 
154 $tracepost = "";
155 foreach ($_POST as $k => $v) {
156  $tracepost .= "$k - $v\n";
157 }
158 dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
159 
160 $head = '';
161 if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
162  $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
163 }
164 
165 $conf->dol_hide_topmenu = 1;
166 $conf->dol_hide_leftmenu = 1;
167 
168 llxHeaderVierge($langs->trans("PaymentForm"));
169 
170 
171 // Show message
172 print '<span id="dolpaymentspan"></span>'."\n";
173 print '<div id="dolpaymentdiv" class="center">'."\n";
174 
175 
176 // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
177 // Define logo and logosmall
178 $logosmall = $mysoc->logo_small;
179 $logo = $mysoc->logo;
180 $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
181 if (!empty($conf->global->$paramlogo)) {
182  $logosmall = $conf->global->$paramlogo;
183 } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
184  $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
185 }
186 //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
187 // Define urllogo
188 $urllogo = '';
189 $urllogofull = '';
190 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
191  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
192  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
193 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
194  $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
195  $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
196 }
197 
198 // Output html code for logo
199 if ($urllogo) {
200  print '<div class="backgreypublicpayment">';
201  print '<div class="logopublicpayment">';
202  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
203  print '>';
204  print '</div>';
205  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
206  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>';
207  }
208  print '</div>';
209 }
210 
211 if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) {
212  print '<div class="backimagepubliceventorganizationsubscription">';
213  print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE.'">';
214  print '</div>';
215 }
216 
217 print '<br><br><br>';
218 
219 print $langs->trans("SubscriptionOk");
220 
221 print "\n</div>\n";
222 
223 
224 htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
225 
226 
227 // Clean session variables to avoid duplicate actions if post is resent
228 unset($_SESSION["FinalPaymentAmt"]);
229 unset($_SESSION["TRANSACTIONID"]);
230 
231 
232 llxFooter('', 'public');
233 
234 $db->close();
if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOIPCHECK')) llxHeaderVierge()
Header function.
llxFooter()
Empty footer.
Definition: wrapper.php:70
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
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.
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='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Definition: main.inc.php:1641
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.