/php/church-ledger/tithe/RPCdummy.php

https://github.com/bdumitriu/playground · PHP · 125 lines · 93 code · 12 blank · 20 comment · 23 complexity · fa10cdfa13eb968589c00d8b8b522f5a MD5 · raw file

  1. <?php
  2. /*
  3. * Date: 2004-11-28
  4. * http://osc.sourceforge.net
  5. *
  6. * This product is based upon work previously done by Infocentral (infocentral.org)
  7. * on their PHP version Church Management Software that they discontinued
  8. * and we have taken over. We continue to improve and build upon this product
  9. * in the direction of excellence.
  10. *
  11. * OpenSourceChurch (OSC) is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * Any changes to the software must be submitted back to the OpenSourceChurch project
  17. * for review and possible inclusion.
  18. */
  19. require "Include/Config.php";
  20. require "Include/Functions.php";
  21. $mode = $_GET['mode'];
  22. $data = FilterInput($_GET['data'],'int');
  23. ?>
  24. <html>
  25. <head>
  26. <script language="JavaScript">
  27. <?php
  28. // Select the appropriate Javascript routine..
  29. switch ($mode)
  30. {
  31. case CartCounter:
  32. ?>
  33. windowOnload = function()
  34. {
  35. window.parent.updateCartCounter('<?php echo count($_SESSION['aPeopleCart']); ?>');
  36. }
  37. <?php
  38. break;
  39. case Envelope2Address:
  40. // Security check
  41. if (!$_SESSION['bFinance']) exit;
  42. $sSQL = "SELECT per_Address1, per_Address2, per_City, per_State, per_Zip, per_Country,
  43. fam_Address1, fam_Address2, fam_City, fam_State, fam_Zip, fam_Country
  44. FROM person_per LEFT JOIN family_fam ON person_per.per_fam_ID = family_fam.fam_ID
  45. WHERE per_Envelope=" . $data;
  46. $rsQuery = RunQuery($sSQL);
  47. if (mysql_num_rows($rsQuery) == 0)
  48. {
  49. $sAddressInfoHTML = "invalid";
  50. }
  51. else
  52. {
  53. extract(mysql_fetch_array($rsQuery));
  54. $sCity = SelectWhichInfo($per_City, $fam_City, false);
  55. $sState = SelectWhichInfo($per_State, $fam_State, false);
  56. $sZip = SelectWhichInfo($per_Zip, $fam_Zip, false);
  57. $sCountry = SelectWhichInfo($per_Country, $fam_Country, false);
  58. SelectWhichAddress($sAddress1, $sAddress2, $per_Address1, $per_Address2, $fam_Address1, $fam_Address2, false);
  59. $sAddressInfoHTML = "<b>" . gettext("Address Info:") . "</b><br>";
  60. if ($sAddress1 != "") { $sAddressInfoHTML .= $sAddress1 . "<br>"; }
  61. if ($sAddress2 != "") { $sAddressInfoHTML .= $sAddress2 . "<br>"; }
  62. if ($sCity != "") { $sAddressInfoHTML .= $sCity . ", "; }
  63. if ($sState != "") { $sAddressInfoHTML .= $sState; }
  64. if ($sZip != "") { $sAddressInfoHTML .= " " . $sZip; }
  65. if ($sCountry != "") {$sAddressInfoHTML .= "<br>" . $sCountry; }
  66. }
  67. ?>
  68. windowOnload = function()
  69. {
  70. window.parent.updateAddressInfo('<?php echo $sAddressInfoHTML; ?>');
  71. }
  72. <?php
  73. break;
  74. case GroupRolesSelect:
  75. // Security check
  76. if (!$_SESSION['bManageGroups']) exit;
  77. if ($data > 0) {
  78. $sSQL = "SELECT grp_DefaultRole,grp_RoleListID FROM group_grp WHERE grp_ID = " . $data;
  79. $rsQuery = RunQuery($sSQL);
  80. extract(mysql_fetch_array($rsQuery));
  81. $sSQL = "SELECT lst_OptionID,lst_OptionName FROM list_lst WHERE lst_ID = " . $grp_RoleListID . " ORDER BY lst_OptionSequence";
  82. $rsQuery = RunQuery($sSQL);
  83. if (mysql_num_rows($rsQuery) == 0)
  84. $sGeneratedHTML = "invalid";
  85. else
  86. {
  87. $sGeneratedHTML = "<select name=\"GroupRole\">";
  88. while($aRow = mysql_fetch_array($rsQuery))
  89. {
  90. extract($aRow);
  91. $sGeneratedHTML .= "<option value=\"" . $lst_OptionID . "\"";
  92. if ($lst_OptionID == $grp_DefaultRole) $sGeneratedHTML .= " selected";
  93. $sGeneratedHTML .= ">" . $lst_OptionName . "</option>";
  94. }
  95. $sGeneratedHTML .= "</select>";
  96. }
  97. } else {
  98. $sGeneratedHTML = gettext("No Group Selected");
  99. }
  100. ?>
  101. windowOnload = function()
  102. {
  103. window.parent.updateGroupRoles('<?php echo $sGeneratedHTML; ?>');
  104. }
  105. <?php
  106. break;
  107. }
  108. ?>
  109. </script>
  110. </head>
  111. <body onload="windowOnload();">
  112. </body>
  113. </html>