Code

Unified unlocking of plugins (main.inc)
[gosa.git] / gosa-plugins / goto / addons / goto / main.inc
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  */
24 /* Remove locks created by this plugin
25 */
26 if ($remove_lock){
27   if(session::is_set('gotomasses')){
28     // Nothing to unlock here
29   }
30 }
32 /* Remove this plugin from session
33 */
34 if ( $cleanup ){
35   session::un_set('gotomasses');
36 }else{
39         /* Create gotomasses object on demand */
40         if (!session::is_set('gotomasses') 
41                 || (isset($_GET['reset']) && $_GET['reset'] == 1) 
42                 || isset($_POST['reload_gotomass_data'])){
43                 $gotomasses= new gotomasses ($config);
44                 $gotomasses->set_acl_category("gotomasses");
46         /* Check root dn and user dn for acl informations */
47         $gotomasses->set_acl_base($config->current['BASE']);
48         if($gotomasses->getacl("") == ""){
49             $gotomasses->set_acl_base($ui->dn);
50         }
51                 
52                 /* Check if we have acl on our own base */
53         if($gotomasses->getacl("") == ""){
54             $gotomasses->set_acl_base(dn2base($ui->dn));
55         }
56                 session::set("gotomasses",$gotomasses);
57         }
58         $gotomasses = session::get('gotomasses');
60         /* Execute formular */
61         $display= $gotomasses->save_object();
62         if(isset($_POST['save_gotomass_changes'])){
63                 $gotomasses->save();
64         }
65         $display= $gotomasses->execute ();
67         /* Page header*/
68         $display= print_header(get_template_path('plugins/goto/images/goto.png'), _("System deployment status")).$display;
70         /* Store changes  in session */
71         session::set('gotomasses',$gotomasses);
72 }