From: cajus Date: Thu, 17 Jan 2008 14:29:47 +0000 (+0000) Subject: Moved plugins X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=67e60642851cfecbb7c87db106750052c575ffa2;p=gosa.git Moved plugins git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8464 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/connectivity/openxchange/class_oxchangeAccount.inc b/gosa-core/plugins/personal/connectivity/openxchange/class_oxchangeAccount.inc deleted file mode 100644 index 6561ab14c..000000000 --- a/gosa-core/plugins/personal/connectivity/openxchange/class_oxchangeAccount.inc +++ /dev/null @@ -1,976 +0,0 @@ -config->data['TABS']['CONNECTIVITY']);$i++){ - if($this->config->data['TABS']['CONNECTIVITY'][$i]['CLASS']=='oxchangeAccount') { - $this->oxconf=$this->config->data['TABS']['CONNECTIVITY'][$i]; - break; - } - } - - /* Setting uid to default */ - if(isset($this->attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - - $this->dnmode= $this->config->current['DNMODE']; - if(isset($this->attrs[$this->dnmode][0])){ - $this->dnModeValue = $this->attrs[$this->dnmode][0]; - } - } - - function execute() - { - /* Call parent execute */ - //plugin::execute(); - - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - $display=""; - - /* Show main page */ - $smarty= get_smarty(); - - if (function_exists("pg_connect")){ - $smarty->assign("pg", true); - }else{ - $smarty->assign("pg", false); - } - - /* Load attributes */ - foreach($this->attributes as $val){ - $smarty->assign("$val", $this->$val); - } - if ($this->is_account){ - $smarty->assign("oxchangeState", "checked"); - $smarty->assign("oxState", ""); - } else { - $smarty->assign("oxchangeState", ""); - $smarty->assign("oxState", "disabled"); - } - - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $key => $desc){ - $smarty->assign($key."ACL",$this->getacl($key,$this->ReadOnly)); - $smarty->assign($key."_W",$this->acl_is_writeable($key)); - } - - if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){ - $smarty->assign('oxchangeAccountACL', ""); - }else{ - $smarty->assign('oxchangeAccountACL', " disabled "); - } - - $smarty->assign("timezones", $this->timezones); - - - if ($this->parent !== NULL){ - $smarty->assign("tabbed", 1); - }else{ - $smarty->assign("tabbed", 0); - } - - /* Trying to open a Postgresql Database Server */ - if (function_exists("pg_connect")){ - if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){ - $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); - if (! $pgcon){ - $smarty->assign("pg", false); - } - }else{ - $smarty->assign("pg", false); - } - }else{ - $smarty->assign("pg", false); - } - - $display.= $smarty->fetch (get_template_path('oxchange.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - if(!$this->acl_is_removeable()) return; - $this->attrs[$this->dnmode][0] = $this->dnModeValue; - $sqldeluser=array( - "delete from prg_notes where (user_right like '".$this->attrs[$this->dnmode][0]."') and (group_right like 's')", - "delete from prg_documents_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_documents_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_docufolders_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_docufolders_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_date_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_date_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_dates_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_knowledge_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_knowledge_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_knowledge_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_knowledge_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_pin_board_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_pin_board_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_bookmarks_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_bookmarks_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_bookmarks_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_bookmarks_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_tasks_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_tasks_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_tasks_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_projects_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_projects_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from prg_projects_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", - "delete from oxfolder_permissions where (entity like '".$this->attrs[$this->dnmode][0]."') AND ((role = 256) OR (role = 1024))", - "delete from oxfolder_standardfolders where owner like '".$this->attrs[$this->dnmode][0]."'", - "delete from prg_forum_read where user_right = '".$this->attrs[$this->dnmode][0]."'", - "delete from prg_forum_mod where user_right = '".$this->attrs[$this->dnmode][0]."'", - "delete from prg_forum_abo where user_right = '".$this->attrs[$this->dnmode][0]."'", - "delete from prg_forum_seen where username = '".$this->attrs[$this->dnmode][0]."'", - "delete from sys_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')", - "delete from usr_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')"); - - /* Trying to open a Postgresql Database Server */ - if (function_exists("pg_connect")){ - if(isset($this->oxconf["PGUSER"]) and - isset($this->oxconf["PGHOST"]) and - isset($this->oxconf["PGDBNAME"]) and - isset($this->oxconf["PGPASSWD"])){ - $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); - if (! $pgcon){ - msg_dialog::display(_("Error"), sprintf(_("Cannot connect to %s database!"), "Open-Xchange"), ERROR_DIALOG); - return; - } - }else{ - msg_dialog::display(_("Configuration error"), sprintf(_("%s database configuration is missing!"), "Open-Xchange"), ERROR_DIALOG); - return; - } - }else{ - msg_dialog::display(_("Configuration error"), sprintf(_("Missing %s PHP extension!"), "postgresql"), ERROR_DIALOG); - return; - } - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - if($ldap->dn_exists("ou=addr,".$this->dn)){ - $ldap->rmdir_recursive("ou=addr,".$this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn)); - } - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->postremove(array("uid" => $this->uid)); - - /* Finally remove data from postgresql server */ - foreach ($sqldeluser as $sqls){ - @pg_exec($pgcon,$sqls); - } - pg_close(); - } - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['oxchange'])){ - if (!$this->is_account && $_POST['oxchange'] == "B") { - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - /* Get objects */ - foreach(array("OXTimeZone","OXTaskDays","OXAppointmentDays") as $name) { - if($this->acl_is_writeable($name) && isset($_POST[$name])){ - $this->$name = $_POST[$name]; - } - } - - if (isset($_POST["oxchangeStatus"])){ - $this->oxchangeStatus = "disabled"; - } else { - $this->oxchangeStatus = "enabled"; - } - } - - - /* Save to LDAP */ - function save() - { - - $needupdate=TRUE; - $istemplate=FALSE; - - /*First at all, we must check if this is new or is updated */ - /*Also check is we have a template, if is a template, is a new user */ - if (isset($this->attrs['objectClass'])){ - foreach ($this->attrs['objectClass'] as $object){ - if($object=="OXUserObject") $needupdate=FALSE; - if($object=="gosaUserTemplate") $istemplate=TRUE; - } - } - - $uidarray=array(); - preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray); - $uid=$uidarray[2]; - if (trim($uid) == "") { - msg_dialog::display(_("Error"), _("Open-Xchange account name is invalid!"), ERROR_DIALOG); - return; - } - - if ($istemplate) $needupdate=TRUE; - - if($needupdate){ - /* Trying to open a Postgresql Database Server */ - if (function_exists("pg_connect")){ - if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){ - $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); - if (! $pgcon){ - msg::display(_("Error"), sprintf(_("Cannot connect to %s database!"), "Open-Xchange"), ERROR_DIALOG); - return; - } - }else{ - msg_dialog::display(_("Configuration error"), sprintf(_("%s database configuration is missing!"), "Open-Xchange"), ERROR_DIALOG); - return; - } - }else{ - msg_dialog::display(_("Configuration error"), sprintf(_("Missing %s PHP extension!"), "postgresql"), ERROR_DIALOG); - return; - } - } - - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->postcreate(array("uid" => $this->uid)); - - if($needupdate){ - $ldap->create_missing_trees("ou=addr,".$this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Creating of user/oxchange account with dn '%s' failed."),$this->dn)); - /* Finally save data to postgresql server */ - pg_set_client_encoding ("UNICODE"); - $nv = "SELECT nextval ('serial_id')"; - $ot = "insert into oxfolder_tree (fuid, parent, fname, module, type, owner, creator, creating_date, created_from, changing_date, changed_from) VALUES (%d, 1, '%s', '%s', 'private', '%s', '%s', 'now', 'System', 'now', 'System')"; - $op = "INSERT INTO oxfolder_permissions (puid, pid, role, entity, sealed, fp, orp, owp, odp) VALUES (%d, %d, 32768, '%s', 0, 128, 128, 128, 128)"; - $os = "insert into oxfolder_standardfolders (owner,module_calendar,module_contact,module_task) VALUES ('%s',%d,%d,%d)"; - $ugr= "INSERT INTO usr_general_rights SELECT creating_date, created_from, changing_date, changed_from,text('%s'), addr_u, addr_r, addr_d, cont_u, cont_r, cont_d, data_u, data_r, data_d, serie_u, serie_r, serie_d, task_u, task_r, task_d, refer, proj_u, proj_r, proj_d, dfolder_u, dfolder_r, dfolder_d, doc_u, doc_r, doc_d, knowl_u, knowl_r, knowl_d, bfolder_u, bfolder_r, bfolder_d, bookm_u, bookm_r, bookm_d, pin_u, pin_r, pin_d, forum_n, fentrie_n, setup, pin_public, internal, int_groups, kfolder_u, kfolder_r, kfolder_d, webmail FROM sys_gen_rights_template WHERE login LIKE 'default_template'"; - - $error = FALSE; - $res=@pg_exec($pgcon,$nv); - - if(!$res){ - $error = TRUE; - }else{ - $calendarid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($ot,$calendarid[0],'My Appointments','calendar',$uid,$uid); - @pg_exec($pgcon,$q); - } - - $res=@pg_exec($pgcon,$nv); - - if(!$res){ - $error = TRUE; - }else{ - $nid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($op,$nid[0],$calendarid[0],$uid); - @pg_exec($pgcon,$q); - } - - $res=@pg_exec($pgcon,$nv); - if(!$res){ - $error = TRUE; - }else{ - $contactsid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($ot,$contactsid[0],'My Contacts','contact',$uid,$uid); - @pg_exec($pgcon,$q); - } - - $res=@pg_exec($pgcon,$nv); - if(!$res){ - $error = TRUE; - }else{ - $nid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($op,$nid[0],$contactsid[0],$uid); - @pg_exec($pgcon,$q); - } - - $res=@pg_exec($pgcon,$nv); - if(!$res){ - $error = TRUE; - }else{ - $tasksid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($ot,$tasksid[0],'My Tasks','task',$uid,$uid); - @pg_exec($pgcon,$q); - } - - $res=@pg_exec($pgcon,$nv); - if(!$res){ - $error = TRUE; - }else{ - $nid=pg_fetch_row($res); - pg_freeresult($res); - - $q=sprintf($op,$nid[0],$tasksid[0],$uid); - @pg_exec($pgcon,$q); - - $q=sprintf($os,$uid,$calendarid[0],$contactsid[0],$tasksid[0]); - @pg_exec($pgcon,$q); - - $q=sprintf($ugr,$uid); - @pg_exec($pgcon,$q); - } - - @pg_close($pgcon); - - if($error){ - msg_dialog::display(_("Error"), _("Cannot save Open-Xchange account!"), ERROR_DIALOG); - } - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Open-Xchange"), - "plDescription" => _("Open-Xchange account settings")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 27, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array( - "OXAppointmentDays" => _("OXAppointmentDays"), - "OXTaskDays" => _("OXTaskDays"), - "OXTimeZone" => _("OXTimeZone")) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/openxchange/oxchange.tpl b/gosa-core/plugins/personal/connectivity/openxchange/oxchange.tpl deleted file mode 100644 index 2bd204907..000000000 --- a/gosa-core/plugins/personal/connectivity/openxchange/oxchange.tpl +++ /dev/null @@ -1,84 +0,0 @@ -{if !$pg} -

{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected. Or the specified database can't be reached{/t}

-{else} -

- -{t}Open-Xchange account{/t}

- - - - - - - - - - -
- - - - - - - - - - - - -
- {t}Remember{/t} -
- -{render acl=$OXAppointmentDaysACL} - -{/render} - {t}days{/t}
- -{render acl=$OXTaskDaysACL} - -{/render} - - {t}days{/t} -
-
-   - - - - - - - - - - - - - -
- {t}User Information{/t} -
- -{render acl=$OXTimeZoneACL} - -{/render} - -
-
-{/if} diff --git a/gosa-core/plugins/personal/connectivity/phpgw/class_phpgwAccount.inc b/gosa-core/plugins/personal/connectivity/phpgw/class_phpgwAccount.inc deleted file mode 100644 index 0e2ac36b1..000000000 --- a/gosa-core/plugins/personal/connectivity/phpgw/class_phpgwAccount.inc +++ /dev/null @@ -1,222 +0,0 @@ -attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - } - - function execute() - { - /* Call parent execute */ -// plugin::execute(); - - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - /* Show tab dialog headers */ - $display= ""; - - /* Show main page */ - $smarty= get_smarty(); - - /* Load attributes */ - foreach($this->attributes as $val){ - $smarty->assign("$val", $this->$val); - } - if ($this->is_account){ - $smarty->assign("phpgwState", "checked"); - } else { - $smarty->assign("phpgwState", ""); - } - - $smarty->assign('phpgwAccountACL', $this->getacl("",$this->ReadOnly)); - $smarty->assign("multiple_support",$this->multiple_support_active); - $smarty->assign("use_phpgw",in_array("phpgw",$this->multi_boxes)); - $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - if($this->acl_is_removeable()){ - /* Cancel if there's nothing to do here */ - if (!$this->initially_was_account){ - return; - } - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn)); - - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove',array("uid" => $this->uid)); - } - } - - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['phpgw'])){ - if (!$this->is_account && $_POST['phpgw'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - plugin::save_object(); - if (isset($_POST["phpgwStatus"])){ - $this->phpgwStatus = "disabled"; - } else { - $this->phpgwStatus = "enabled"; - } - } - - - /* Save to LDAP */ - function save() - { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPgw account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("PHP GW"), - "plDescription" => _("PHP GW account settings")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 24, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array() - )); - } - - - function multiple_save_object() - { - if (isset($_POST['connectivityTab'])){ - plugin::multiple_save_object(); - - /* Do we need to flip is_account state? */ - if(isset($_POST['use_phpgw'])){ - $this->multi_boxes[] = "phpgw"; - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['phpgw'])){ - if (!$this->is_account && $_POST['phpgw'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - } - } - } - - function get_multi_edit_values() - { - $ret = plugin::get_multi_edit_values(); - if(in_array("phpgw",$this->multi_boxes)){ - $ret['is_account'] = $this->is_account; - } - return($ret); - } - - function set_multi_edit_values($values) - { - plugin::set_multi_edit_values($values); - if(isset($values['is_account'])){ - $this->is_account = $values['is_account']; - } - } - - function init_multiple_support($attrs,$all) - { - plugin::init_multiple_support($attrs,$all); - if(isset($attrs['objectClass']) && in_array("phpgwAccount",$attrs['objectClass'])){ - $this->is_account = TRUE; - } - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/phpgw/phpgw.tpl b/gosa-core/plugins/personal/connectivity/phpgw/phpgw.tpl deleted file mode 100644 index a63cddaa2..000000000 --- a/gosa-core/plugins/personal/connectivity/phpgw/phpgw.tpl +++ /dev/null @@ -1,7 +0,0 @@ -

-{render acl=$phpgwAccountACL checkbox=$multiple_support checked=$use_phpgw} - -{/render} - {t}PHPGroupware account{/t} - -

diff --git a/gosa-core/plugins/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc b/gosa-core/plugins/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc deleted file mode 100644 index 41454ea7c..000000000 --- a/gosa-core/plugins/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc +++ /dev/null @@ -1,175 +0,0 @@ -is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - /* Show tab dialog headers */ - $display= ""; - - /* Show main page */ - $smarty= get_smarty(); - - if ($this->is_account){ - $smarty->assign("phpscheduleitState", "checked"); - } else { - $smarty->assign("phpscheduleitState", ""); - $smarty->assign("wstate", "disabled"); - } - - if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) { - $smarty->assign('gosaphpscheduleitACL', ""); - }else{ - $smarty->assign('gosaphpscheduleitACL', " disabled "); - } - - $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - /* Cancel if there's nothing to do here */ - if ($this->acl_is_removeable()){ - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); - - if($this->is_account){ - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove',array("uid" => $this->uid)); - } - } - - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['phpscheduleit'])){ - if (!$this->is_account && $_POST['phpscheduleit'] == "B"){ - if($this->acl_is_createable()) { - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - plugin::save_object(); - if (isset($_POST["phpscheduleitStatus"])){ - $this->pptpStatus = "disabled"; - } else { - $this->pptpStatus = "enabled"; - } - } - - - /* Save to LDAP */ - function save() - { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - - } - - - /* Return plugin informations for acl handling - #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */ - static function plInfo() - { - return (array( - "plShortName" => _("PHP Schedule it"), - "plDescription" => _("PHP Schedule it settings")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 29, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - - "plOptions" => array(), - - "plProvidedAcls" => array() - )); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/phpscheduleit/phpscheduleit.tpl b/gosa-core/plugins/personal/connectivity/phpscheduleit/phpscheduleit.tpl deleted file mode 100644 index 7e5510c3f..000000000 --- a/gosa-core/plugins/personal/connectivity/phpscheduleit/phpscheduleit.tpl +++ /dev/null @@ -1,4 +0,0 @@ -

- - {t}PHPscheduleit account{/t} -

diff --git a/gosa-core/plugins/personal/connectivity/pptp/class_pptpAccount.inc b/gosa-core/plugins/personal/connectivity/pptp/class_pptpAccount.inc deleted file mode 100644 index 0c8c659cf..000000000 --- a/gosa-core/plugins/personal/connectivity/pptp/class_pptpAccount.inc +++ /dev/null @@ -1,188 +0,0 @@ -attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - } - - function execute() - { - /* Call parent execute */ - // plugin::execute(); - - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - /* Show tab dialog headers */ - $display= ""; - - /* Show main page */ - $smarty= get_smarty(); - - if ($this->is_account){ - $smarty->assign("pptpState", "checked"); - } else { - $smarty->assign("pptpState", ""); - $smarty->assign("wstate", "disabled"); - } - - if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) { - $smarty->assign('gosapptpACL', ""); - }else{ - $smarty->assign('gosapptpACL', " disabled "); - } - - $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - if($this->acl_is_removeable()){ - /* Cancel if there's nothing to do here */ - if (!$this->initially_was_account){ - return; - } - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PPTP account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove',array("uid" => $this->uid)); - } - } - - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['pptp'])){ - if (!$this->is_account && $_POST['pptp'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - plugin::save_object(); - if (isset($_POST["pptpStatus"])){ - $this->pptpStatus = "disabled"; - } else { - $this->pptpStatus = "enabled"; - } - } - - - /* Save to LDAP */ - function save() - { - if($this->acl_is_createable()){ - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PPTP account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("PPTP"), - "plDescription" => _("PPTP account")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 28, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array() - )); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/pptp/pptp.tpl b/gosa-core/plugins/personal/connectivity/pptp/pptp.tpl deleted file mode 100644 index 15d28a792..000000000 --- a/gosa-core/plugins/personal/connectivity/pptp/pptp.tpl +++ /dev/null @@ -1,4 +0,0 @@ -

- - {t}PPTP account{/t} -

diff --git a/gosa-core/plugins/personal/connectivity/pureftpd/class_pureftpdAccount.inc b/gosa-core/plugins/personal/connectivity/pureftpd/class_pureftpdAccount.inc deleted file mode 100644 index ad2cba40b..000000000 --- a/gosa-core/plugins/personal/connectivity/pureftpd/class_pureftpdAccount.inc +++ /dev/null @@ -1,323 +0,0 @@ -attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - } - - function execute() - { - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - /* Show tab dialog headers */ - $display= ""; - - /* Show main page */ - $smarty= get_smarty(); - - /* Load attributes */ - foreach($this->attributes as $val){ - $smarty->assign("$val", $this->$val); - } - - - $tmp = $this->plInfo(); - $changeState = ""; - if($this->multiple_support_active){ - - /* We do not need the attribute grey out in multiple edit */ - foreach($tmp['plProvidedAcls'] as $key => $desc){ - $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); - } - if ($this->is_account){ - $smarty->assign("pureftpdState", "checked"); - }else{ - $smarty->assign("pureftpdState", ""); - } - $smarty->assign("fstate", ""); - $smarty->assign("changeState",""); - - }else{ - foreach($tmp['plProvidedAcls'] as $key => $desc){ - $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); - $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly)); - - if($this->acl_is_writeable($key)){ - $changeState.= " changeState('".$key."'); \n"; - } - } - $smarty->assign("changeState",$changeState); - - - $smarty->assign("fstate", ""); - if ($this->is_account){ - $smarty->assign("pureftpdState", "checked"); - $smarty->assign("fstate", ""); - } else { - $smarty->assign("pureftpdState", ""); - if(session::get('js')==1){ - if($this->acl!="#none#") - $smarty->assign("fstate", "disabled"); - }else{ - $smarty->assign("fstate", ""); - } - } - } - - foreach($this->attributes as $attr){ - if(in_array($attr,$this->multi_boxes)){ - $smarty->assign("use_".$attr,TRUE); - }else{ - $smarty->assign("use_".$attr,FALSE); - } - } - $smarty->assign("use_pureftpd",in_array("pureftpd",$this->multi_boxes)); - $smarty->assign("multiple_support",$this->multiple_support_active); - $smarty->assign("FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : ""); - $smarty->assign('pureftpdACL', $this->getacl("",$this->ReadOnly)); - $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - /* Cancel if there's nothing to do here */ - if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){ - return; - } - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/pureftpd account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove',array("uid" => $this->uid)); - } - - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['pureftpd'])){ - if (!$this->is_account && $_POST['pureftpd'] == "B"){ - $this->is_account= TRUE; - } - } else { - $this->is_account= FALSE; - } - - plugin::save_object(); - - $old= $this->FTPStatus; - if (isset($_POST["FTPStatus"])){ - $this->FTPStatus = "disabled"; - } else { - $this->FTPStatus = "enabled"; - } - $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified; - - /* Ensure that these vars are numeric. Values starting with 0 like '0123' cause ldap errors */ - foreach(array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio","FTPUploadBandwidth","FTPDownloadBandwidth") as $testVar){ - $this->$testVar = (int) ($this->$testVar); - } - - - } - } - - - /* Check values */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - /* Check for positive integer values */ - if ($this->is_account){ - - if($this->acl_is_writeable("FTPUploadBandwidth") && !tests::is_id($this->FTPUploadBandwidth)){ - $message[]= _("Value specified as 'Upload bandwidth' is not valid."); - } - if($this->acl_is_writeable("FTPDownloadBandwidth") && !tests::is_id($this->FTPDownloadBandwidth)){ - $message[]= _("Value specified as 'Download bandwidth' is not valid."); - } - - if($this->acl_is_writeable("FTPQuotaFiles") && !tests::is_id($this->FTPQuotaFiles)){ - $message[]= _("Value specified as 'Quota files' is not valid."); - } - if($this->acl_is_writeable("FTPQuotaMBytes") && !tests::is_id($this->FTPQuotaMBytes)){ - $message[]= _("Value specified as 'Quota size' is not valid."); - } - if($this->acl_is_writeable("FTPUploadRatio") && !tests::is_id($this->FTPUploadRatio)){ - $message[]= _("Value specified as 'Upload ratio' is not valid."); - } - if($this->acl_is_writeable("FTPDownloadRatio") && !tests::is_id($this->FTPDownloadRatio)){ - $message[]= _("Value specified as 'Download ratio' is not valid."); - } - } - - return $message; - } - - - /* Save to LDAP */ - function save() - { - plugin::save(); - - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $key => $desc){ - if(!$this->acl_is_writeable($key)){ - unset($this->attrs[$key]); - } - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - - } - - - /* Return plugin informations for acl handling - #FIME There possibly some attributes that can be combined to one acl. */ - static function plInfo() - { - return (array( - "plShortName" => _("Ftp"), - "plDescription" => _("Pure ftp account")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 22, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array( - "FTPQuotaFiles" => _("Quota files"), - "FTPUploadRatio" => _("Upload ratio"), - "FTPQuotaMBytes" => _("Quota MBytes"), - "FTPDownloadRatio" => _("Download ratio"), - "FTPUploadBandwidth" => _("Upload bandwith"), - "FTPDownloadBandwidth" => _("Download bandwith"), - "FTPStatus" => _("Status")) - )); - } - - function multiple_save_object() - { - if (isset($_POST['connectivityTab'])){ - plugin::multiple_save_object(); - if(isset($_POST['use_pureftpd'])){ - $this->multi_boxes[] = "pureftpd"; - } - $this->save_object(); - } - } - - function get_multi_init_values() - { - $ret = plugin::get_multi_init_values(); - $ret['is_account'] = $this->is_account; - return($ret); - } - - function init_multiple_support($attrs,$attr) - { - plugin::init_multiple_support($attrs,$attr); - - if(isset($attrs['is_account'])){ - $this->is_account = $attrs['is_account']; - } - } - - function get_multi_edit_values() - { - $ret = plugin::get_multi_edit_values(); - if(in_array("pureftpd",$this->multi_boxes)){ - $ret['is_account'] = $this->is_account; - } - return($ret); - } - - function set_multi_edit_values($values) - { - plugin::set_multi_edit_values($values); - if(isset($values['is_account'])){ - $this->is_account = $values['is_account']; - } - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/pureftpd/pureftpd.tpl b/gosa-core/plugins/personal/connectivity/pureftpd/pureftpd.tpl deleted file mode 100644 index 5558f54ad..000000000 --- a/gosa-core/plugins/personal/connectivity/pureftpd/pureftpd.tpl +++ /dev/null @@ -1,114 +0,0 @@ -

- {render acl=$pureftpdACL checkbox=$multiple_support checked=$use_pureftpd} - - {/render} - {t}FTP account{/t} -

- - - - - - - - - - - - - -
- - - - - - - - - - - - -
- {t}Bandwidth{/t} -
{t}Upload bandwidth{/t} -{render acl=$FTPUploadBandwidthACL checkbox=$multiple_support checked=$use_FTPUploadBandwidth} - -{/render} - {t}kb/s{/t}
{t}Download bandwidth{/t} -{render acl=$FTPDownloadBandwidthACL checkbox=$multiple_support checked=$use_FTPDownloadBandwidth} - -{/render} - {t}kb/s{/t}
-
-   - - - - - - - - - - - - - -
- {t}Quota{/t} -
{t}Files{/t} -{render acl=$FTPQuotaFilesACL checkbox=$multiple_support checked=$use_FTPQuotaFiles} - -{/render} -
{t}Size{/t} -{render acl=$FTPQuotaMBytesACL checkbox=$multiple_support checked=$use_FTPQuotaMBytes} - -{/render} - {t}MB{/t} -
-
- - - - - - - - -
- {t}Ratio{/t} -
{t}Uploaded / downloaded files{/t} - -{render acl=$FTPUploadRatioACL checkbox=$multiple_support checked=$use_FTPUploadRatio} - -{/render} - / -{render acl=$FTPDownloadRatioACL checkbox=$multiple_support checked=$use_FTPDownloadRatio} - -{/render} -
-
- - - - - - -
- {t}Miscellaneous{/t} -
-{render acl=$FTPStatusACL checkbox=$multiple_support checked=$use_FTPStatus} - -{/render} -{t}Temporary disable FTP access{/t}
-
- - - diff --git a/gosa-core/plugins/personal/connectivity/squid/class_proxyAccount.inc b/gosa-core/plugins/personal/connectivity/squid/class_proxyAccount.inc deleted file mode 100644 index 1df345863..000000000 --- a/gosa-core/plugins/personal/connectivity/squid/class_proxyAccount.inc +++ /dev/null @@ -1,427 +0,0 @@ -attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - } - - - /*! \brief Create html output for this class - */ - public function execute() - { - /* Call parent execute */ - plugin::execute(); - - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - $display= ""; - $smarty= get_smarty(); - - /* Assign radio boxes */ - foreach (array("F", "T", "B", "N") as $val){ - if (preg_match("/".$val."/",$this->gosaProxyAcctFlags)){ - $smarty->assign("filter$val", "checked"); - $smarty->assign($val."state", ""); - } else { - $smarty->assign("filter$val", ""); - if(session::get('js')==1){ - $smarty->assign($val."state", "disabled"); - }else{ - $smarty->assign($val."state", ""); - } - } - } - - /* Assign ACLs */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $acl => $desc){ - $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly)); - $smarty->assign($acl."_W",$this->acl_is_writeable($acl,$this->ReadOnly)); - } - - /* Assign working time */ - $smarty->assign("starthour" ,($this->gosaProxyWorkingStart / 60)); - $smarty->assign("startminute", ($this->gosaProxyWorkingStart % 60)); - $smarty->assign("stophour", ($this->gosaProxyWorkingStop / 60)); - $smarty->assign("stopminute", ($this->gosaProxyWorkingStop % 60)); - $hours= array(); - for($i=0; $i<24; $i++){ - $hours[]= sprintf("%02d",$i); - } - $smarty->assign("hours", $hours); - $smarty->assign("minutes", array("00","15","30","45")); - - /* Assign quota values */ - $smarty->assign("quota_unit", array("k" => _("KB"), "m" => _("MB"), "g" => _("GB"))); - $smarty->assign("quota_time", array("h" => _("hour"), "d" => _("day"), "w" => _("week"), "m" => _("month"))); - $smarty->assign("gosaProxyQuotaPeriod", $this->gosaProxyQuotaPeriod); - $smarty->assign("quota_size", preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota)); - $smarty->assign("quota_u", preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota)); - if ($this->is_account){ - $smarty->assign("proxyState", "checked"); - } else { - $smarty->assign("proxyState", ""); - } - - - /* Handle input grey out and javascript enabled/disable of input fields - */ - if($this->multiple_support_active){ - - /* In Multiple edit, everything is enabled */ - $changeB = ""; - $smarty->assign("pstate", ""); - $smarty->assign("ProxyWorkingStateChange",""); - }else{ - - /* Depeding on the account status, we disable or - * enable all input fields - */ - if (!$this->is_account){ - $smarty->assign("pstate", "disabled"); - } else { - $smarty->assign("pstate", ""); - } - - /* Create JS activation string for everal input fields */ - $ProxyWorkingStateChange ="\n"; - if($this->acl_is_writeable("gosaProxyFlagT")){ - $ProxyWorkingStateChange.= "changeState('startHour'); \n"; - $ProxyWorkingStateChange.= "changeState('startMinute'); \n"; - $ProxyWorkingStateChange.= "changeState('stopHour'); \n"; - $ProxyWorkingStateChange.= "changeState('stopMinute'); \n"; - } - $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange); - $changeB = ""; - if($this->acl_is_writeable("gosaProxyFlagB")){ - $changeB = - "changeSubselectState('filterB', 'quota_size'); - changeSubselectState('filterB', 'quota_unit'); - changeSubselectState('filterB', 'gosaProxyQuotaPeriod');"; - } - } - - /* Assign filter settings */ - $smarty->assign("changeB",$changeB); - foreach(array("T","B","F") as $attr){ - if(in_array("filter".$attr,$this->multi_boxes)){ - $smarty->assign("use_filter".$attr,TRUE); - }else{ - $smarty->assign("use_filter".$attr,FALSE); - } - } - $smarty->assign("proxyAccountACL",$this->getacl("",$this->ReadOnly)); - $smarty->assign("use_proxy",in_array("proxy",$this->multi_boxes)); - $smarty->assign("multiple_support",$this->multiple_support_active); - $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__))); - return($display); - } - - - /*! \brief Removes proxy account from current object - */ - public function remove_from_parent() - { - if($this->acl_is_removeable() && $this->initially_was_account){ - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events("remove",array("uid" => $this->uid)); - } - } - - - /*! \brief Check given input - @return array Returns an array of error messages - */ - public function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - /* We've got only one value to check for positive integer or emtpy field */ - if ($this->is_account){ - if($this->acl_is_writeable("gosaProxyQuota")){ - if (isset($_POST["quota_size"])){ - if ($_POST["quota_size"] == "gosaProxyQuota"){ - $message[]= _("Numerical value for Quota Setting is empty."); - }elseif ($_POST["quota_size"] <= 0){ - $message[]= _("Numerical value for Quota Setting is not valid."); - } - } - } - } - return $message; - } - - /*! \brief Save POST data to object - */ - public function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['proxy'])){ - if (!$this->is_account && $_POST['proxy'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - /* Save flag value */ - if ($this->is_account || $this->multiple_support_active){ - - $flags= ""; - $acl= ""; - foreach(array("F", "T", "B") as $key){ - if($this->acl_is_writeable("gosaProxyFlag".$key)){ - - /* Add acl */ - if (isset($_POST["filter$key"])){ - $flags.= $key; - } - }else{ - - /* Keep all flags that can't be written*/ - if(preg_match("/".$key."/",$this->gosaProxyAcctFlags)){ - $flags .=$key; - } - } - } - if ("[$flags]" != $this->gosaProxyAcctFlags){ - $this->is_modified= TRUE; - } - $this->gosaProxyAcctFlags= "[$flags]"; - - /* Save time values */ - if ($this->acl_is_writeable("gosaProxyFlagT")){ - if(isset($_POST['startMinute'])){ - $old= $this->gosaProxyWorkingStart; - $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"]; - $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified; - } - - if (isset($_POST['stopMinute'])){ - $old= $this->gosaProxyWorkingStop; - $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"]; - $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified; - } - } - - /* Save quota values */ - if ($this->acl_is_writeable("gosaProxyFlagB")){ - if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){ - $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"]; - } - } - - /*Save quota period */ - if($this->acl_is_writeable("gosaProxyFlagB")){ - if(isset($_POST["gosaProxyQuotaPeriod"])){ - $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"]; - } - } - } - } - - - /*! \brief Save settings to ldap - */ - public function save() - { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - - } - - - /*! \brief Static Function returning an ACL information array. - @return Array Returns an ACL array - */ - static function plInfo() - { - return (array( - "plShortName" => _("Proxy"), - "plDescription" => _("Proxy account")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 21, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array( - "gosaProxyFlagF" => _("Filter unwanted content"), - "gosaProxyFlagT" => _("Limit proxy access"), - "gosaProxyFlagB" => _("Restrict proxy usage by quota")) - )); - } - - - /*! \brief Save html POSTs in multiple edit. - */ - public function multiple_save_object() - { - if (isset($_POST['connectivityTab'])){ - plugin::multiple_save_object(); - if(isset($_POST['use_proxy'])){ - $this->multi_boxes[] = "proxy"; - } - foreach(array("T","B","F") as $attr){ - if(isset($_POST["use_filter".$attr])){ - $this->multi_boxes[] = "filter".$attr; - } - } - $this->save_object(); - } - } - - - /*! \brief Returns all modified values. \ - All selected an modified values will be returned \ - in an array. - @return array Returns an array containing all attribute modifications - */ - public function get_multi_edit_values() - { - $ret = plugin::get_multi_edit_values(); - if(in_array("proxy",$this->multi_boxes)){ - $ret['is_account'] = $this->is_account; - } - - if(in_array("filterT",$this->multi_boxes)){ - $ret['gosaProxyWorkingStart'] = $this->gosaProxyWorkingStart; - $ret['gosaProxyWorkingStop'] = $this->gosaProxyWorkingStop; - } - if(in_array("filterB",$this->multi_boxes)){ - $ret['gosaProxyQuota'] = $this->gosaProxyQuota; - $ret['gosaProxyQuotaPeriod'] = $this->gosaProxyQuotaPeriod; - } - - foreach(array("B","T","F") as $attr){ - $name = "filter".$attr; - if(in_array($name,$this->multi_boxes)){ - $ret[$name] = preg_match("/".$attr."/",$this->gosaProxyAcctFlags); - } - } - - return($ret); - } - - - /*! \brief Sets modified attributes in mutliple edit. \ - All collected values from "get_multi_edit_values()" \ - will be applied to this plugin. - @param array An array containing modified attributes returned by get_multi_edit_values(); - */ - public function set_multi_edit_values($values) - { - plugin::set_multi_edit_values($values); - if(isset($values['is_account'])){ - $this->is_account = $values['is_account']; - } - foreach(array("B","T","F") as $attr){ - $name = "filter".$attr; - if(isset($values[$name])){ - if($values[$name] && !preg_match("/".$attr."/",$this->gosaProxyAcctFlags)){ - $this->gosaProxyAcctFlags = preg_replace("/\]/",$attr."]",$this->gosaProxyAcctFlags); - }elseif(!$values[$name] && preg_match("/".$attr."/",$this->gosaProxyAcctFlags)){ - $this->gosaProxyAcctFlags = preg_replace("/".$attr."/","",$this->gosaProxyAcctFlags); - } - } - } - } - - - /*! \brief Initialize multiple edit ui for this plugin. \ - This function sets plugin defaults in multiple edit. - @param array Attributes used in all object - @param array All used attributes. - */ - public function init_multiple_support($attrs,$all) - { - plugin::init_multiple_support($attrs,$all); - if(isset($attrs['objectClass']) && in_array("gosaProxyAccount",$attrs['objectClass'])){ - $this->is_account = TRUE; - } - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/squid/proxy.tpl b/gosa-core/plugins/personal/connectivity/squid/proxy.tpl deleted file mode 100644 index 4f6ac1ea7..000000000 --- a/gosa-core/plugins/personal/connectivity/squid/proxy.tpl +++ /dev/null @@ -1,130 +0,0 @@ -

- -{if $multiple_support} - - - - -{else} - - {render acl=$proxyAccountACL} - - {/render} -{/if} - {t}Proxy account{/t}

- - - - - -
- - - - - - - -
- -{render acl=$gosaProxyFlagFACL checkbox=$multiple_support checked=$use_filterF} - -{/render} - {t}Filter unwanted content (i.e. pornographic or violence related){/t} -
- -{render acl=$gosaProxyFlagTACL checkbox=$multiple_support checked=$use_filterT} - -{/render} - - -
- - - - -
- -{render acl=$gosaProxyFlagTACL} - -{/render} -  :  -{render acl=$gosaProxyFlagTACL} - -{/render} -  -  -{render acl=$gosaProxyFlagTACL} - -{/render} -  :  -{render acl=$gosaProxyFlagTACL} - -{/render} -
-
-   - -{render acl=$gosaProxyFlagBACL checkbox=$multiple_support checked=$use_filterB} - -{/render} - -
- - - - -
-{render acl=$gosaProxyFlagBACL} - -{/render} -   -{render acl=$gosaProxyFlagBACL} - -{/render} - - -{render acl=$gosaProxyFlagBACL} - -{/render} -
-
-
- diff --git a/gosa-core/plugins/personal/connectivity/webdav/class_webdavAccount.inc b/gosa-core/plugins/personal/connectivity/webdav/class_webdavAccount.inc deleted file mode 100644 index 4d7c179de..000000000 --- a/gosa-core/plugins/personal/connectivity/webdav/class_webdavAccount.inc +++ /dev/null @@ -1,217 +0,0 @@ -attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - } - - function execute() - { - /* Call parent execute */ -// plugin::execute(); - - /* Log view */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","users/".get_class($this),$this->dn); - } - - /* Show tab dialog headers */ - $display= ""; - - /* Show main page */ - $smarty= get_smarty(); - - if ($this->is_account){ - $smarty->assign("webdavState", "checked"); - } else { - $smarty->assign("webdavState", ""); - $smarty->assign("wstate", "disabled"); - } - - if ($this->parent !== NULL){ - $smarty->assign("tabbed", 1); - } - - $smarty->assign('webdavAccountACL', $this->getacl("",$this->ReadOnly)); - $smarty->assign("use_webdav",in_array("webdav",$this->multi_boxes)); - $smarty->assign("multiple_support",$this->multiple_support_active); - $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__))); - return ($display); - } - - function remove_from_parent() - { - if($this->acl_is_createable() || $this->is_account){ - /* Cancel if there's nothing to do here */ - if (!$this->initially_was_account){ - return; - } - - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/webDAV account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove',array("uid" => $this->uid)); - } - } - - - /* Save data to object */ - function save_object() - { - /* Do we need to flip is_account state? */ - if (isset($_POST['connectivityTab'])){ - if (isset($_POST['webdav'])){ - if (!$this->is_account && $_POST['webdav'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - - plugin::save_object(); - if (isset($_POST["WEBDAVStatus"])){ - $this->WEBDAVStatus = "disabled"; - } else { - $this->WEBDAVStatus = "enabled"; - } - } - - - /* Save to LDAP */ - function save() - { - if($this->acl_is_createable()){ - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - /* Log last action */ - if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/webDAV account with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } - } else { - $this->handle_post_events("add",array("uid" => $this->uid)); - } - } - } - - /* Return plugin informations for acl handling - #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */ - static function plInfo() - { - return (array( - "plShortName" => _("WebDAV"), - "plDescription" => _("WebDAV account")." : "._("Connectivity addon")."", - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 23, // Position in tabs - "plSection" => array("personal" => _("My account")), - "plCategory" => array("users"), - "plOptions" => array(), - - "plProvidedAcls" => array() - )); - } - - function multiple_save_object() - { - if (isset($_POST['connectivityTab'])){ - plugin::multiple_save_object(); - - if(isset($_POST['use_webdav'])){ - $this->multi_boxes[] = "webdav"; - if (isset($_POST['webdav'])){ - if (!$this->is_account && $_POST['webdav'] == "B"){ - if($this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - } else { - if($this->acl_is_removeable()){ - $this->is_account= FALSE; - } - } - } - } - } - - function get_multi_edit_values() - { - $ret = plugin::get_multi_edit_values(); - if(in_array("webdav",$this->multi_boxes)){ - $ret['is_account'] = $this->is_account; - } - return($ret); - } - - function set_multi_edit_values($values) - { - plugin::set_multi_edit_values($values); - if(isset($values['is_account'])){ - $this->is_account = $values['is_account']; - } - } - - function init_multiple_support($attrs,$all) - { - plugin::init_multiple_support($attrs,$all); - if(isset($attrs['objectClass']) && in_array("gosaWebdavAccount",$attrs['objectClass'])){ - $this->is_account = TRUE; - } - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/personal/connectivity/webdav/webdav.tpl b/gosa-core/plugins/personal/connectivity/webdav/webdav.tpl deleted file mode 100644 index df52197a5..000000000 --- a/gosa-core/plugins/personal/connectivity/webdav/webdav.tpl +++ /dev/null @@ -1,6 +0,0 @@ -

-{render acl=$webdavAccountACL checkbox=$multiple_support checked=$use_webdav} - -{/render} - {t}WebDAV account{/t} -

diff --git a/gosa-plugins/opengroupware/personal/connectivity/opengroupware/class_pgsql_opengw.inc b/gosa-plugins/opengroupware/personal/connectivity/opengroupware/class_pgsql_opengw.inc new file mode 100644 index 000000000..3615bb4c6 --- /dev/null +++ b/gosa-plugins/opengroupware/personal/connectivity/opengroupware/class_pgsql_opengw.inc @@ -0,0 +1,160 @@ +user = $user; + $this->pwd = $pwd; + $this->server = $server; + $this->db = $db; + + if($this->_connect()){ + $this->is_connected = true; + }else{ + $this->is_connected = false; + } + } + + function _connect() + { + error_reporting(E_ALL | E_STRICT); + if(is_callable("pg_connect")){ + if(!empty($this->pwd)){ + $this->handle = @pg_connect("dbname=".$this->db." host=".$this->server." user=".$this->user); + }else{ + $this->handle = @pg_connect("dbname=".$this->db." host=".$this->server." user=".$this->user." password=".$this->pwd); + } + if(!$this->handle){ + $this->handle = false; + } + }else{ + $this->handle = false; + } + return($this->handle); + } + + function Query($a_query) + { + if(is_array($a_query)){ + foreach($a_query as $nr => $query){ + return($this->_query($query)); + } + }else{ + return($this->_query($a_query)); + } + } + + function _query($query) + { + return(pg_query($this->handle,$query)); + } + + function FetchAllRows($res) + { + return(pg_fetch_all($res)) ; + } + + function gen_id() + { + $tmp = $this->_query("select nextval('key_generator');"); + $tmp = ($this->FetchAllRows($tmp)); + return($tmp[0]['nextval']); + } + + + function GetTemplateUser(){ + $data = array(); + $qry = "SELECT description,name,company_id FROM company WHERE is_template_user=1;"; + $res = $this->_query($qry); + $tmp = $this->FetchAllRows($res); + foreach($tmp as $attr){ + $data[$attr['name']] = $attr; + } + return $data; + } + function GetLocationTeam(){ + $data = array(); + $qry = "SELECT description,name,company_id FROM team WHERE is_location_team=1;"; + $res = $this->_query($qry); + $tmp = $this->FetchAllRows($res); + if(is_array($tmp)){ + foreach($tmp as $attr){ + $data[$attr['description']] = $attr; + } + } + return $data; + } + function GetTeams(){ + $data = array(); + $qry = "SELECT description,name,company_id FROM team + WHERE (is_team=1) AND company_id + NOT IN (SELECT company_id FROM company WHERE is_location_team=1);"; + $res = $this->_query($qry); + $tmp = $this->FetchAllRows($res); + foreach($tmp as $attr){ + $data[$attr['description']] = $attr; + } + return $data; + } +} + + +function gen_syntax($array,$tablename,$act,$ist) +{ + if($act == "EDIT"){ + $str = "UPDATE ".$tablename." SET "; + $company_id = $ist[0]['company_id']; + + foreach($array as $name => $value){ + if((empty($value))&&(!preg_match("/^is_/i",$name))) continue; + + if((empty($value))&&(preg_match("/^is_/i",$name))){ + $value= 0; + } + + if(!is_numeric($value)){ + $str.= " ".$name."='".$value."', "; + }else{ + $str.= " ".$name."=".$value.", "; + } + } + $str = preg_replace("/, $/","",$str); + $str .= " WHERE company_id=".$company_id.";\n"; + return $str; + } + if($act == "ADD"){ + $str = "INSERT into ".$tablename." ("; + $attrs = ""; + $values = ""; + foreach($array as $name => $attribute){ + if((empty($attribute))&&(!preg_match("/^is_/i",$name))) continue; + + if((empty($attribute))&&(preg_match("/^is_/i",$name))){ + $attribute= 0; + } + + if(is_numeric($attribute)){ + $attrs .= $name.", "; + $values .= $attribute.", "; + }else{ + $attrs .= $name.", "; + $values .= "'".$attribute."', "; + } + } + $attrs = preg_replace("/, $/","",$attrs); + $values= preg_replace("/, $/","",$values); + $str .= $attrs." ) \nVALUES\n (".$values.");\n"; + return $str; + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/openxchange/personal/connectivity/openxchange/class_oxchangeAccount.inc b/gosa-plugins/openxchange/personal/connectivity/openxchange/class_oxchangeAccount.inc new file mode 100644 index 000000000..6561ab14c --- /dev/null +++ b/gosa-plugins/openxchange/personal/connectivity/openxchange/class_oxchangeAccount.inc @@ -0,0 +1,976 @@ +config->data['TABS']['CONNECTIVITY']);$i++){ + if($this->config->data['TABS']['CONNECTIVITY'][$i]['CLASS']=='oxchangeAccount') { + $this->oxconf=$this->config->data['TABS']['CONNECTIVITY'][$i]; + break; + } + } + + /* Setting uid to default */ + if(isset($this->attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + + $this->dnmode= $this->config->current['DNMODE']; + if(isset($this->attrs[$this->dnmode][0])){ + $this->dnModeValue = $this->attrs[$this->dnmode][0]; + } + } + + function execute() + { + /* Call parent execute */ + //plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + $display=""; + + /* Show main page */ + $smarty= get_smarty(); + + if (function_exists("pg_connect")){ + $smarty->assign("pg", true); + }else{ + $smarty->assign("pg", false); + } + + /* Load attributes */ + foreach($this->attributes as $val){ + $smarty->assign("$val", $this->$val); + } + if ($this->is_account){ + $smarty->assign("oxchangeState", "checked"); + $smarty->assign("oxState", ""); + } else { + $smarty->assign("oxchangeState", ""); + $smarty->assign("oxState", "disabled"); + } + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $key => $desc){ + $smarty->assign($key."ACL",$this->getacl($key,$this->ReadOnly)); + $smarty->assign($key."_W",$this->acl_is_writeable($key)); + } + + if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){ + $smarty->assign('oxchangeAccountACL', ""); + }else{ + $smarty->assign('oxchangeAccountACL', " disabled "); + } + + $smarty->assign("timezones", $this->timezones); + + + if ($this->parent !== NULL){ + $smarty->assign("tabbed", 1); + }else{ + $smarty->assign("tabbed", 0); + } + + /* Trying to open a Postgresql Database Server */ + if (function_exists("pg_connect")){ + if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){ + $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); + if (! $pgcon){ + $smarty->assign("pg", false); + } + }else{ + $smarty->assign("pg", false); + } + }else{ + $smarty->assign("pg", false); + } + + $display.= $smarty->fetch (get_template_path('oxchange.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + if(!$this->acl_is_removeable()) return; + $this->attrs[$this->dnmode][0] = $this->dnModeValue; + $sqldeluser=array( + "delete from prg_notes where (user_right like '".$this->attrs[$this->dnmode][0]."') and (group_right like 's')", + "delete from prg_documents_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_documents_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_docufolders_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_docufolders_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_date_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_date_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_dates_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_knowledge_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_knowledge_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_knowledge_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_knowledge_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_pin_board_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_pin_board_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_bookmarks_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_bookmarks_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_bookmarks_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_bookmarks_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_tasks_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_tasks_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_tasks_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_projects_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_projects_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from prg_projects_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')", + "delete from oxfolder_permissions where (entity like '".$this->attrs[$this->dnmode][0]."') AND ((role = 256) OR (role = 1024))", + "delete from oxfolder_standardfolders where owner like '".$this->attrs[$this->dnmode][0]."'", + "delete from prg_forum_read where user_right = '".$this->attrs[$this->dnmode][0]."'", + "delete from prg_forum_mod where user_right = '".$this->attrs[$this->dnmode][0]."'", + "delete from prg_forum_abo where user_right = '".$this->attrs[$this->dnmode][0]."'", + "delete from prg_forum_seen where username = '".$this->attrs[$this->dnmode][0]."'", + "delete from sys_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')", + "delete from usr_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')"); + + /* Trying to open a Postgresql Database Server */ + if (function_exists("pg_connect")){ + if(isset($this->oxconf["PGUSER"]) and + isset($this->oxconf["PGHOST"]) and + isset($this->oxconf["PGDBNAME"]) and + isset($this->oxconf["PGPASSWD"])){ + $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); + if (! $pgcon){ + msg_dialog::display(_("Error"), sprintf(_("Cannot connect to %s database!"), "Open-Xchange"), ERROR_DIALOG); + return; + } + }else{ + msg_dialog::display(_("Configuration error"), sprintf(_("%s database configuration is missing!"), "Open-Xchange"), ERROR_DIALOG); + return; + } + }else{ + msg_dialog::display(_("Configuration error"), sprintf(_("Missing %s PHP extension!"), "postgresql"), ERROR_DIALOG); + return; + } + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + if($ldap->dn_exists("ou=addr,".$this->dn)){ + $ldap->rmdir_recursive("ou=addr,".$this->dn); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn)); + } + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->postremove(array("uid" => $this->uid)); + + /* Finally remove data from postgresql server */ + foreach ($sqldeluser as $sqls){ + @pg_exec($pgcon,$sqls); + } + pg_close(); + } + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['oxchange'])){ + if (!$this->is_account && $_POST['oxchange'] == "B") { + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + /* Get objects */ + foreach(array("OXTimeZone","OXTaskDays","OXAppointmentDays") as $name) { + if($this->acl_is_writeable($name) && isset($_POST[$name])){ + $this->$name = $_POST[$name]; + } + } + + if (isset($_POST["oxchangeStatus"])){ + $this->oxchangeStatus = "disabled"; + } else { + $this->oxchangeStatus = "enabled"; + } + } + + + /* Save to LDAP */ + function save() + { + + $needupdate=TRUE; + $istemplate=FALSE; + + /*First at all, we must check if this is new or is updated */ + /*Also check is we have a template, if is a template, is a new user */ + if (isset($this->attrs['objectClass'])){ + foreach ($this->attrs['objectClass'] as $object){ + if($object=="OXUserObject") $needupdate=FALSE; + if($object=="gosaUserTemplate") $istemplate=TRUE; + } + } + + $uidarray=array(); + preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray); + $uid=$uidarray[2]; + if (trim($uid) == "") { + msg_dialog::display(_("Error"), _("Open-Xchange account name is invalid!"), ERROR_DIALOG); + return; + } + + if ($istemplate) $needupdate=TRUE; + + if($needupdate){ + /* Trying to open a Postgresql Database Server */ + if (function_exists("pg_connect")){ + if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){ + $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); + if (! $pgcon){ + msg::display(_("Error"), sprintf(_("Cannot connect to %s database!"), "Open-Xchange"), ERROR_DIALOG); + return; + } + }else{ + msg_dialog::display(_("Configuration error"), sprintf(_("%s database configuration is missing!"), "Open-Xchange"), ERROR_DIALOG); + return; + } + }else{ + msg_dialog::display(_("Configuration error"), sprintf(_("Missing %s PHP extension!"), "postgresql"), ERROR_DIALOG); + return; + } + } + + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->postcreate(array("uid" => $this->uid)); + + if($needupdate){ + $ldap->create_missing_trees("ou=addr,".$this->dn); + show_ldap_error($ldap->get_error(), sprintf(_("Creating of user/oxchange account with dn '%s' failed."),$this->dn)); + /* Finally save data to postgresql server */ + pg_set_client_encoding ("UNICODE"); + $nv = "SELECT nextval ('serial_id')"; + $ot = "insert into oxfolder_tree (fuid, parent, fname, module, type, owner, creator, creating_date, created_from, changing_date, changed_from) VALUES (%d, 1, '%s', '%s', 'private', '%s', '%s', 'now', 'System', 'now', 'System')"; + $op = "INSERT INTO oxfolder_permissions (puid, pid, role, entity, sealed, fp, orp, owp, odp) VALUES (%d, %d, 32768, '%s', 0, 128, 128, 128, 128)"; + $os = "insert into oxfolder_standardfolders (owner,module_calendar,module_contact,module_task) VALUES ('%s',%d,%d,%d)"; + $ugr= "INSERT INTO usr_general_rights SELECT creating_date, created_from, changing_date, changed_from,text('%s'), addr_u, addr_r, addr_d, cont_u, cont_r, cont_d, data_u, data_r, data_d, serie_u, serie_r, serie_d, task_u, task_r, task_d, refer, proj_u, proj_r, proj_d, dfolder_u, dfolder_r, dfolder_d, doc_u, doc_r, doc_d, knowl_u, knowl_r, knowl_d, bfolder_u, bfolder_r, bfolder_d, bookm_u, bookm_r, bookm_d, pin_u, pin_r, pin_d, forum_n, fentrie_n, setup, pin_public, internal, int_groups, kfolder_u, kfolder_r, kfolder_d, webmail FROM sys_gen_rights_template WHERE login LIKE 'default_template'"; + + $error = FALSE; + $res=@pg_exec($pgcon,$nv); + + if(!$res){ + $error = TRUE; + }else{ + $calendarid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($ot,$calendarid[0],'My Appointments','calendar',$uid,$uid); + @pg_exec($pgcon,$q); + } + + $res=@pg_exec($pgcon,$nv); + + if(!$res){ + $error = TRUE; + }else{ + $nid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($op,$nid[0],$calendarid[0],$uid); + @pg_exec($pgcon,$q); + } + + $res=@pg_exec($pgcon,$nv); + if(!$res){ + $error = TRUE; + }else{ + $contactsid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($ot,$contactsid[0],'My Contacts','contact',$uid,$uid); + @pg_exec($pgcon,$q); + } + + $res=@pg_exec($pgcon,$nv); + if(!$res){ + $error = TRUE; + }else{ + $nid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($op,$nid[0],$contactsid[0],$uid); + @pg_exec($pgcon,$q); + } + + $res=@pg_exec($pgcon,$nv); + if(!$res){ + $error = TRUE; + }else{ + $tasksid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($ot,$tasksid[0],'My Tasks','task',$uid,$uid); + @pg_exec($pgcon,$q); + } + + $res=@pg_exec($pgcon,$nv); + if(!$res){ + $error = TRUE; + }else{ + $nid=pg_fetch_row($res); + pg_freeresult($res); + + $q=sprintf($op,$nid[0],$tasksid[0],$uid); + @pg_exec($pgcon,$q); + + $q=sprintf($os,$uid,$calendarid[0],$contactsid[0],$tasksid[0]); + @pg_exec($pgcon,$q); + + $q=sprintf($ugr,$uid); + @pg_exec($pgcon,$q); + } + + @pg_close($pgcon); + + if($error){ + msg_dialog::display(_("Error"), _("Cannot save Open-Xchange account!"), ERROR_DIALOG); + } + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Open-Xchange"), + "plDescription" => _("Open-Xchange account settings")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 27, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array( + "OXAppointmentDays" => _("OXAppointmentDays"), + "OXTaskDays" => _("OXTaskDays"), + "OXTimeZone" => _("OXTimeZone")) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/openxchange/personal/connectivity/openxchange/oxchange.tpl b/gosa-plugins/openxchange/personal/connectivity/openxchange/oxchange.tpl new file mode 100644 index 000000000..2bd204907 --- /dev/null +++ b/gosa-plugins/openxchange/personal/connectivity/openxchange/oxchange.tpl @@ -0,0 +1,84 @@ +{if !$pg} +

{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected. Or the specified database can't be reached{/t}

+{else} +

+ +{t}Open-Xchange account{/t}

+ + + + + + + + + + +
+ + + + + + + + + + + + +
+ {t}Remember{/t} +
+ +{render acl=$OXAppointmentDaysACL} + +{/render} + {t}days{/t}
+ +{render acl=$OXTaskDaysACL} + +{/render} + + {t}days{/t} +
+
+   + + + + + + + + + + + + + +
+ {t}User Information{/t} +
+ +{render acl=$OXTimeZoneACL} + +{/render} + +
+
+{/if} diff --git a/gosa-plugins/phpgw/personal/connectivity/phpgw/class_phpgwAccount.inc b/gosa-plugins/phpgw/personal/connectivity/phpgw/class_phpgwAccount.inc new file mode 100644 index 000000000..0e2ac36b1 --- /dev/null +++ b/gosa-plugins/phpgw/personal/connectivity/phpgw/class_phpgwAccount.inc @@ -0,0 +1,222 @@ +attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + } + + function execute() + { + /* Call parent execute */ +// plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + /* Show tab dialog headers */ + $display= ""; + + /* Show main page */ + $smarty= get_smarty(); + + /* Load attributes */ + foreach($this->attributes as $val){ + $smarty->assign("$val", $this->$val); + } + if ($this->is_account){ + $smarty->assign("phpgwState", "checked"); + } else { + $smarty->assign("phpgwState", ""); + } + + $smarty->assign('phpgwAccountACL', $this->getacl("",$this->ReadOnly)); + $smarty->assign("multiple_support",$this->multiple_support_active); + $smarty->assign("use_phpgw",in_array("phpgw",$this->multi_boxes)); + $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + if($this->acl_is_removeable()){ + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn)); + + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove',array("uid" => $this->uid)); + } + } + + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['phpgw'])){ + if (!$this->is_account && $_POST['phpgw'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + plugin::save_object(); + if (isset($_POST["phpgwStatus"])){ + $this->phpgwStatus = "disabled"; + } else { + $this->phpgwStatus = "enabled"; + } + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPgw account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("PHP GW"), + "plDescription" => _("PHP GW account settings")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 24, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array() + )); + } + + + function multiple_save_object() + { + if (isset($_POST['connectivityTab'])){ + plugin::multiple_save_object(); + + /* Do we need to flip is_account state? */ + if(isset($_POST['use_phpgw'])){ + $this->multi_boxes[] = "phpgw"; + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['phpgw'])){ + if (!$this->is_account && $_POST['phpgw'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + } + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("phpgw",$this->multi_boxes)){ + $ret['is_account'] = $this->is_account; + } + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + if(isset($values['is_account'])){ + $this->is_account = $values['is_account']; + } + } + + function init_multiple_support($attrs,$all) + { + plugin::init_multiple_support($attrs,$all); + if(isset($attrs['objectClass']) && in_array("phpgwAccount",$attrs['objectClass'])){ + $this->is_account = TRUE; + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/phpgw/personal/connectivity/phpgw/phpgw.tpl b/gosa-plugins/phpgw/personal/connectivity/phpgw/phpgw.tpl new file mode 100644 index 000000000..a63cddaa2 --- /dev/null +++ b/gosa-plugins/phpgw/personal/connectivity/phpgw/phpgw.tpl @@ -0,0 +1,7 @@ +

+{render acl=$phpgwAccountACL checkbox=$multiple_support checked=$use_phpgw} + +{/render} + {t}PHPGroupware account{/t} + +

diff --git a/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc b/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc new file mode 100644 index 000000000..41454ea7c --- /dev/null +++ b/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/class_phpscheduleitAccount.inc @@ -0,0 +1,175 @@ +is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + /* Show tab dialog headers */ + $display= ""; + + /* Show main page */ + $smarty= get_smarty(); + + if ($this->is_account){ + $smarty->assign("phpscheduleitState", "checked"); + } else { + $smarty->assign("phpscheduleitState", ""); + $smarty->assign("wstate", "disabled"); + } + + if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) { + $smarty->assign('gosaphpscheduleitACL', ""); + }else{ + $smarty->assign('gosaphpscheduleitACL', " disabled "); + } + + $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + /* Cancel if there's nothing to do here */ + if ($this->acl_is_removeable()){ + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); + + if($this->is_account){ + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove',array("uid" => $this->uid)); + } + } + + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['phpscheduleit'])){ + if (!$this->is_account && $_POST['phpscheduleit'] == "B"){ + if($this->acl_is_createable()) { + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + plugin::save_object(); + if (isset($_POST["phpscheduleitStatus"])){ + $this->pptpStatus = "disabled"; + } else { + $this->pptpStatus = "enabled"; + } + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + + } + + + /* Return plugin informations for acl handling + #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */ + static function plInfo() + { + return (array( + "plShortName" => _("PHP Schedule it"), + "plDescription" => _("PHP Schedule it settings")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 29, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + + "plOptions" => array(), + + "plProvidedAcls" => array() + )); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/phpscheduleit.tpl b/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/phpscheduleit.tpl new file mode 100644 index 000000000..7e5510c3f --- /dev/null +++ b/gosa-plugins/phpscheduleit/personal/connectivity/phpscheduleit/phpscheduleit.tpl @@ -0,0 +1,4 @@ +

+ + {t}PHPscheduleit account{/t} +

diff --git a/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc b/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc new file mode 100644 index 000000000..0c8c659cf --- /dev/null +++ b/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc @@ -0,0 +1,188 @@ +attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + } + + function execute() + { + /* Call parent execute */ + // plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + /* Show tab dialog headers */ + $display= ""; + + /* Show main page */ + $smarty= get_smarty(); + + if ($this->is_account){ + $smarty->assign("pptpState", "checked"); + } else { + $smarty->assign("pptpState", ""); + $smarty->assign("wstate", "disabled"); + } + + if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) { + $smarty->assign('gosapptpACL', ""); + }else{ + $smarty->assign('gosapptpACL', " disabled "); + } + + $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + if($this->acl_is_removeable()){ + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PPTP account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove',array("uid" => $this->uid)); + } + } + + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['pptp'])){ + if (!$this->is_account && $_POST['pptp'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + plugin::save_object(); + if (isset($_POST["pptpStatus"])){ + $this->pptpStatus = "disabled"; + } else { + $this->pptpStatus = "enabled"; + } + } + + + /* Save to LDAP */ + function save() + { + if($this->acl_is_createable()){ + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PPTP account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("PPTP"), + "plDescription" => _("PPTP account")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 28, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array() + )); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/pptp/personal/connectivity/pptp/pptp.tpl b/gosa-plugins/pptp/personal/connectivity/pptp/pptp.tpl new file mode 100644 index 000000000..15d28a792 --- /dev/null +++ b/gosa-plugins/pptp/personal/connectivity/pptp/pptp.tpl @@ -0,0 +1,4 @@ +

+ + {t}PPTP account{/t} +

diff --git a/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc new file mode 100644 index 000000000..ad2cba40b --- /dev/null +++ b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc @@ -0,0 +1,323 @@ +attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + } + + function execute() + { + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + /* Show tab dialog headers */ + $display= ""; + + /* Show main page */ + $smarty= get_smarty(); + + /* Load attributes */ + foreach($this->attributes as $val){ + $smarty->assign("$val", $this->$val); + } + + + $tmp = $this->plInfo(); + $changeState = ""; + if($this->multiple_support_active){ + + /* We do not need the attribute grey out in multiple edit */ + foreach($tmp['plProvidedAcls'] as $key => $desc){ + $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); + } + if ($this->is_account){ + $smarty->assign("pureftpdState", "checked"); + }else{ + $smarty->assign("pureftpdState", ""); + } + $smarty->assign("fstate", ""); + $smarty->assign("changeState",""); + + }else{ + foreach($tmp['plProvidedAcls'] as $key => $desc){ + $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); + $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly)); + + if($this->acl_is_writeable($key)){ + $changeState.= " changeState('".$key."'); \n"; + } + } + $smarty->assign("changeState",$changeState); + + + $smarty->assign("fstate", ""); + if ($this->is_account){ + $smarty->assign("pureftpdState", "checked"); + $smarty->assign("fstate", ""); + } else { + $smarty->assign("pureftpdState", ""); + if(session::get('js')==1){ + if($this->acl!="#none#") + $smarty->assign("fstate", "disabled"); + }else{ + $smarty->assign("fstate", ""); + } + } + } + + foreach($this->attributes as $attr){ + if(in_array($attr,$this->multi_boxes)){ + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + $smarty->assign("use_pureftpd",in_array("pureftpd",$this->multi_boxes)); + $smarty->assign("multiple_support",$this->multiple_support_active); + $smarty->assign("FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : ""); + $smarty->assign('pureftpdACL', $this->getacl("",$this->ReadOnly)); + $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + /* Cancel if there's nothing to do here */ + if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){ + return; + } + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/pureftpd account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove',array("uid" => $this->uid)); + } + + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['pureftpd'])){ + if (!$this->is_account && $_POST['pureftpd'] == "B"){ + $this->is_account= TRUE; + } + } else { + $this->is_account= FALSE; + } + + plugin::save_object(); + + $old= $this->FTPStatus; + if (isset($_POST["FTPStatus"])){ + $this->FTPStatus = "disabled"; + } else { + $this->FTPStatus = "enabled"; + } + $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified; + + /* Ensure that these vars are numeric. Values starting with 0 like '0123' cause ldap errors */ + foreach(array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio","FTPUploadBandwidth","FTPDownloadBandwidth") as $testVar){ + $this->$testVar = (int) ($this->$testVar); + } + + + } + } + + + /* Check values */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + /* Check for positive integer values */ + if ($this->is_account){ + + if($this->acl_is_writeable("FTPUploadBandwidth") && !tests::is_id($this->FTPUploadBandwidth)){ + $message[]= _("Value specified as 'Upload bandwidth' is not valid."); + } + if($this->acl_is_writeable("FTPDownloadBandwidth") && !tests::is_id($this->FTPDownloadBandwidth)){ + $message[]= _("Value specified as 'Download bandwidth' is not valid."); + } + + if($this->acl_is_writeable("FTPQuotaFiles") && !tests::is_id($this->FTPQuotaFiles)){ + $message[]= _("Value specified as 'Quota files' is not valid."); + } + if($this->acl_is_writeable("FTPQuotaMBytes") && !tests::is_id($this->FTPQuotaMBytes)){ + $message[]= _("Value specified as 'Quota size' is not valid."); + } + if($this->acl_is_writeable("FTPUploadRatio") && !tests::is_id($this->FTPUploadRatio)){ + $message[]= _("Value specified as 'Upload ratio' is not valid."); + } + if($this->acl_is_writeable("FTPDownloadRatio") && !tests::is_id($this->FTPDownloadRatio)){ + $message[]= _("Value specified as 'Download ratio' is not valid."); + } + } + + return $message; + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $key => $desc){ + if(!$this->acl_is_writeable($key)){ + unset($this->attrs[$key]); + } + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + + } + + + /* Return plugin informations for acl handling + #FIME There possibly some attributes that can be combined to one acl. */ + static function plInfo() + { + return (array( + "plShortName" => _("Ftp"), + "plDescription" => _("Pure ftp account")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 22, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array( + "FTPQuotaFiles" => _("Quota files"), + "FTPUploadRatio" => _("Upload ratio"), + "FTPQuotaMBytes" => _("Quota MBytes"), + "FTPDownloadRatio" => _("Download ratio"), + "FTPUploadBandwidth" => _("Upload bandwith"), + "FTPDownloadBandwidth" => _("Download bandwith"), + "FTPStatus" => _("Status")) + )); + } + + function multiple_save_object() + { + if (isset($_POST['connectivityTab'])){ + plugin::multiple_save_object(); + if(isset($_POST['use_pureftpd'])){ + $this->multi_boxes[] = "pureftpd"; + } + $this->save_object(); + } + } + + function get_multi_init_values() + { + $ret = plugin::get_multi_init_values(); + $ret['is_account'] = $this->is_account; + return($ret); + } + + function init_multiple_support($attrs,$attr) + { + plugin::init_multiple_support($attrs,$attr); + + if(isset($attrs['is_account'])){ + $this->is_account = $attrs['is_account']; + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("pureftpd",$this->multi_boxes)){ + $ret['is_account'] = $this->is_account; + } + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + if(isset($values['is_account'])){ + $this->is_account = $values['is_account']; + } + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/pureftpd/personal/connectivity/pureftpd/pureftpd.tpl b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/pureftpd.tpl new file mode 100644 index 000000000..5558f54ad --- /dev/null +++ b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/pureftpd.tpl @@ -0,0 +1,114 @@ +

+ {render acl=$pureftpdACL checkbox=$multiple_support checked=$use_pureftpd} + + {/render} + {t}FTP account{/t} +

+ + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ {t}Bandwidth{/t} +
{t}Upload bandwidth{/t} +{render acl=$FTPUploadBandwidthACL checkbox=$multiple_support checked=$use_FTPUploadBandwidth} + +{/render} + {t}kb/s{/t}
{t}Download bandwidth{/t} +{render acl=$FTPDownloadBandwidthACL checkbox=$multiple_support checked=$use_FTPDownloadBandwidth} + +{/render} + {t}kb/s{/t}
+
+   + + + + + + + + + + + + + +
+ {t}Quota{/t} +
{t}Files{/t} +{render acl=$FTPQuotaFilesACL checkbox=$multiple_support checked=$use_FTPQuotaFiles} + +{/render} +
{t}Size{/t} +{render acl=$FTPQuotaMBytesACL checkbox=$multiple_support checked=$use_FTPQuotaMBytes} + +{/render} + {t}MB{/t} +
+
+ + + + + + + + +
+ {t}Ratio{/t} +
{t}Uploaded / downloaded files{/t} + +{render acl=$FTPUploadRatioACL checkbox=$multiple_support checked=$use_FTPUploadRatio} + +{/render} + / +{render acl=$FTPDownloadRatioACL checkbox=$multiple_support checked=$use_FTPDownloadRatio} + +{/render} +
+
+ + + + + + +
+ {t}Miscellaneous{/t} +
+{render acl=$FTPStatusACL checkbox=$multiple_support checked=$use_FTPStatus} + +{/render} +{t}Temporary disable FTP access{/t}
+
+ + + diff --git a/gosa-plugins/squid/personal/connectivity/squid/class_proxyAccount.inc b/gosa-plugins/squid/personal/connectivity/squid/class_proxyAccount.inc new file mode 100644 index 000000000..1df345863 --- /dev/null +++ b/gosa-plugins/squid/personal/connectivity/squid/class_proxyAccount.inc @@ -0,0 +1,427 @@ +attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + } + + + /*! \brief Create html output for this class + */ + public function execute() + { + /* Call parent execute */ + plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + $display= ""; + $smarty= get_smarty(); + + /* Assign radio boxes */ + foreach (array("F", "T", "B", "N") as $val){ + if (preg_match("/".$val."/",$this->gosaProxyAcctFlags)){ + $smarty->assign("filter$val", "checked"); + $smarty->assign($val."state", ""); + } else { + $smarty->assign("filter$val", ""); + if(session::get('js')==1){ + $smarty->assign($val."state", "disabled"); + }else{ + $smarty->assign($val."state", ""); + } + } + } + + /* Assign ACLs */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $acl => $desc){ + $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly)); + $smarty->assign($acl."_W",$this->acl_is_writeable($acl,$this->ReadOnly)); + } + + /* Assign working time */ + $smarty->assign("starthour" ,($this->gosaProxyWorkingStart / 60)); + $smarty->assign("startminute", ($this->gosaProxyWorkingStart % 60)); + $smarty->assign("stophour", ($this->gosaProxyWorkingStop / 60)); + $smarty->assign("stopminute", ($this->gosaProxyWorkingStop % 60)); + $hours= array(); + for($i=0; $i<24; $i++){ + $hours[]= sprintf("%02d",$i); + } + $smarty->assign("hours", $hours); + $smarty->assign("minutes", array("00","15","30","45")); + + /* Assign quota values */ + $smarty->assign("quota_unit", array("k" => _("KB"), "m" => _("MB"), "g" => _("GB"))); + $smarty->assign("quota_time", array("h" => _("hour"), "d" => _("day"), "w" => _("week"), "m" => _("month"))); + $smarty->assign("gosaProxyQuotaPeriod", $this->gosaProxyQuotaPeriod); + $smarty->assign("quota_size", preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota)); + $smarty->assign("quota_u", preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota)); + if ($this->is_account){ + $smarty->assign("proxyState", "checked"); + } else { + $smarty->assign("proxyState", ""); + } + + + /* Handle input grey out and javascript enabled/disable of input fields + */ + if($this->multiple_support_active){ + + /* In Multiple edit, everything is enabled */ + $changeB = ""; + $smarty->assign("pstate", ""); + $smarty->assign("ProxyWorkingStateChange",""); + }else{ + + /* Depeding on the account status, we disable or + * enable all input fields + */ + if (!$this->is_account){ + $smarty->assign("pstate", "disabled"); + } else { + $smarty->assign("pstate", ""); + } + + /* Create JS activation string for everal input fields */ + $ProxyWorkingStateChange ="\n"; + if($this->acl_is_writeable("gosaProxyFlagT")){ + $ProxyWorkingStateChange.= "changeState('startHour'); \n"; + $ProxyWorkingStateChange.= "changeState('startMinute'); \n"; + $ProxyWorkingStateChange.= "changeState('stopHour'); \n"; + $ProxyWorkingStateChange.= "changeState('stopMinute'); \n"; + } + $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange); + $changeB = ""; + if($this->acl_is_writeable("gosaProxyFlagB")){ + $changeB = + "changeSubselectState('filterB', 'quota_size'); + changeSubselectState('filterB', 'quota_unit'); + changeSubselectState('filterB', 'gosaProxyQuotaPeriod');"; + } + } + + /* Assign filter settings */ + $smarty->assign("changeB",$changeB); + foreach(array("T","B","F") as $attr){ + if(in_array("filter".$attr,$this->multi_boxes)){ + $smarty->assign("use_filter".$attr,TRUE); + }else{ + $smarty->assign("use_filter".$attr,FALSE); + } + } + $smarty->assign("proxyAccountACL",$this->getacl("",$this->ReadOnly)); + $smarty->assign("use_proxy",in_array("proxy",$this->multi_boxes)); + $smarty->assign("multiple_support",$this->multiple_support_active); + $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__))); + return($display); + } + + + /*! \brief Removes proxy account from current object + */ + public function remove_from_parent() + { + if($this->acl_is_removeable() && $this->initially_was_account){ + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events("remove",array("uid" => $this->uid)); + } + } + + + /*! \brief Check given input + @return array Returns an array of error messages + */ + public function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + /* We've got only one value to check for positive integer or emtpy field */ + if ($this->is_account){ + if($this->acl_is_writeable("gosaProxyQuota")){ + if (isset($_POST["quota_size"])){ + if ($_POST["quota_size"] == "gosaProxyQuota"){ + $message[]= _("Numerical value for Quota Setting is empty."); + }elseif ($_POST["quota_size"] <= 0){ + $message[]= _("Numerical value for Quota Setting is not valid."); + } + } + } + } + return $message; + } + + /*! \brief Save POST data to object + */ + public function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['proxy'])){ + if (!$this->is_account && $_POST['proxy'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + /* Save flag value */ + if ($this->is_account || $this->multiple_support_active){ + + $flags= ""; + $acl= ""; + foreach(array("F", "T", "B") as $key){ + if($this->acl_is_writeable("gosaProxyFlag".$key)){ + + /* Add acl */ + if (isset($_POST["filter$key"])){ + $flags.= $key; + } + }else{ + + /* Keep all flags that can't be written*/ + if(preg_match("/".$key."/",$this->gosaProxyAcctFlags)){ + $flags .=$key; + } + } + } + if ("[$flags]" != $this->gosaProxyAcctFlags){ + $this->is_modified= TRUE; + } + $this->gosaProxyAcctFlags= "[$flags]"; + + /* Save time values */ + if ($this->acl_is_writeable("gosaProxyFlagT")){ + if(isset($_POST['startMinute'])){ + $old= $this->gosaProxyWorkingStart; + $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"]; + $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified; + } + + if (isset($_POST['stopMinute'])){ + $old= $this->gosaProxyWorkingStop; + $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"]; + $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified; + } + } + + /* Save quota values */ + if ($this->acl_is_writeable("gosaProxyFlagB")){ + if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){ + $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"]; + } + } + + /*Save quota period */ + if($this->acl_is_writeable("gosaProxyFlagB")){ + if(isset($_POST["gosaProxyQuotaPeriod"])){ + $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"]; + } + } + } + } + + + /*! \brief Save settings to ldap + */ + public function save() + { + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + + } + + + /*! \brief Static Function returning an ACL information array. + @return Array Returns an ACL array + */ + static function plInfo() + { + return (array( + "plShortName" => _("Proxy"), + "plDescription" => _("Proxy account")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 21, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array( + "gosaProxyFlagF" => _("Filter unwanted content"), + "gosaProxyFlagT" => _("Limit proxy access"), + "gosaProxyFlagB" => _("Restrict proxy usage by quota")) + )); + } + + + /*! \brief Save html POSTs in multiple edit. + */ + public function multiple_save_object() + { + if (isset($_POST['connectivityTab'])){ + plugin::multiple_save_object(); + if(isset($_POST['use_proxy'])){ + $this->multi_boxes[] = "proxy"; + } + foreach(array("T","B","F") as $attr){ + if(isset($_POST["use_filter".$attr])){ + $this->multi_boxes[] = "filter".$attr; + } + } + $this->save_object(); + } + } + + + /*! \brief Returns all modified values. \ + All selected an modified values will be returned \ + in an array. + @return array Returns an array containing all attribute modifications + */ + public function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("proxy",$this->multi_boxes)){ + $ret['is_account'] = $this->is_account; + } + + if(in_array("filterT",$this->multi_boxes)){ + $ret['gosaProxyWorkingStart'] = $this->gosaProxyWorkingStart; + $ret['gosaProxyWorkingStop'] = $this->gosaProxyWorkingStop; + } + if(in_array("filterB",$this->multi_boxes)){ + $ret['gosaProxyQuota'] = $this->gosaProxyQuota; + $ret['gosaProxyQuotaPeriod'] = $this->gosaProxyQuotaPeriod; + } + + foreach(array("B","T","F") as $attr){ + $name = "filter".$attr; + if(in_array($name,$this->multi_boxes)){ + $ret[$name] = preg_match("/".$attr."/",$this->gosaProxyAcctFlags); + } + } + + return($ret); + } + + + /*! \brief Sets modified attributes in mutliple edit. \ + All collected values from "get_multi_edit_values()" \ + will be applied to this plugin. + @param array An array containing modified attributes returned by get_multi_edit_values(); + */ + public function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + if(isset($values['is_account'])){ + $this->is_account = $values['is_account']; + } + foreach(array("B","T","F") as $attr){ + $name = "filter".$attr; + if(isset($values[$name])){ + if($values[$name] && !preg_match("/".$attr."/",$this->gosaProxyAcctFlags)){ + $this->gosaProxyAcctFlags = preg_replace("/\]/",$attr."]",$this->gosaProxyAcctFlags); + }elseif(!$values[$name] && preg_match("/".$attr."/",$this->gosaProxyAcctFlags)){ + $this->gosaProxyAcctFlags = preg_replace("/".$attr."/","",$this->gosaProxyAcctFlags); + } + } + } + } + + + /*! \brief Initialize multiple edit ui for this plugin. \ + This function sets plugin defaults in multiple edit. + @param array Attributes used in all object + @param array All used attributes. + */ + public function init_multiple_support($attrs,$all) + { + plugin::init_multiple_support($attrs,$all); + if(isset($attrs['objectClass']) && in_array("gosaProxyAccount",$attrs['objectClass'])){ + $this->is_account = TRUE; + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/squid/personal/connectivity/squid/proxy.tpl b/gosa-plugins/squid/personal/connectivity/squid/proxy.tpl new file mode 100644 index 000000000..4f6ac1ea7 --- /dev/null +++ b/gosa-plugins/squid/personal/connectivity/squid/proxy.tpl @@ -0,0 +1,130 @@ +

+ +{if $multiple_support} + + + + +{else} + + {render acl=$proxyAccountACL} + + {/render} +{/if} + {t}Proxy account{/t}

+ + + + + +
+ + + + + + + +
+ +{render acl=$gosaProxyFlagFACL checkbox=$multiple_support checked=$use_filterF} + +{/render} + {t}Filter unwanted content (i.e. pornographic or violence related){/t} +
+ +{render acl=$gosaProxyFlagTACL checkbox=$multiple_support checked=$use_filterT} + +{/render} + + +
+ + + + +
+ +{render acl=$gosaProxyFlagTACL} + +{/render} +  :  +{render acl=$gosaProxyFlagTACL} + +{/render} +  -  +{render acl=$gosaProxyFlagTACL} + +{/render} +  :  +{render acl=$gosaProxyFlagTACL} + +{/render} +
+
+   + +{render acl=$gosaProxyFlagBACL checkbox=$multiple_support checked=$use_filterB} + +{/render} + +
+ + + + +
+{render acl=$gosaProxyFlagBACL} + +{/render} +   +{render acl=$gosaProxyFlagBACL} + +{/render} + + +{render acl=$gosaProxyFlagBACL} + +{/render} +
+
+
+ diff --git a/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc b/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc new file mode 100644 index 000000000..4d7c179de --- /dev/null +++ b/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc @@ -0,0 +1,217 @@ +attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + } + + function execute() + { + /* Call parent execute */ +// plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","users/".get_class($this),$this->dn); + } + + /* Show tab dialog headers */ + $display= ""; + + /* Show main page */ + $smarty= get_smarty(); + + if ($this->is_account){ + $smarty->assign("webdavState", "checked"); + } else { + $smarty->assign("webdavState", ""); + $smarty->assign("wstate", "disabled"); + } + + if ($this->parent !== NULL){ + $smarty->assign("tabbed", 1); + } + + $smarty->assign('webdavAccountACL', $this->getacl("",$this->ReadOnly)); + $smarty->assign("use_webdav",in_array("webdav",$this->multi_boxes)); + $smarty->assign("multiple_support",$this->multiple_support_active); + $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + function remove_from_parent() + { + if($this->acl_is_createable() || $this->is_account){ + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } + + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/webDAV account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove',array("uid" => $this->uid)); + } + } + + + /* Save data to object */ + function save_object() + { + /* Do we need to flip is_account state? */ + if (isset($_POST['connectivityTab'])){ + if (isset($_POST['webdav'])){ + if (!$this->is_account && $_POST['webdav'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + + plugin::save_object(); + if (isset($_POST["WEBDAVStatus"])){ + $this->WEBDAVStatus = "disabled"; + } else { + $this->WEBDAVStatus = "enabled"; + } + } + + + /* Save to LDAP */ + function save() + { + if($this->acl_is_createable()){ + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + /* Log last action */ + if($this->initially_was_account){ + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/webDAV account with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } + } else { + $this->handle_post_events("add",array("uid" => $this->uid)); + } + } + } + + /* Return plugin informations for acl handling + #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */ + static function plInfo() + { + return (array( + "plShortName" => _("WebDAV"), + "plDescription" => _("WebDAV account")." : "._("Connectivity addon")."", + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 23, // Position in tabs + "plSection" => array("personal" => _("My account")), + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array() + )); + } + + function multiple_save_object() + { + if (isset($_POST['connectivityTab'])){ + plugin::multiple_save_object(); + + if(isset($_POST['use_webdav'])){ + $this->multi_boxes[] = "webdav"; + if (isset($_POST['webdav'])){ + if (!$this->is_account && $_POST['webdav'] == "B"){ + if($this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + } else { + if($this->acl_is_removeable()){ + $this->is_account= FALSE; + } + } + } + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("webdav",$this->multi_boxes)){ + $ret['is_account'] = $this->is_account; + } + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + if(isset($values['is_account'])){ + $this->is_account = $values['is_account']; + } + } + + function init_multiple_support($attrs,$all) + { + plugin::init_multiple_support($attrs,$all); + if(isset($attrs['objectClass']) && in_array("gosaWebdavAccount",$attrs['objectClass'])){ + $this->is_account = TRUE; + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/webdav/personal/connectivity/webdav/webdav.tpl b/gosa-plugins/webdav/personal/connectivity/webdav/webdav.tpl new file mode 100644 index 000000000..df52197a5 --- /dev/null +++ b/gosa-plugins/webdav/personal/connectivity/webdav/webdav.tpl @@ -0,0 +1,6 @@ +

+{render acl=$webdavAccountACL checkbox=$multiple_support checked=$use_webdav} + +{/render} + {t}WebDAV account{/t} +