diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
index d5ccca44abdbe2960898274471e28da15f8a9784..59a67c8b8dcdb9d9541ff37fe34525d738127231 100644 (file)
"gosaApplicationFlags","gotoLogonScript");
var $objectclasses= array("top", "gosaApplication");
+ var $FAIstate ="";
function application (&$config, $dn= NULL, $parent= NULL)
{
$this->base= dn2base($ui->dn);
}
} else {
- $this->base= preg_replace ("/^[^,]+,".get_ou('applicationou')."/", "", $this->dn);
+ $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou('applicationRDN'), '/')."/i", "", $this->dn);
}
$this->orig_cn = $this->cn;
$this->orig_base = $this->base;
+ $this->gosaApplicationFlags = preg_replace("/[^GDLMO]/","",$this->gosaApplicationFlags);
}
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translation){
- $smarty->assign($name."ACL",$this->getacl($name));
+ $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate)));
}
+ $smarty->assign("IconReadable", $this->acl_is_readable("gosaApplicationIcon"));
/* Do we represent a valid group? */
if (!$this->is_account && $this->parent === NULL){
$head = $this->generateTemplate();
$this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
- if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
+ if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile'])) && !preg_match("/freeze/i",$this->FAIstate)){
$str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
$this->gotoLogonScript = $str;
}
$smarty->assign("selectmode", "disabled");
}
- /* Base select dialog */
- $once = true;
- foreach($_POST as $name => $value){
- if(preg_match("/^chooseBase/",$name) && $once){
- $once = false;
- $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
- $this->dialog->setCurrentBase($this->base);
- }
- }
-
- /* Dialog handling */
- if(is_object($this->dialog)){
- /* Must be called before save_object */
- $this->dialog->save_object();
-
- if($this->dialog->isClosed()){
- $this->dialog = false;
- }elseif($this->dialog->isSelected()){
-
- /* Just allow selection valid bases */
- $tmp = $this->get_allowed_bases();
- if(isset($tmp[$this->dialog->isSelected()])){
- $this->base = $this->dialog->isSelected();
- }
- $this->dialog= false;
- }else{
- return($this->dialog->execute());
- }
- }
-
/* Get random number for pictures */
srand((double)microtime()*1000000);
$smarty->assign("rand", rand(0, 10000));
}
/* Checkboxes */
- foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
- "L" => "place_on_kicker",
- "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
- if (preg_match("/$key/", $this->gosaApplicationFlags)){
+ foreach (array("G" => "execForGroupmembers", "O" => "overwriteConfig",
+ "L" => "placeOnKicker",
+ "D" => "placeOnDesktop", "M" => "placeInStartmenu") as $key => $val){
+ if (preg_match("/$key/", $this->gosaApplicationFlags) && $this->acl_is_readable("$val")){
$smarty->assign("$val", "checked");
} else {
$smarty->assign("$val", "");
restore_error_handler();
/* Parse release out of object dn */
- $release = preg_replace("/".get_ou("applicationou").normalizePreg($this->base)."$/","",$this->dn);
+ $release = preg_replace("/".preg_quote(get_ou("applicationRDN").$this->base, '/')."$/i","",$this->dn);
$release = preg_replace("/^cn=[^,]+,/","",$release);
/* Get a list of all groups
$ldap->cd($release.$group);
$ldap->search("(objectClass=gotoMenuEntry)",array("dn"));
while($attrs = $ldap->fetch()){
- $info = preg_replace("/".normalizePreg($release.$group)."$/","",$attrs['dn']);
+ $info = preg_replace("/".preg_quote($release.$group, '/')."$/","",$attrs['dn']);
if(preg_match("/^cn=".$this->cn."/",$info) && !preg_match("/ou=[^,]+,/",$info)){
$found[] = $attrs['dn'];
}
/* Save data to object */
function save_object()
{
+ if(preg_match("/freeze/i",$this->FAIstate)){
+ return;
+ }
+
if (isset($_POST['cn'])){
/* Create a base backup and reset the
/* Save attributes */
parent::save_object();
+ $checks = array("execForGroupmembers" => "G",
+ "placeOnDesktop" => "D",
+ "placeOnKicker" => "L",
+ "placeInStartmenu" => "M",
+ "overwriteConfig" => "O");
+
+
/* Save application flags */
- $flag= "";
- if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){
- $flag.= "G";
- }
- if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
- $flag.= "D";
- }
- if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
- $flag.= "L";
- }
- if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
- $flag.= "M";
- }
- if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){
- $flag.= "O";
- }
- if ($this->acl_is_writeable("gosaApplicationFlags")){
- $this->gosaApplicationFlags= "[$flag]";
+ foreach($checks as $name => $flag){
+ if($this->acl_is_writeable($name)){
+ $set = isset($_POST[$name]) && $_POST[$name] == 1;
+ if(!$set && strstr($this->gosaApplicationFlags,$flag)){
+ $this->gosaApplicationFlags = str_replace($flag,"",$this->gosaApplicationFlags);
+ }elseif($set && !preg_match("/".$flag."/",$this->gosaApplicationFlags)){
+ $this->gosaApplicationFlags .= $flag;
+ }
+ }
}
/* Remove current picture */
/* Permissions for that base? */
if ($this->base != ""){
- $new_dn= "cn=".$this->cn.",".get_ou('applicationou').$this->base;
+ $new_dn= "cn=".$this->cn.",".get_ou('applicationRDN').$this->base;
} else {
$new_dn= $this->dn;
}
$message[]= msgPool::required(_("Name"));
}
- if(preg_match("/[^a-z0-9]/",$this->cn)) {
+ if(preg_match("/[^a-z0-9_-]/",$this->cn)) {
$message[]=msgPool::invalid(_("Name"),$this->cn,"/^[a-z0-9_-]*$/");
}
if($this->is_release()){
$base = $this->parent->parent->app_release;
}else{
- $base = get_ou('applicationou').$this->base;
+ $base = get_ou('applicationRDN').$this->base;
}
$ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$base,array("cn"));
/* Get application script without header part, to check if we must save the script itself */
$script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
+ $this->gosaApplicationFlags ="[{$this->gosaApplicationFlags}]";
plugin::save();
$this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
function set_picture($filename)
{
if (!is_file($filename)){
- $filename= "./images/default_icon.png";
+ $filename= "./plugins/goto/images/default_icon.png";
$this->gosaApplicationIcon= "*removed*";
}
{
$vars = array("cn");
- $str ="<h2>"._("Application settings")."</h2>
- <table>
+ $str ="<h3>"._("Application settings")."</h3>
+ <table summary=\""._("Application settings")."\">
<tr>
<td>".
_("Application name").
"gosaApplicationExecute" => _("Execute"),
"gosaApplicationName" => _("Name"),
"gosaApplicationIcon" => _("Icon"),
- "gosaApplicationFlags" => _("Flag"),
"gotoLogonScript" => _("Script content"),
- "exec_for_groupmembers" => _("Only executable for members"), // G
- "place_on_desktop" => _("Place icon on members desktop"), // D
- "place_on_kicker" => _("Place entry in members launch bar"), // L
- "place_in_startmenu" => _("Place entry in members startmenu"), // M
- "overwrite_config" => _("Replace user configuration on startup")) // O
+ "execForGroupmembers" => _("Only executable for members"), // G
+ "placeOnDesktop" => _("Place icon on members desktop"), // D
+ "placeOnKicker" => _("Place entry in members launch bar"), // L
+ "placeInStartmenu" => _("Place entry in members startmenu"), // M
+ "overwriteConfig" => _("Replace user configuration on startup")) // O
));
}
}