users_vcard.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. include "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (permission_exists('contact_view')) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. require_once "resources/classes/vcard.php";
  32. $vc = new vcard();
  33. if (count($_GET)>0) {
  34. $id = $_GET["id"];
  35. $sql = "";
  36. $sql .= "select * from v_users ";
  37. $sql .= "where domain_uuid = '$domain_uuid' ";
  38. $sql .= "and id = '$id' ";
  39. $prep_statement = $db->prepare(check_sql($sql));
  40. $prep_statement->execute();
  41. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  42. foreach ($result as &$row) {
  43. $vc->data[display_name] = $row["user_first_name"]." ".$row["user_last_name"];
  44. //$vc->data[zzz] = $row["user_type"];
  45. //$vc->data[zzz] = $row["user_category"];
  46. $vc->data[first_name] = $row["user_first_name"];
  47. $vc->data[last_name] = $row["user_last_name"];
  48. $vc->data[company] = $row["user_company_name"];
  49. $vc->data[work_address] = $row["user_physical_address_1"];
  50. $vc->data[work_extended_address] = $row["user_physical_address_2"];
  51. $vc->data[work_city] = $row["user_physical_city"];
  52. $vc->data[work_state] = $row["user_physical_state_province"];
  53. $vc->data[work_postal_code] = $row["user_physical_postal_code"];
  54. $vc->data[work_country] = $row["user_physical_country"];
  55. $vc->data[home_address] = $row["user_physical_address_1"];
  56. $vc->data[home_extended_address] = $row["user_physical_address_2"];
  57. $vc->data[home_city] = $row["user_physical_city"];
  58. $vc->data[home_state] = $row["user_physical_state_province"];
  59. $vc->data[home_postal_code] = $row["user_physical_postal_code"];
  60. $vc->data[home_country] = $row["user_physical_country"];
  61. //$vc->data[zzz] = $row["user_mailing_address_1"];
  62. //$vc->data[zzz] = $row["user_mailing_address_2"];
  63. //$vc->data[zzz] = $row["user_mailing_city"];
  64. //$vc->data[zzz] = $row["user_mailing_state_province"];
  65. //$vc->data[zzz] = $row["user_mailing_postal_code"];
  66. //$vc->data[zzz] = $row["user_mailing_country"];
  67. //$vc->data[zzz] = $row["user_billing_address_1"];
  68. //$vc->data[zzz] = $row["user_billing_address_2"];
  69. //$vc->data[zzz] = $row["user_billing_city"];
  70. //$vc->data[zzz] = $row["user_billing_state_province"];
  71. //$vc->data[zzz] = $row["user_billing_postal_code"];
  72. //$vc->data[zzz] = $row["user_billing_country"];
  73. //$vc->data[zzz] = $row["user_shipping_address_1"];
  74. //$vc->data[zzz] = $row["user_shipping_address_2"];
  75. //$vc->data[zzz] = $row["user_shipping_city"];
  76. //$vc->data[zzz] = $row["user_shipping_state_province"];
  77. //$vc->data[zzz] = $row["user_shipping_postal_code"];
  78. //$vc->data[zzz] = $row["user_shipping_country"];
  79. $vc->data[office_tel] = $row["user_phone_1"];
  80. $vc->data[home_tel] = $row["user_phone_1"];
  81. //$vc->data[zzz] = $row["user_phone_1_ext"];
  82. //$vc->data[zzz] = $row["user_phone_2"];
  83. //$vc->data[zzz] = $row["user_phone_2_ext"];
  84. $vc->data[cell_tel] = $row["user_phone_mobile"];
  85. $vc->data[fax_tel] = $row["user_phone_fax"];
  86. //$vc->data[zzz] = $row["user_phone_emergency_mobile"];
  87. //$vc->data[zzz] = $row["user_email_emergency"];
  88. $vc->data[email1] = $row["user_email"];
  89. $vc->data[url] = $row["user_url"];
  90. $vc->data[note] = $row["user_notes"];
  91. /*
  92. //additional un accounted fields
  93. additional_name
  94. name_prefix
  95. name_suffix
  96. nickname
  97. title
  98. role
  99. department
  100. work_po_box
  101. home_po_box
  102. home_extended_address
  103. home_address
  104. home_city
  105. home_state
  106. home_postal_code
  107. home_country
  108. pager_tel
  109. email2
  110. photo
  111. birthday
  112. timezone
  113. sort_string
  114. */
  115. break; //limit to 1 row
  116. }
  117. unset ($prep_statement);
  118. }
  119. $vc->download();
  120. ?>