Code

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