From 635fdfa5d265e37745562f4ae2a6898c3cc67f04 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 12 Dec 2008 14:36:42 +0000 Subject: [PATCH] Unified unlocking of plugins (main.inc) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13287 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/main.php | 40 ++++++----- gosa-core/plugins/admin/acl/main.inc | 24 +++---- gosa-core/plugins/admin/departments/main.inc | 22 ++++--- gosa-core/plugins/admin/groups/main.inc | 22 ++++--- gosa-core/plugins/admin/ogroups/main.inc | 21 +++--- gosa-core/plugins/admin/users/main.inc | 22 ++++--- gosa-core/plugins/generic/welcome/main.inc | 2 +- gosa-core/plugins/personal/generic/main.inc | 20 +++--- gosa-core/plugins/personal/password/main.inc | 18 +++-- gosa-core/plugins/personal/posix/main.inc | 22 +++---- .../addressbook/addons/addressbook/main.inc | 4 +- .../personal/connectivity/main.inc | 66 ++++++++++--------- gosa-plugins/dak/addons/dak/main.inc | 16 +++-- gosa-plugins/dfs/addons/godfs/main.inc | 24 ++++--- gosa-plugins/fai/admin/fai/main.inc | 23 ++++--- gosa-plugins/gofax/gofax/blocklists/main.inc | 22 ++++--- gosa-plugins/gofax/gofax/faxaccount/main.inc | 20 +++--- gosa-plugins/gofax/gofax/faxreports/main.inc | 4 +- gosa-plugins/gofon/gofon/conference/main.inc | 22 ++++--- gosa-plugins/gofon/gofon/fonreports/main.inc | 5 +- gosa-plugins/gofon/gofon/macro/main.inc | 23 ++++--- .../gofon/gofon/phoneaccount/main.inc | 18 +++-- gosa-plugins/goto/addons/goto/main.inc | 21 ++++-- gosa-plugins/goto/admin/applications/main.inc | 23 ++++--- gosa-plugins/goto/admin/devices/main.inc | 20 +++--- gosa-plugins/goto/admin/mimetypes/main.inc | 21 +++--- .../goto/personal/environment/main.inc | 20 +++--- .../ldapmanager/addons/ldapmanager/main.inc | 16 +++-- gosa-plugins/log/addons/logview/main.inc | 16 +++-- gosa-plugins/mail/addons/mailqueue/main.inc | 15 +++-- gosa-plugins/mail/personal/mail/main.inc | 23 +++---- gosa-plugins/nagios/personal/nagios/main.inc | 22 +++---- .../netatalk/personal/netatalk/main.inc | 19 +++--- gosa-plugins/samba/personal/samba/main.inc | 21 +++--- gosa-plugins/scalix/personal/scalix/main.inc | 20 +++--- gosa-plugins/sudo/admin/sudo/main.inc | 21 +++--- gosa-plugins/systems/admin/systems/main.inc | 21 +++--- 37 files changed, 429 insertions(+), 330 deletions(-) diff --git a/gosa-core/html/main.php b/gosa-core/html/main.php index f79abdad7..ed2b4ffa3 100644 --- a/gosa-core/html/main.php +++ b/gosa-core/html/main.php @@ -195,24 +195,29 @@ if (isset($_GET['plug']) && $plist->plugin_access_allowed($_GET['plug'])){ $plugin_dir= "$BASE_DIR/plugins/generic/welcome"; } -/* Check if we need to delete a lock */ -$cleanup = FALSE; +/* Handle plugin locks. + - Remove the plugin from session if we switched to another. (cleanup) + - Remove all created locks if "reset" was posted. + - Remove all created locks if we switched to another plugin. +*/ +$cleanup = FALSE; $remove_lock= FALSE; -if ($old_plugin_dir != $plugin_dir && $old_plugin_dir != "" || isset($_POST['delete_lock'])){ + +/* Check if we have changed the selected plugin +*/ +if($old_plugin_dir != $plugin_dir && $old_plugin_dir != ""){ if (is_file("$old_plugin_dir/main.inc")){ - if(isset($_POST['delete_lock'])){ - $remove_lock= TRUE; - } - if($old_plugin_dir != $plugin_dir && $old_plugin_dir != ""){ - $cleanup= TRUE; - } - $display = ""; - require_once ("$old_plugin_dir/main.inc"); - $display = ""; + $cleanup = $remove_lock = TRUE; + require ("$old_plugin_dir/main.inc"); + $cleanup = $remove_lock = FALSE; } +}else // elseif + +/* Reset was posted, remove all created locks for the current plugin +*/ +if((isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['delete_lock'])){ + $remove_lock = TRUE; } -$remove_lock= FALSE; -$cleanup= FALSE; /* Check for sizelimits */ eval_sizelimit(); @@ -326,12 +331,13 @@ if ($config->get_cfg_value("handleExpiredAccounts") == "true"){ /* Load plugin */ if (is_file("$plugin_dir/main.inc")){ + $display =""; require ("$plugin_dir/main.inc"); } else { msg_dialog::display( - _("Plugin"), - sprintf(_("FATAL: Cannot find any plugin definitions for plugin '%s'!"), $plug), - FATAL_ERROR_DIALOG); + _("Plugin"), + sprintf(_("FATAL: Cannot find any plugin definitions for plugin '%s'!"), $plug), + FATAL_ERROR_DIALOG); exit(); } diff --git a/gosa-core/plugins/admin/acl/main.inc b/gosa-core/plugins/admin/acl/main.inc index edfd23da3..8f55ab840 100644 --- a/gosa-core/plugins/admin/acl/main.inc +++ b/gosa-core/plugins/admin/acl/main.inc @@ -20,23 +20,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('macl'); +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('macl')){ + $macl = session::get('macl'); + $macl->remove_lock(); + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('macl'); +}else{ -if ($remove_lock){ - if(session::is_set('macl')){ - $macl = session::get('macl'); - $macl->remove_lock(); - } -} else { $display= "No headpage yet for this module"; /* Create usermanagement object on demand */ -if (!session::is_set('macl') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + if (!session::is_set('macl') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('macl',new aclManagement($config, $ui)); } $macl = session::get('macl'); diff --git a/gosa-core/plugins/admin/departments/main.inc b/gosa-core/plugins/admin/departments/main.inc index 35f451354..bd114694a 100644 --- a/gosa-core/plugins/admin/departments/main.inc +++ b/gosa-core/plugins/admin/departments/main.inc @@ -20,19 +20,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('department'); +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('department')){ + $macl = session::get('department'); + $macl->remove_lock(); + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('department'); +}else{ -if ($remove_lock){ - if(session::is_set('department')){ - $department = session::get('department'); - $department->remove_lock(); - } -} else { /* Create usermanagement object on demand */ if (!session::is_set('department') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('department',new departmentManagement($config, $ui)); diff --git a/gosa-core/plugins/admin/groups/main.inc b/gosa-core/plugins/admin/groups/main.inc index 4f9aaf72f..58af63689 100644 --- a/gosa-core/plugins/admin/groups/main.inc +++ b/gosa-core/plugins/admin/groups/main.inc @@ -20,19 +20,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('groupManagement'); -} - - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('groupManagement')){ - $groupManagement = session::get('groupManagement'); - $groupManagement->remove_lock(); + $macl = session::get('groupManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('groupManagement'); +}else{ + /* Create groupManagement object on demand */ if (!session::is_set('groupManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('groupManagement',new groupManagement ($config, $ui)); diff --git a/gosa-core/plugins/admin/ogroups/main.inc b/gosa-core/plugins/admin/ogroups/main.inc index 856adacff..ee523719c 100644 --- a/gosa-core/plugins/admin/ogroups/main.inc +++ b/gosa-core/plugins/admin/ogroups/main.inc @@ -20,23 +20,26 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('ogroup'); -} - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('ogroup')){ - $ogroup = session::get('ogroup'); - $ogroup->remove_lock(); + $macl = session::get('ogroup'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('ogroup'); +}else{ /* Create object object on demand */ if (!session::is_set('ogroup') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('ogroup',new ogroupManagement ($config)); + } $ogroup = session::get('ogroup'); diff --git a/gosa-core/plugins/admin/users/main.inc b/gosa-core/plugins/admin/users/main.inc index 05d3eddf9..94a5747c6 100644 --- a/gosa-core/plugins/admin/users/main.inc +++ b/gosa-core/plugins/admin/users/main.inc @@ -20,19 +20,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('userManagement'); -} - - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('userManagement')){ - $userManagement = session::get('userManagement'); - $userManagement->remove_lock(); + $macl = session::get('userManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('userManagement'); +}else{ + /* Create usermanagement object on demand */ if (!session::is_set('userManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-core/plugins/generic/welcome/main.inc b/gosa-core/plugins/generic/welcome/main.inc index c36520503..e501f71ae 100644 --- a/gosa-core/plugins/generic/welcome/main.inc +++ b/gosa-core/plugins/generic/welcome/main.inc @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -if (!$remove_lock){ +if (!$cleanup){ session::set('plugin_dir',dirname(__FILE__)); $smarty->assign("iconmenu", $plist->show_iconmenu()); $smarty->assign("header", print_header(get_template_path('images/welcome.png'), sprintf(_("Welcome %s!"), $ui->cn))); diff --git a/gosa-core/plugins/personal/generic/main.inc b/gosa-core/plugins/personal/generic/main.inc index 2f1376e61..c24dfa96c 100644 --- a/gosa-core/plugins/personal/generic/main.inc +++ b/gosa-core/plugins/personal/generic/main.inc @@ -20,21 +20,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Preset display */ -$display = ""; -$lock_msg = ""; +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('user') && session::is_set('edit')){ + del_lock($ui->dn); + } +} -/* Remove classes and variables from session - */ +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('user'); session::un_set('edit'); -} -if ( $remove_lock){ - if(session::is_set('user') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ /* Reset requested? */ diff --git a/gosa-core/plugins/personal/password/main.inc b/gosa-core/plugins/personal/password/main.inc index 9b5c981ca..b039a10f8 100644 --- a/gosa-core/plugins/personal/password/main.inc +++ b/gosa-core/plugins/personal/password/main.inc @@ -20,20 +20,26 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Clear display */ -$display= ""; +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('password')){ + //Nothing to do here + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('password'); session::un_set('edit'); -} - -if (!$remove_lock){ +}else{ /* Reset requested? */ if (isset($_POST['edit_cancel']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ - session::un_set ('edit'); session::un_set ('password'); } diff --git a/gosa-core/plugins/personal/posix/main.inc b/gosa-core/plugins/personal/posix/main.inc index 710d33a6c..7728f7317 100644 --- a/gosa-core/plugins/personal/posix/main.inc +++ b/gosa-core/plugins/personal/posix/main.inc @@ -20,21 +20,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Clear display */ -$display = ""; -$lock_msg = ""; -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('posixAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('posixAccount'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('posixAccount') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ diff --git a/gosa-plugins/addressbook/addons/addressbook/main.inc b/gosa-plugins/addressbook/addons/addressbook/main.inc index cffab3127..bf55ff3b9 100644 --- a/gosa-plugins/addressbook/addons/addressbook/main.inc +++ b/gosa-plugins/addressbook/addons/addressbook/main.inc @@ -22,9 +22,9 @@ */ if ( $cleanup ){ session::un_set('addressbook'); -} -if (!$remove_lock){ +}else{ + /* Create phonelist object on demand */ if (!session::is_set('addressbook') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $addressbook = new addressbook ($config); diff --git a/gosa-plugins/connectivity/personal/connectivity/main.inc b/gosa-plugins/connectivity/personal/connectivity/main.inc index e284a6114..f24d14a96 100644 --- a/gosa-plugins/connectivity/personal/connectivity/main.inc +++ b/gosa-plugins/connectivity/personal/connectivity/main.inc @@ -18,20 +18,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('connectivity') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('connectivity'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('connectivity') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ + /* Reset requested? */ if (isset($_POST['edit_cancel']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ @@ -47,7 +51,7 @@ if ( $remove_lock){ /* Create connectivity object on demand */ if (!session::is_set('connectivity') || (isset($_GET['reset']) && - $_GET['reset'] == 1)){ + $_GET['reset'] == 1)){ $connectivity= new connectivity ($config, $ui->dn); $connectivity->enable_CSN_check(); $connectivity->set_acl_base($ui->dn); @@ -104,33 +108,31 @@ if ( $remove_lock){ /* Execute formular */ $info= ""; - if(!isset($display)){ - $display= $connectivity->execute (); - - /* Store changes in session */ - if (session::is_set('edit')){ - session::set('connectivity',$connectivity); - } + $display= $connectivity->execute (); + /* Store changes in session */ + if (session::is_set('edit')){ + session::set('connectivity',$connectivity); + } - $display.="
"; - if (session::is_set('edit')){ - $display.= "\n"; - $display.= " "; - $display.= "\n"; - $info= "\"\" ".$ui->dn." "; - } else { - $info= "\"\" ".$ui->dn." "; - $info.= "\"\"".msgPool::clickEditToChange(); - $display.= "\n"; - $display.= "\n"; - } - $display.="
"; + $display.="
"; + if (session::is_set('edit')){ + $display.= "\n"; + $display.= " "; + $display.= "\n"; + $info= "\"\" ".$ui->dn." "; + } else { + $info= "\"\" ".$ui->dn." "; + + $info.= "\"\"".msgPool::clickEditToChange(); + $display.= "\n"; + $display.= "\n"; } + $display.="
"; /* Page header*/ $display= print_header(get_template_path($connectivity->plIcon), diff --git a/gosa-plugins/dak/addons/dak/main.inc b/gosa-plugins/dak/addons/dak/main.inc index 9efe18685..6be41ecc0 100644 --- a/gosa-plugins/dak/addons/dak/main.inc +++ b/gosa-plugins/dak/addons/dak/main.inc @@ -18,14 +18,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('dak_plug'); +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('dak_plug')){ + // Nothing to unlock here + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('dak_plug'); +}else{ -if (!$remove_lock){ if (!session::is_set('dak_plug') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('dak_plug',new dakplug($config)); } diff --git a/gosa-plugins/dfs/addons/godfs/main.inc b/gosa-plugins/dfs/addons/godfs/main.inc index b4047a662..5a38bc8da 100644 --- a/gosa-plugins/dfs/addons/godfs/main.inc +++ b/gosa-plugins/dfs/addons/godfs/main.inc @@ -1,23 +1,21 @@ remove_lock(); + } +} - -/* Remove classes and variables from session - */ +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('dfsManagment'); -} +}else{ - - if ($remove_lock) { - if (session::is_set('dfsManagment')) { - $dfsManagment = session::get('dfsManagment'); - $dfsManagment->remove_lock(); - del_lock($ui->dn); - session::un_set('dfsManagment'); - } - } else { # create dfsManagment object if (!session::is_set('dfsManagment') || (isset($_GET['reset']) && $_GET['reset'] == 1)) { diff --git a/gosa-plugins/fai/admin/fai/main.inc b/gosa-plugins/fai/admin/fai/main.inc index 7b3ffddd6..2b5128f94 100644 --- a/gosa-plugins/fai/admin/fai/main.inc +++ b/gosa-plugins/fai/admin/fai/main.inc @@ -18,19 +18,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('FAI'); + +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('FAI')){ + $macl = session::get('FAI'); + $macl->remove_lock(); + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('FAI'); +}else{ -if ($remove_lock){ - if(session::is_set('FAI')){ - $FAI = session::get('FAI'); - $FAI->remove_lock(); - } -} else { /* Create usermanagement object on demand */ if (!session::is_set('FAI') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $FAI= new faiManagement($config, $ui); diff --git a/gosa-plugins/gofax/gofax/blocklists/main.inc b/gosa-plugins/gofax/gofax/blocklists/main.inc index bc3f555f2..ebd93825f 100644 --- a/gosa-plugins/gofax/gofax/blocklists/main.inc +++ b/gosa-plugins/gofax/gofax/blocklists/main.inc @@ -1,18 +1,20 @@ remove_lock(); + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('blocklist'); +}else{ -if ($remove_lock){ - if(session::is_set('blocklist')){ - $blocklist = session::get('blocklist'); - $blocklist->remove_lock ($ui->dn); - } -} else { /* Create blocklist object on demand */ if (!session::is_set('blocklist') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $blocklist= new blocklist($config, $ui); diff --git a/gosa-plugins/gofax/gofax/faxaccount/main.inc b/gosa-plugins/gofax/gofax/faxaccount/main.inc index 8d4d3966d..2768a8b68 100644 --- a/gosa-plugins/gofax/gofax/faxaccount/main.inc +++ b/gosa-plugins/gofax/gofax/faxaccount/main.inc @@ -1,17 +1,19 @@ dn); + } +} -/* Remove classes and variables from session - */ +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('gofaxAccount'); - session::un_set ('edit'); -} - - -if (!$remove_lock){ + session::un_set('edit'); +}else{ /* Reset requested? */ if (isset($_POST['edit_cancel']) || diff --git a/gosa-plugins/gofax/gofax/faxreports/main.inc b/gosa-plugins/gofax/gofax/faxreports/main.inc index 89a2571ca..326ca61ee 100644 --- a/gosa-plugins/gofax/gofax/faxreports/main.inc +++ b/gosa-plugins/gofax/gofax/faxreports/main.inc @@ -4,10 +4,8 @@ */ if ( $cleanup ){ session::un_set('faxreport'); -} - +}else{ -if (!$remove_lock){ /* Create faxreport object on demand */ if (!session::is_set('faxreport') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('faxreport',new faxreport ($config, $ui)); diff --git a/gosa-plugins/gofon/gofon/conference/main.inc b/gosa-plugins/gofon/gofon/conference/main.inc index 59a61319e..1c313646c 100644 --- a/gosa-plugins/gofon/gofon/conference/main.inc +++ b/gosa-plugins/gofon/gofon/conference/main.inc @@ -18,19 +18,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg =""; +if ($remove_lock){ + if(session::is_set('conference')){ + $macl = session::get('conference'); + $macl->remove_lock(); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('conference'); -} +}else{ -if ($remove_lock){ - if(session::is_set('conference')){ - $conference = session::get('conference'); - $conference->remove_lock(); - } -} else { /* Create usermanagement object on demand */ if (!session::is_set('conference') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set("conference",new phoneConferenceManagment($config, $ui)); diff --git a/gosa-plugins/gofon/gofon/fonreports/main.inc b/gosa-plugins/gofon/gofon/fonreports/main.inc index eaf2d0c8a..150e7b592 100644 --- a/gosa-plugins/gofon/gofon/fonreports/main.inc +++ b/gosa-plugins/gofon/gofon/fonreports/main.inc @@ -2,12 +2,11 @@ /* Remove classes and variables from session */ +$lock_msg =""; if ( $cleanup ){ session::un_set('fonreport'); -} - +}else{ -if (!$remove_lock){ /* Create fonreport object on demand */ if (!session::is_set('fonreport') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('fonreport',new fonreport ($config, $ui)); diff --git a/gosa-plugins/gofon/gofon/macro/main.inc b/gosa-plugins/gofon/gofon/macro/main.inc index 8c7b128fc..75ef984cd 100644 --- a/gosa-plugins/gofon/gofon/macro/main.inc +++ b/gosa-plugins/gofon/gofon/macro/main.inc @@ -18,19 +18,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('macroManagement'); -} - - +/* Remove locks created by this plugin +*/ +$lock_msg =""; if ($remove_lock){ if(session::is_set('macroManagement')){ - $macroManagement = session::get('macroManagement'); - $macroManagement->remove_lock(); + $macl = session::get('macroManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('macroManagement'); +}else{ + /* Create macroManagement object on demand */ if (!session::is_set('macroManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/gofon/gofon/phoneaccount/main.inc b/gosa-plugins/gofon/gofon/phoneaccount/main.inc index 3c52005be..c7d750814 100644 --- a/gosa-plugins/gofon/gofon/phoneaccount/main.inc +++ b/gosa-plugins/gofon/gofon/phoneaccount/main.inc @@ -18,17 +18,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$display = ""; -$lock_msg = ""; +/* Remove locks created by this plugin +*/ +$lock_msg =""; +if ($remove_lock){ + if(session::is_set('phoneAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} -/* Remove classes and variables from session - */ +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('phoneAccount'); -} + session::un_set('edit'); +}else{ -if (!$remove_lock){ /* Reset requested? */ if (isset($_POST['edit_cancel']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/goto/addons/goto/main.inc b/gosa-plugins/goto/addons/goto/main.inc index e61909a97..106a8abe8 100644 --- a/gosa-plugins/goto/addons/goto/main.inc +++ b/gosa-plugins/goto/addons/goto/main.inc @@ -20,17 +20,26 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('gotomasses'); + +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('gotomasses')){ + // Nothing to unlock here + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('gotomasses'); +}else{ -if (!$remove_lock){ /* Create gotomasses object on demand */ - if (!session::is_set('gotomasses') || (isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['reload_gotomass_data'])){ + if (!session::is_set('gotomasses') + || (isset($_GET['reset']) && $_GET['reset'] == 1) + || isset($_POST['reload_gotomass_data'])){ $gotomasses= new gotomasses ($config); $gotomasses->set_acl_category("gotomasses"); diff --git a/gosa-plugins/goto/admin/applications/main.inc b/gosa-plugins/goto/admin/applications/main.inc index 81e3abc5c..d61f42c63 100644 --- a/gosa-plugins/goto/admin/applications/main.inc +++ b/gosa-plugins/goto/admin/applications/main.inc @@ -18,18 +18,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ + +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('applicationManagement')){ + $macl = session::get('applicationManagement'); + $macl->remove_lock(); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('applicationManagement'); -} +}else{ + -if ($remove_lock){ - if(session::is_set('applicationManagement')){ - $applicationManagement = session::get('applicationManagement'); - $applicationManagement->remove_lock(); - } -} else { /* Create applicationManagement object on demand */ if (!session::is_set('applicationManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('applicationManagement',new applicationManagement ($config, $ui)); diff --git a/gosa-plugins/goto/admin/devices/main.inc b/gosa-plugins/goto/admin/devices/main.inc index 348808529..88f0c2138 100644 --- a/gosa-plugins/goto/admin/devices/main.inc +++ b/gosa-plugins/goto/admin/devices/main.inc @@ -18,19 +18,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('DeviceManagement'); -} - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('DeviceManagement')){ - $DeviceManagement = session::get('DeviceManagement'); - $DeviceManagement->remove_lock(); + $macl = session::get('DeviceManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('DeviceManagement'); +}else{ /* Create DeviceManagement object on demand */ if (!session::is_set('DeviceManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/goto/admin/mimetypes/main.inc b/gosa-plugins/goto/admin/mimetypes/main.inc index cb55e1fa4..81e04da3b 100644 --- a/gosa-plugins/goto/admin/mimetypes/main.inc +++ b/gosa-plugins/goto/admin/mimetypes/main.inc @@ -18,19 +18,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('MimeTypeManagement'); -} - - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('MimeTypeManagement')){ - $MimeTypeManagement = session::get('MimeTypeManagement'); - $MimeTypeManagement->remove_lock(); + $macl = session::get('MimeTypeManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('MimeTypeManagement'); +}else{ /* Create MimeTypeManagement object on demand */ if (!session::is_set('MimeTypeManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/goto/personal/environment/main.inc b/gosa-plugins/goto/personal/environment/main.inc index 094ffd70f..0b0e24f3f 100644 --- a/gosa-plugins/goto/personal/environment/main.inc +++ b/gosa-plugins/goto/personal/environment/main.inc @@ -17,19 +17,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$lock_msg = ""; -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('environment') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('environment'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('environment') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ diff --git a/gosa-plugins/ldapmanager/addons/ldapmanager/main.inc b/gosa-plugins/ldapmanager/addons/ldapmanager/main.inc index 0c7904b39..3a8f4a26e 100644 --- a/gosa-plugins/ldapmanager/addons/ldapmanager/main.inc +++ b/gosa-plugins/ldapmanager/addons/ldapmanager/main.inc @@ -19,13 +19,21 @@ */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('ldif')){ + // Nothing to unlock here + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('ldif'); -} +}else{ + -if (!$remove_lock){ /* Create phonelist object on demand */ if (!session::is_set('ldif') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $ldif= new ldif ($config); diff --git a/gosa-plugins/log/addons/logview/main.inc b/gosa-plugins/log/addons/logview/main.inc index b42b0f6c7..47bd09632 100644 --- a/gosa-plugins/log/addons/logview/main.inc +++ b/gosa-plugins/log/addons/logview/main.inc @@ -19,14 +19,20 @@ */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('log_tabs'); +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('log_tabs')){ + // Nothing to unlock here + } } +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('log_tabs'); +}else{ -if (!$remove_lock){ /* Create logview object on demand */ if (!session::is_set('log_tabs') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/mail/addons/mailqueue/main.inc b/gosa-plugins/mail/addons/mailqueue/main.inc index c3cd34ca8..df6784d38 100644 --- a/gosa-plugins/mail/addons/mailqueue/main.inc +++ b/gosa-plugins/mail/addons/mailqueue/main.inc @@ -18,13 +18,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('mailqueue')){ + // Nothing to unlock here + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('mailqueue'); -} +}else{ -if (!$remove_lock){ /* Create mailqueue object on demand */ if (!session::is_set('mailqueue') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $ui = get_userinfo(); diff --git a/gosa-plugins/mail/personal/mail/main.inc b/gosa-plugins/mail/personal/mail/main.inc index 80957462b..b8fe96a5d 100644 --- a/gosa-plugins/mail/personal/mail/main.inc +++ b/gosa-plugins/mail/personal/mail/main.inc @@ -18,24 +18,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$lock_msg =""; -$display =""; -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('mailAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('mailAccount'); session::un_set('edit'); -} - - -if ( $remove_lock){ - if(session::is_set('mailAccount') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ + /* Reset requested? */ if (isset($_POST['edit_cancel']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/nagios/personal/nagios/main.inc b/gosa-plugins/nagios/personal/nagios/main.inc index bcb8fccc7..49cc58396 100644 --- a/gosa-plugins/nagios/personal/nagios/main.inc +++ b/gosa-plugins/nagios/personal/nagios/main.inc @@ -18,21 +18,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$display = ""; -$lock_msg = ""; -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('nagiosAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('nagiosAccount'); session::un_set('edit'); -} - - -if ( $remove_lock){ - if(session::is_set('nagiosAccount') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ diff --git a/gosa-plugins/netatalk/personal/netatalk/main.inc b/gosa-plugins/netatalk/personal/netatalk/main.inc index ec3989688..c1f06c88d 100644 --- a/gosa-plugins/netatalk/personal/netatalk/main.inc +++ b/gosa-plugins/netatalk/personal/netatalk/main.inc @@ -19,19 +19,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$lock_msg = ""; +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('netatalk') && session::is_set('edit')){ + del_lock($ui->dn); + } +} -/* Remove classes and variables from session - */ +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('netatalk'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('netatalk') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ diff --git a/gosa-plugins/samba/personal/samba/main.inc b/gosa-plugins/samba/personal/samba/main.inc index 9067f2107..e4e211304 100644 --- a/gosa-plugins/samba/personal/samba/main.inc +++ b/gosa-plugins/samba/personal/samba/main.inc @@ -18,20 +18,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$display = ""; -$lock_msg = ""; -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('sambaAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('sambaAccount'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('sambaAccount') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ diff --git a/gosa-plugins/scalix/personal/scalix/main.inc b/gosa-plugins/scalix/personal/scalix/main.inc index d0ee2b973..03a92ec20 100644 --- a/gosa-plugins/scalix/personal/scalix/main.inc +++ b/gosa-plugins/scalix/personal/scalix/main.inc @@ -19,20 +19,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +$lock_msg=""; +if ($remove_lock){ + if(session::is_set('scalixAccount') && session::is_set('edit')){ + del_lock($ui->dn); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('scalixAccount'); session::un_set('edit'); -} - -if ( $remove_lock){ - if(session::is_set('scalixAccount') && session::is_set('edit')){ - del_lock ($ui->dn); - } }else{ + /* Reset requested? */ if (isset($_POST['edit_cancel']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ diff --git a/gosa-plugins/sudo/admin/sudo/main.inc b/gosa-plugins/sudo/admin/sudo/main.inc index 11096e0ea..d5177179f 100644 --- a/gosa-plugins/sudo/admin/sudo/main.inc +++ b/gosa-plugins/sudo/admin/sudo/main.inc @@ -20,19 +20,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ -if ( $cleanup ){ - session::un_set('sudoManagement'); -} - +/* Remove locks created by this plugin +*/ if ($remove_lock){ if(session::is_set('sudoManagement')){ - $sudoManagement = session::get('sudoManagement'); - $sudoManagement->remove_lock(); + $macl = session::get('sudoManagement'); + $macl->remove_lock(); } -} else { +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('sudoManagement'); +}else{ + /* Create sudoManagement object on demand */ if (!session::is_set('sudoManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('sudoManagement',new sudoManagement ($config, $ui)); diff --git a/gosa-plugins/systems/admin/systems/main.inc b/gosa-plugins/systems/admin/systems/main.inc index 90bc586dc..2e771f5a0 100644 --- a/gosa-plugins/systems/admin/systems/main.inc +++ b/gosa-plugins/systems/admin/systems/main.inc @@ -20,19 +20,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Remove classes and variables from session - */ +/* Remove locks created by this plugin +*/ +if ($remove_lock){ + if(session::is_set('systems')){ + $macl = session::get('systems'); + $macl->remove_lock(); + } +} + +/* Remove this plugin from session +*/ if ( $cleanup ){ session::un_set('systems'); -} +}else{ -if ($remove_lock){ - if(session::is_set('systems')){ - $systems = session::get('systems'); - $systems->remove_lock(); - } -} else { /* Create usermanagement object on demand */ if (!session::is_set('systems') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ session::set('systems',new systems($config, $ui)); -- 2.30.2