subscriptionok.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. /**
  22. * \file htdocs/public/payment/paymentok.php
  23. * \ingroup core
  24. * \brief File to show page after a successful payment
  25. * This page is called by payment system with url provided to it completed with parameter TOKEN=xxx
  26. * This token can be used to get more informations.
  27. */
  28. if (!defined('NOLOGIN')) {
  29. define("NOLOGIN", 1); // This means this output page does not require to be logged.
  30. }
  31. if (!defined('NOCSRFCHECK')) {
  32. define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
  33. }
  34. if (!defined('NOIPCHECK')) {
  35. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  36. }
  37. if (!defined('NOBROWSERNOTIF')) {
  38. define('NOBROWSERNOTIF', '1');
  39. }
  40. // For MultiCompany module.
  41. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
  42. // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
  43. $entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
  44. if (is_numeric($entity)) {
  45. define("DOLENTITY", $entity);
  46. }
  47. // Load Dolibarr environment
  48. require '../../main.inc.php';
  49. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  50. require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
  51. if (isModEnabled('paypal')) {
  52. require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
  53. require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
  54. }
  55. global $dolibarr_main_url_root, $mysoc;
  56. $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
  57. $object = new stdClass(); // For triggers
  58. $error = 0;
  59. // Security check
  60. $id = GETPOST("id", 'int');
  61. $securekeyreceived = GETPOST("securekey");
  62. $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
  63. if ($securekeyreceived != $securekeytocompare) {
  64. print $langs->trans('MissingOrBadSecureKey');
  65. exit;
  66. }
  67. // Security check
  68. if (empty($conf->eventorganization->enabled)) {
  69. httponly_accessforbidden('Module Event organization not enabled');
  70. }
  71. /*
  72. * Actions
  73. */
  74. /*
  75. * View
  76. */
  77. $now = dol_now();
  78. 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');
  79. $tracepost = "";
  80. foreach ($_POST as $k => $v) {
  81. $tracepost .= "{$k} - {$v}\n";
  82. }
  83. dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
  84. $head = '';
  85. if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
  86. $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
  87. }
  88. $conf->dol_hide_topmenu = 1;
  89. $conf->dol_hide_leftmenu = 1;
  90. $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
  91. llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
  92. // Show message
  93. print '<span id="dolpaymentspan"></span>'."\n";
  94. print '<div id="dolpaymentdiv" class="center">'."\n";
  95. // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
  96. // Define logo and logosmall
  97. $logosmall = $mysoc->logo_small;
  98. $logo = $mysoc->logo;
  99. $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
  100. if (!empty($conf->global->$paramlogo)) {
  101. $logosmall = $conf->global->$paramlogo;
  102. } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
  103. $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
  104. }
  105. //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
  106. // Define urllogo
  107. $urllogo = '';
  108. $urllogofull = '';
  109. if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
  110. $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
  111. $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
  112. } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
  113. $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
  114. $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
  115. }
  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 (empty($conf->global->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. 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. print '<br><br><br>';
  134. print $langs->trans("SubscriptionOk");
  135. print "\n</div>\n";
  136. htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix);
  137. // Clean session variables to avoid duplicate actions if post is resent
  138. unset($_SESSION["FinalPaymentAmt"]);
  139. unset($_SESSION["TRANSACTIONID"]);
  140. llxFooter('', 'public');
  141. $db->close();