subscriptionok.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. require '../../main.inc.php';
  48. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  49. require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
  50. if (!empty($conf->paypal->enabled)) {
  51. require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
  52. require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
  53. }
  54. global $dolibarr_main_url_root, $mysoc;
  55. $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
  56. $object = new stdClass(); // For triggers
  57. $error = 0;
  58. // Security check
  59. $id = GETPOST("id", 'int');
  60. $securekeyreceived = GETPOST("securekey");
  61. $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
  62. if ($securekeyreceived != $securekeytocompare) {
  63. print $langs->trans('MissingOrBadSecureKey');
  64. exit;
  65. }
  66. // Security check
  67. if (empty($conf->eventorganization->enabled)) {
  68. httponly_accessforbidden('Module Event organization not enabled');
  69. }
  70. /*
  71. * Actions
  72. */
  73. /*
  74. * View
  75. */
  76. $now = dol_now();
  77. 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');
  78. $tracepost = "";
  79. foreach ($_POST as $k => $v) {
  80. $tracepost .= "{$k} - {$v}\n";
  81. }
  82. dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
  83. $head = '';
  84. if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
  85. $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
  86. }
  87. $conf->dol_hide_topmenu = 1;
  88. $conf->dol_hide_leftmenu = 1;
  89. $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
  90. llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
  91. // Show message
  92. print '<span id="dolpaymentspan"></span>'."\n";
  93. print '<div id="dolpaymentdiv" class="center">'."\n";
  94. // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
  95. // Define logo and logosmall
  96. $logosmall = $mysoc->logo_small;
  97. $logo = $mysoc->logo;
  98. $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
  99. if (!empty($conf->global->$paramlogo)) {
  100. $logosmall = $conf->global->$paramlogo;
  101. } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
  102. $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
  103. }
  104. //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
  105. // Define urllogo
  106. $urllogo = '';
  107. $urllogofull = '';
  108. if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
  109. $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
  110. $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
  111. } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
  112. $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
  113. $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
  114. }
  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. if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) {
  128. print '<div class="backimagepubliceventorganizationsubscription">';
  129. print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE.'">';
  130. print '</div>';
  131. }
  132. print '<br><br><br>';
  133. print $langs->trans("SubscriptionOk");
  134. print "\n</div>\n";
  135. htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix);
  136. // Clean session variables to avoid duplicate actions if post is resent
  137. unset($_SESSION["FinalPaymentAmt"]);
  138. unset($_SESSION["TRANSACTIONID"]);
  139. llxFooter('', 'public');
  140. $db->close();