PageRenderTime 53ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/pages/admin/digidownload.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 110 lines | 105 code | 0 blank | 5 comment | 16 complexity | 16b3de20d7747fc3ef046c86f2e8decf MD5 | raw file
  1. <?php
  2. //This code is copyright (c) Internet Business Solutions SL, all rights reserved.
  3. //The contents of this file are protect under law as the intellectual property of Internet
  4. //Business Solutions SL. Any use, reproduction, disclosure or copying of any kind
  5. //without the express and written permission of Internet Business Solutions SL is forbidden.
  6. //Author: Vince Reid, vince@virtualred.net
  7. $dltext = "";
  8. if(@$digidownloaddays=="") $digidownloaddays=3;
  9. if($success && @$digidownloads==TRUE){
  10. if(@$digidownloadsecret=="") $digidownloadsecret="this is some secwet text";
  11. $sSQL="SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartSessionID,pDownload FROM products INNER JOIN cart ON products.pID=cart.cartProdID INNER JOIN orders ON cart.cartOrderID=orders.ordID WHERE ordStatus>=3 AND cartCompleted=1 AND cartOrderID='" . $ordID . "' AND ordAuthNumber='" . mysql_real_escape_string(trim($ordAuthNumber)) . "' AND pDownload<>'' AND ordDate > '" . date("Y-m-d", (time()-(60*60*24*$digidownloaddays))) . "'";
  12. $result = mysql_query($sSQL) or print(mysql_error());
  13. if(mysql_num_rows($result) > 0){
  14. while($rs = mysql_fetch_assoc($result)){
  15. $theid = $rs['cartProdID'];
  16. $hasdownload = TRUE;
  17. $noregexpcol=FALSE;
  18. $fingerprint = vrhmac($digidownloadsecret, $rs['cartID'] . $theid . $rs['cartSessionID']);
  19. $thedownload=trim($rs['pDownload']);
  20. if(strtolower($thedownload)=='a'){ // auto download
  21. $thedownload = str_replace("%pid%", $theid, $digidownloadpattern);
  22. }
  23. $sSQL="SELECT optRegExp FROM cartoptions INNER JOIN options ON cartoptions.coOptID=options.optID WHERE coCartID=" . $rs["cartID"] . " ORDER BY coCartID";
  24. $result2 = mysql_query($sSQL) or $noregexpcol=TRUE;
  25. if($noregexpcol != TRUE){
  26. while($rs2 = mysql_fetch_assoc($result2)){
  27. $theexp = trim($rs2["optRegExp"]);
  28. if(substr($theexp, 0, 1)=="!"){
  29. $theexp = substr($theexp, 1);
  30. if(substr($theexp, 0, 1)=="!"){
  31. $hasdownload = FALSE;
  32. }else{
  33. $theexp = str_replace('%s', $thedownload, $theexp);
  34. if(strpos($theexp, " ") !== FALSE){ // Search and replace
  35. $exparr = split(" ", $theexp, 2);
  36. $thedownload = str_replace($exparr[0], $exparr[1], $thedownload);
  37. }else
  38. $thedownload = $theexp;
  39. }
  40. }
  41. }
  42. }
  43. if($hasdownload){
  44. $dltext .= '<tr><td class="cobll" align="left" bgcolor="#FFFFFF">' . $theid . '</td>';
  45. $dltext .= '<td class="cobll" align="left" bgcolor="#FFFFFF">' . $rs["cartProdName"] . '</td>';
  46. $dltext .= '<td class="cobll" align="center" bgcolor="#FFFFFF">';
  47. if(@$digidownloadmethod=="filesystem"){
  48. $dltext .= '<a href="' . $storeurl . 'admin/dodownload.php?ref=' . $theid . '&id=' . $rs['cartID'] . '&sd=' . $rs["cartSessionID"] . '&rd=' . $fingerprint . '" onmouseover="(window.status=\'' . str_replace("'", "\'", $xxDlPro) . '\'); return true" onmouseout="(window.status=\'\'); return true"><font size="4" color="#FF0000"><strong>' . $xxDlPro . '</strong></font></a>';
  49. }else{
  50. $dltext .= '<a href="' . str_replace('"', "&quot;", $thedownload) . '" onmouseover="(window.status=\'' . str_replace("'", "\'", $xxDlPro) . '\'); return true" onmouseout="(window.status=\'\'); return true"><font size="4" color="#FF0000"><strong>' . $xxDlPro . '</strong></font></a>';
  51. }
  52. $dltext .= "</td></tr>\r\n";
  53. }
  54. }
  55. }
  56. if($dltext != ""){ ?>
  57. <table class="cobtbl" width="<?php print $maintablewidth?>" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3" bgcolor="#B1B1B1">
  58. <tr>
  59. <td class="cobhl" align="center" colspan="3" bgcolor="#F7F7F7">
  60. <strong><?php print $xxDlPros?></strong>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class="cobhl" align="left" bgcolor="#F7F7F7"><strong><?php print $xxPrId?></strong></td>
  65. <td class="cobhl" align="left" bgcolor="#F7F7F7"><strong><?php print $xxPrNm?></strong></td>
  66. <td class="cobhl" align="center" bgcolor="#F7F7F7"><strong><?php print $xxDownl?></strong></td>
  67. </tr>
  68. <?php print $dltext; ?>
  69. </table>
  70. <br />
  71. <?php }elseif(@$warnexpireddownload==TRUE){ ?>
  72. <table class="cobtbl" width="<?php print $maintablewidth?>" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3" bgcolor="#B1B1B1">
  73. <tr>
  74. <td class="cobhl" align="center" colspan="3" bgcolor="#F7F7F7">
  75. <strong><?php print $xxDlPros?></strong>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td class="cobll" align="center">
  80. &nbsp;<br />
  81. There are no downloadable products associated with this order or the download time has expired.
  82. <br />&nbsp;
  83. </td>
  84. </tr>
  85. </table>
  86. <br />
  87. <?php }
  88. if(! (@$noshowdigiordertext==TRUE)){
  89. ?>
  90. <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
  91. <tr>
  92. <td width="100%">
  93. <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
  94. <tr>
  95. <td width="100%"><?php print str_replace(array("\r\n","\n"),array("<br />","<br />"),$orderText)?>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td width="100%" align="center"><br /><br />
  100. <?php print $xxRecEml?><br /><br />
  101. <a href="<?php print $storeurl?>"><strong><?php print $xxCntShp?></strong></a><br />
  102. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" />
  103. </td>
  104. </tr>
  105. </table>
  106. </td>
  107. </tr>
  108. </table>
  109. <?php }
  110. } ?>