PageRenderTime 53ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/administrator/components/com_virtuemart/html/checkout.danhost_result.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 109 lines | 70 code | 11 blank | 28 comment | 7 complexity | 3be1202661dd46c89f72ba67bf91a435 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Danhost Order Confirmation Handler
  4. *
  5. * @version $Id: checkout.danhost_result.php 1122 2008-01-07 14:52:31Z thepisu $
  6. * @package VirtueMart
  7. * @subpackage html
  8. * @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
  9. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  10. * VirtueMart is free software. This version may have been modified pursuant
  11. * to the GNU General Public License, and as distributed it includes or
  12. * is derivative of works licensed under the GNU General Public License or
  13. * other free or open source software licenses.
  14. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
  15. *
  16. * http://virtuemart.net
  17. */
  18. if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
  19. require_once( CLASSPATH ."payment/ps_pbs.cfg.php");
  20. $sessionid = vmGet( $_GET, "sessionid" );
  21. $cookievals = base64_decode( $sessionid );
  22. $orderID = substr( $cookievals, 0, 8 );
  23. $order_id = intval( $orderID );
  24. $virtuemartcookie = substr( $cookievals, 8, 32 );
  25. $remote_ip_md5 = substr( $cookievals, 40, 32 );
  26. $md5_check = substr( $cookievals, 72, 32 );
  27. // Check Validity of the Page Load using the MD5 Check
  28. $submitted_hashbase = $orderID . $virtuemartcookie . $remote_ip_md5;
  29. // OK! VALID...
  30. if( !$my->id ) {
  31. mosNotAuth();
  32. echo '<br />';
  33. include( PAGEPATH. 'checkout.login_form.php');
  34. echo '<br /><br />';
  35. }
  36. elseif( $md5_check === md5( $submitted_hashbase . $mosConfig_secret . ENCODE_KEY) ) {
  37. $qv = "SELECT order_id, order_number FROM #__{vm}_orders ";
  38. $qv .= "WHERE order_id='".$order_id."' AND user_id='".$my->id."'";
  39. $dbo = new ps_DB;
  40. $dbo->query($qv);
  41. if($dbo->next_record()) {
  42. $d['order_id'] = $dbo->f("order_id");
  43. if( empty($_GET['errortype']) ) {
  44. // UPDATE THE ORDER STATUS to 'VALID'
  45. $d['order_status'] = PBS_VERIFIED_STATUS;
  46. // Setting this to "Y" = yes is required by Danish Law
  47. $d['notify_customer'] = "Y";
  48. $d['include_comment'] = "Y";
  49. // Notifying the customer about the transaction key and
  50. // the order Status Update
  51. $d['order_comment'] = str_replace('{transactionnumber}',$_GET['orderid'],$VM_LANG->_('VM_CHECKOUT_PBS_APPROVED_ORDERCOMMENT'));
  52. require_once ( CLASSPATH . 'ps_order.php' );
  53. $ps_order= new ps_order;
  54. $ps_order->order_status_update($d);
  55. ?>
  56. <img src="<?php echo IMAGEURL ?>ps_image/button_ok.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_SUCCESS'); ?>" border="0" />
  57. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') ?></h2>
  58. <?php
  59. }
  60. else {
  61. // the Payment wasn't successful. Maybe the Payment couldn't
  62. // be verified and is pending
  63. // UPDATE THE ORDER STATUS to 'INVALID'
  64. $d['order_status'] = PBS_INVALID_STATUS;
  65. // Setting this to "Y" = yes is required by Danish Law
  66. $d['notify_customer'] = "Y";
  67. $d['include_comment'] = "Y";
  68. // Notifying the customer about the transaction key and
  69. // the order Status Update
  70. $d['order_comment'] = str_replace('{transactionnumber}',$_GET['orderid'],$VM_LANG->_('VM_CHECKOUT_PBS_NOTAPPROVED_ORDERCOMMENT'));
  71. require_once ( CLASSPATH . 'ps_order.php' );
  72. $ps_order= new ps_order;
  73. $ps_order->order_status_update($d);
  74. ?>
  75. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  76. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') ?></h2>
  77. <?php
  78. echo $_GET['errortype'];
  79. }
  80. ?>
  81. <br />
  82. <p><a href="<?php @$sess->purl( SECUREURL."index.php?option=com_virtuemart&page=account.order_details&order_id=$order_id" ) ?>">
  83. <?php echo $VM_LANG->_('PHPSHOP_ORDER_LINK') ?></a>
  84. </p>
  85. <?php
  86. }
  87. else {
  88. ?>
  89. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  90. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_ORDERNOTFOUND') . ')'; ?></span><?php
  91. }
  92. }
  93. else{
  94. ?>
  95. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  96. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_MD5_FAILED') . ')'; ?></span><?php
  97. }
  98. ?>