1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 function dump_ldap ($mode= 0)
22 {
23 global $config;
24 $ldap= $config->get_ldap_link();
26 $display = "";
28 if($mode == 2){ // Single Entry Export !
29 $dn = base64_decode($_GET['dn']);
30 $display = $ldap->gen_one_entry($dn);
31 echo $display;
32 }
33 elseif($mode == 3){ // Full LDIF Export !
34 $dn = base64_decode($_GET['dn']);
35 $display = $ldap->gen_ldif($dn);
36 echo $display;
37 }
38 elseif($mode == 4){ // IVBB LDIF Export
39 $dn = base64_decode($_GET['dn']);
40 $display= $ldap->gen_ldif($dn,"(objectClass=ivbbentry)",array(
41 "GouvernmentOrganizationalUnit","houseIdentifier","vocation",
42 "ivbbLastDeliveryCollective","gouvernmentOrganizationalPersonLocality",
43 "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea",
44 "functionalTitle","role","certificateSerialNumber","userCertificate","publicVisible",
45 "telephoneNumber","seeAlso","description","title","x121Address","registeredAddress",
46 "destinationIndicator","preferredDeliveryMethod","telexNumber","teletexTerminalIdentifier",
47 "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street",
48 "postOfficeBox","postalCode","postalAddress","physicalDeliveryOfficeName","ou",
49 "st","l","audio","businessCategory","carLicense","departmentNumber","displayName",
50 "employeeNumber","employeeType","givenName","homePhone","homePostalAddress",
51 "initials","jpegPhoto","labeledURI","mail","manager","mobile","o","pager","photo",
52 "roomNumber","secretary","userCertificate","x500uniqueIdentifier","preferredLanguage",
53 "userSMIMECertificate","userPKCS12"));
55 echo $display;
56 }
57 }
60 /* Basic setup, remove eventually registered sessions */
61 @require_once ("../include/php_setup.inc");
62 @require_once ("functions.inc");
63 error_reporting (E_ALL);
64 session_start ();
66 /* Logged in? Simple security check */
67 if (!isset($_SESSION['ui'])){
68 gosa_log ("Error: getldif.php called without session");
69 header ("Location: ../index.php");
70 exit;
71 }
72 $ui= $_SESSION["ui"];
73 $config= $_SESSION['config'];
75 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
76 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
77 header("Cache-Control: no-cache");
78 header("Pragma: no-cache");
79 header("Cache-Control: post-check=0, pre-check=0");
81 header("Content-type: text/plain");
83 /* Check ACL's */
84 $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
85 $acl= get_module_permission($acl, "all", $config->current['BASE']);
86 if (chkacl($acl, "all") != ""){
87 header ("Location: ../index.php");
88 exit;
89 }
91 switch ($_GET['ivbb']){
92 case 2: dump_ldap (2);
93 break;
95 case 3: dump_ldap (3);
96 break;
98 case 4: dump_ldap (4);
99 break;
101 default:
102 echo "Error in ivbb parameter. Request aborted.";
103 }
104 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
105 ?>