Code

Updated gosaSupportDaemon
[gosa.git] / gosa-core / html / getxls.php
index de3607c82cc6fe4b4c7f874586080f4a314b5af3..e75660e4973d2c0863fa2af5e13ff25acd8d38d8 100644 (file)
@@ -1,28 +1,30 @@
 <?php
 /*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-   Copyright (C) 2005  Guillaume Delecourt
-   Copyright (C) 2005  Vincent Seynhaeve
-   Copyright (C) 2005  Benoit Mortier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003  Cajus Pollmeier
+ * Copyright (C) 2005  Guillaume Delecourt
+ * Copyright (C) 2005  Vincent Seynhaeve
+ * Copyright (C) 2005  Benoit Mortier
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once "../include/php_writeexcel/class.writeexcel_workbook.inc.php";
-require_once "../include/php_writeexcel/class.writeexcel_worksheet.inc.php";
+require_once "../include/utils/excel/class.writeexcel_workbook.inc.php";
+require_once "../include/utils/excel/class.writeexcel_worksheet.inc.php";
 
 function dump_ldap ($mode= 0)
 {
@@ -80,7 +82,7 @@ function dump_ldap ($mode= 0)
       /* PEOPLE 
           Get all peoples from this $dn 
           and put them into the xls work sheet */
-      case "ou=people," : 
+      case get_people_ou() : 
 
         $user    =  $ldap->gen_xls($dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
         $intitul =  array(_("Birthday").":", _("Sex").":", _("Surname")."/"._("Given name").":",_("Language").":");
@@ -114,7 +116,7 @@ function dump_ldap ($mode= 0)
       /* GROUPS 
           Get all groups from th $dn 
           and put them into the xls work sheet */
-      case "ou=groups,"
+      case get_groups_ou()
 
         /* Get group data */
         $groups    = $ldap->gen_xls($dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1);
@@ -150,7 +152,7 @@ function dump_ldap ($mode= 0)
      /* SYSTEMS 
         Get all systems from th $dn
         and put them into the xls work sheet */
-     case "ou=systems,"
+     case get_ou('systemsou')
 
        $name_section=_("Servers");
        $computers= $ldap->gen_xls($dn,"(&(objectClass=*)(cn=*))",array("cn","description","uid"));
@@ -181,7 +183,7 @@ function dump_ldap ($mode= 0)
      /* SYSTEMS 
        Get all systems from th $dn
        and put them into the xls work sheet */
-     case "ou=servers,ou=systems,": $servers= $ldap->gen_xls($dn,"(objectClass=*)",array("cn"));
+     case get_ou('serverou'): $servers= $ldap->gen_xls($dn,"(objectClass=*)",array("cn"));
        $intitul=array(_("Server name").":");
 
        //name of the xls file
@@ -277,16 +279,16 @@ function dump_ldap ($mode= 0)
     $dn =  base64_decode($_GET['dn']);
 
     //data about users
-    $user= $ldap->gen_xls("ou=people,".$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
+    $user= $ldap->gen_xls( get_people_ou().$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
     $user_intitul=array(_("Day of birth").":",_("Sex").":",_("Surname")."/"._("Given name").":",_("Language").":");
     //data about groups
-    $groups= $ldap->gen_xls("ou=groups,".$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1);
+    $groups= $ldap->gen_xls(get_groups_ou().$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1);
     $groups_intitul=array(_("Members").":");
     //data about computers
     $computers= $ldap->gen_xls("ou=computers,".$dn,"(objectClass=*)",array("cn","description","uid"));
     $computers_intitul=array(_("Description").":",_("UID").":");
     //data about servers
-    $servers= $ldap->gen_xls("ou=servers,ou=systems,".$dn,"(objectClass=*)",array("cn"));
+    $servers= $ldap->gen_xls(get_ou('serverou').$dn,"(objectClass=*)",array("cn"));
     $servers_intitul=array(_("Name").":");
     //data about addressbook
     $address= $ldap->gen_xls("dc=addressbook,".$dn,"(objectClass=*)",
@@ -338,7 +340,7 @@ function dump_ldap ($mode= 0)
 
     //count number of users
     $user_nbr=count($user);
-    $worksheet->write('A1',sprintf(_("User List of %s on %s"), $dn, $date),$title_title);
+    $worksheet->write('A1',sprintf(_("User list of %s on %s"), $dn, $date),$title_title);
     $r=3;
     for($i=1;$i<$user_nbr;$i++)
     {
@@ -466,16 +468,17 @@ function dump_ldap ($mode= 0)
 /* Basic setup, remove eventually registered sessions */
 @require_once ("../include/php_setup.inc");
 @require_once ("functions.inc");
-session_start ();
+session::start();
+session::set('errorsAlreadyPosted',array());
 
 /* Logged in? Simple security check */
-if (!isset($_SESSION['ui'])){
+if (!session::is_set('ui')){
   new log("security","all/all","",array(),"Error: getxls.php called without session") ;
   header ("Location: index.php");
   exit;
 }
-$ui     = $_SESSION["ui"];
-$config = $_SESSION['config'];
+$ui     = session::get('ui');
+$config = session::get('config');
 
 
 /* Check ACL's */
@@ -487,7 +490,7 @@ if(isset($_GET['n'])){
 }
 $acl = $ui->get_permissions($dn,"ldapmanager/xlsexport");
 if(!preg_match("/r/",$acl)){
-  echo "insufficient permissions";
+       msg_dialog::display(_("Permission error"),_("You have no permission to do LDAP exports!"),FATAL_ERROR_DIALOG);
   exit();
 }