1 <?php
2 class mimetype extends plugin
3 {
4 /* CLI vars */
5 var $cli_summary = "This tab allows you to modify, add or remove mime types in the selected department.";
6 var $cli_description = "Management dialog to handle mime types";
7 var $ignore_account = true; // This is always a valid account
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 var $objectclasses = array("top","gotoMimeType");
10 var $attributes = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
11 "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
12 "gotoMimeGroup");
14 /* Class vars */
15 var $ui;
16 var $cn = "";
17 var $gotoMimeLeftClickAction = "I";
18 var $gotoMimeLeftClickAction_I = true;
19 var $gotoMimeLeftClickAction_E = false;
20 var $gotoMimeLeftClickAction_Q = false;
21 var $gotoMimeIcon = "*removed*";
22 var $description = "";
23 var $gotoMimeFilePattern = array();
24 var $gotoMimeApplication = array();
25 var $gotoMimeEmbeddedApplication = array();
26 var $gotoMimeGroup = "";
27 var $iconData = NULL;
28 var $base = "";
30 /* To prevent errors when using the 'apply' button, we use this variables
31 to manage array attributes */
32 var $use_gotoMimeIcon = NULL;
33 var $use_gotoMimeFilePattern = array();
34 var $use_gotoMimeApplication = array();
35 var $use_gotoMimeEmbeddedApplication = array();
37 /* divLists */
38 var $DivPatterns = NULL;
39 var $DivApps = NULL;
40 var $DivEApps = NULL;
42 /* Mime type release mode */
43 var $isReleaseMimeType = false;
44 var $dialog = NULL;
46 /* These vars will be copied too, if you use copy&paste mode */
47 var $CopyPasteVars = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
48 "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
50 var $view_logged = FALSE;
52 /* Select options */
53 var $MimeGroups = array("application","audio","chemical","image","inode","message","model",
54 "multipart","text","video","x-conference","x-world");
56 /* Orig_Dn is used to verify if this object is new or only edited */
57 var $orig_dn = "";
58 var $acl ="";
60 function mimetype($config,$dn= NULL)
61 {
62 plugin::plugin ($config, $dn);
64 /* Save original dn */
65 $this->orig_dn = $dn;
67 $this->ui = get_userinfo();
69 /* get gotoMimeLeftClickActions I/E/Q */
70 if(isset($this->gotoMimeLeftClickAction)){
71 $str = $this->gotoMimeLeftClickAction;
72 for($i = 0 ; $i < strlen($str) ; $i ++ ){
73 $varna = "gotoMimeLeftClickAction_". $str[$i];
74 if(isset($this->$varna)){
75 $this->$varna = true;
76 }
77 }
78 }
80 /* If both radio buttons arn't set, set option I */
81 if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
82 $this->gotoMimeLeftClickAction_I = true;
83 }
85 /* Get list of array attributes */
86 foreach(array("gotoMimeFilePattern") as $attr){
87 $this->$attr = array();
88 if(isset($this->attrs[$attr])){
89 $tmp = array();
90 for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
91 $str = $this->attrs[$attr][$i];
92 $tmp[] = $str;
93 }
94 $use_attr = "use_".$attr;
95 $this->$use_attr = $tmp;
96 }
97 }
99 /* Get list of array attributes with priority tag ( Test|32 )*/
100 foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
101 $this->$attr = array();
102 if(isset($this->attrs[$attr])){
103 $tmp = array();
104 for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
105 $str = $this->attrs[$attr][$i];
106 $tmp2= split("\|",$str);
108 if(count($tmp2) == 2){
109 $name = $tmp2[0];
110 $prio = $tmp2[1];
111 $tmp[$prio] = $name;
112 }
113 }
114 ksort($tmp);
115 $use_attr = "use_".$attr;
116 $this->$use_attr = $tmp;
117 }
118 }
120 /* Check if release Management is enabled */
121 $tmp = search_config($this->config->data,"faiManagement","CLASS");
122 if(!empty($tmp)) {
123 $this->isReleaseMimeType= true;
124 }
126 /* Set base */
127 if ($this->dn == "new"){
128 if(isset($_SESSION['CurrentMainBase'])){
129 $this->base= $_SESSION['CurrentMainBase'];
130 }else{
131 $ui= get_userinfo();
132 $this->base= dn2base($ui->dn);
133 }
134 } else {
135 $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
136 }
138 /* Get icon data */
139 if(isset($this->attrs['gotoMimeIcon'])){
140 $ldap = $this->config->get_ldap_link();
141 $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
142 $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
143 }
144 if ($this->iconData == ""){
145 $this->set_new_picture("");
146 }
147 $_SESSION['binary'] = $this->iconData;
148 $_SESSION['binarytype'] = "image/jpeg";
149 }
152 function execute()
153 {
154 $smarty = get_smarty();
156 if(!$this->view_logged){
157 $this->view_logged =TRUE;
158 }
160 foreach($this->attributes as $name){
161 $smarty->assign($name."ACL", chkacl($this->acl,$name));
162 }
164 /* Base select dialog */
165 $once = true;
166 foreach($_POST as $name => $value){
167 if(preg_match("/^chooseBase/",$name) && $once){
168 $once = false;
169 $this->dialog = new baseSelectDialog($this->config,$this,$this->config->idepartments);
170 $this->dialog->setCurrentBase($this->base);
171 }
172 }
174 /* Dialog handling */
175 if(is_object($this->dialog)){
177 /* Must be called before save_object */
178 $this->dialog->save_object();
180 if($this->dialog->isClosed()){
181 $this->dialog = false;
182 }elseif($this->dialog->isSelected()){
184 /* A new base was selected, check if it is a valid one */
185 $tmp = $this->config->idepartments;
186 if(isset($tmp[$this->dialog->isSelected()])){
187 $this->base = $this->dialog->isSelected();
188 }
190 $this->dialog= false;
191 }else{
192 return($this->dialog->execute());
193 }
194 }
196 /* Check Posts */
197 $posts = array(
198 "/^Pattern_SortUp_/" => array("Action" => "Pattern_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeFilePattern"),
199 "/^Pattern_SortDown_/" => array("Action" => "Pattern_SortDown","Func" => "ArrayDown", "Attr" => "use_gotoMimeFilePattern"),
200 "/^Pattern_Remove_/" => array("Action" => "Pattern_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
201 "/^Apps_SortUp_/" => array("Action" => "Apps_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeApplication"),
202 "/^Apps_SortDown_/" => array("Action" => "Apps_SortDown", "Func" => "ArrayDown", "Attr" => "use_gotoMimeApplication"),
203 "/^Apps_Remove_/" => array("Action" => "Apps_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
204 "/^EApps_SortUp_/" => array("Action" => "EApps_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeEmbeddedApplication"),
205 "/^EApps_SortDown_/" => array("Action" => "EApps_SortDown", "Func" => "ArrayDown", "Attr" => "use_gotoMimeEmbeddedApplication"),
206 "/^EApps_Remove_/" => array("Action" => "EApps_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));
207 $once = true;
209 /* Walk through posts and try to find some commands for us. */
210 foreach($_POST as $name => $value){
212 /* Walk through possible commands */
213 foreach($posts as $regex => $action){
215 /* Check if there is a command posted */
216 if(preg_match($regex,$name) && $once){
217 $once = false;
219 /* Get action vars */
220 $func = $action['Func']; // Get function name
221 $attr = $action['Attr']; // Get attribute name
223 /* Get entry id */
224 $s_entry = preg_replace($regex,"",$name);
225 $s_entry = preg_replace("/_[xy]$/","",$s_entry);
227 /* Execute a command with the given attribute and entry
228 e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
229 if(chkacl($this->acl,$attr)){
230 $this->$attr= $this->$func($s_entry,$this->$attr,true);
231 }
232 }
233 }
234 }
236 /* Set a new icon was requested */
237 if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
238 $this->set_new_picture($_FILES['picture_file']['tmp_name']);
239 }
241 /* Add gotoMimeFilePattern */
242 if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
243 if(chkacl($this->acl,"gotoMimeFilePattern") == ""){
244 $str = $_POST['NewFilePattern'];
245 if(!empty($str)){
246 $this->use_gotoMimeFilePattern[] = $str;
247 }
248 }
249 }
251 /* Add gotoMimeFilePattern */
252 if(isset($_POST['AddNewApplication']) && isset($_POST['NewApplication'])){
253 if(chkacl($this->acl,"gotoMimeApplication") == ""){
254 $str = $_POST['NewApplication'];
255 if(!empty($str)){
256 $this->use_gotoMimeApplication[] = $str;
257 }
258 }
259 }
261 /* Add gotoMimeFilePattern */
262 if(isset($_POST['AddNewEmbeddedApplication']) && isset($_POST['NewEmbeddedApplication'])){
263 if(chkacl($this->acl,"gotoMimeEmbeddedApplication") == ""){
264 $str = $_POST['NewEmbeddedApplication'];
265 if(!empty($str)){
266 $this->use_gotoMimeEmbeddedApplication[] = $str;
267 }
268 }
269 }
271 /* Create divlists */
272 $DivPatterns = new DivSelectBox("gotoMimePatterns");
273 $DivApps = new DivSelectBox("gotoMimeApplications");
274 $DivEApps = new DivSelectBox("gotoMimeEmbeddedApplications");
275 $DivPatterns -> SetHeight(100);
276 $DivApps -> SetHeight(100);
277 $DivEApps -> SetHeight(100);
280 if(chkacl($this->acl,"gotoMimeFilePattern") == ""){
281 $Pattern_Actions= " <input type='image' src='images/sort_up.png' class='center' name='Pattern_SortUp_%s' >
282 <input type='image' src='images/sort_down.png' class='center' name='Pattern_SortDown_%s'>
283 <input type='image' src='images/edittrash.png' class='center' name='Pattern_Remove_%s'>";
284 }else{
285 $Pattern_Actions= "";
286 }
288 if(chkacl($this->acl,"gotoMimeApplication") == ""){
289 $Apps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='Apps_SortUp_%s' >
290 <input type='image' src='images/sort_down.png' class='center' name='Apps_SortDown_%s'>
291 <input type='image' src='images/edittrash.png' class='center' name='Apps_Remove_%s'>";
292 }else{
293 $Apps_Actions= "";
294 }
296 if(chkacl($this->acl,"gotoMimeEmbeddedApplication") == ""){
297 $EApps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='EApps_SortUp_%s' >
298 <input type='image' src='images/sort_down.png' class='center' name='EApps_SortDown_%s'>
299 <input type='image' src='images/edittrash.png' class='center' name='EApps_Remove_%s'>";
300 }else{
301 $EApps_Actions= "";
302 }
304 /* Before adding some entries check acls */
305 foreach($this->use_gotoMimeFilePattern as $key => $pattern){
306 $field1 = array("string" => $pattern);
307 $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
308 $fields = array($field1,$field2);
309 $DivPatterns -> AddEntry($fields);
310 }
312 foreach($this->use_gotoMimeApplication as $key => $pattern){
313 $field1 = array("string" => $pattern);
314 $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
315 $fields = array($field1,$field2);
316 $DivApps -> AddEntry($fields);
317 }
318 foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
319 $field1 = array("string" => $pattern);
320 $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
321 $fields = array($field1,$field2);
322 $DivEApps -> AddEntry($fields);
323 }
324 $smarty->assign("bases", $this->config->idepartments);
325 $smarty->assign("base_select", $this->base);
326 $smarty->assign("isReleaseMimeType", $this->isReleaseMimeType);
327 $smarty->assign("gotoMimeFilePatterns", $DivPatterns->DrawList());
328 $smarty->assign("gotoMimeApplications", $DivApps->DrawList());
329 $smarty->assign("gotoMimeEmbeddedApplications", $DivEApps->DrawList());
331 /* Assign class vars to smarty */
332 foreach($this->attributes as $attr){
333 $smarty->assign($attr,$this->$attr);
334 }
336 /* Assign additional vars that are not included in attributes*/
337 foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
338 $smarty->assign($attr,$this->$attr);
339 }
341 /* Assign select box options */
342 $smarty->assign("gotoMimeGroups",$this->MimeGroups);
343 $smarty->assign("gotoMimeIcon" ,$this->get_picture());
344 return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
345 }
348 function save_object()
349 {
350 if(isset($_POST['MimeGeneric'])){
352 /* Create a base backup and reset the
353 base directly after calling plugin::save_object();
354 Base will be set seperatly a few lines below */
355 $base_tmp = $this->base;
356 plugin::save_object();
357 $this->base = $base_tmp;
359 /* Only save base if we are not in release mode */
360 if(!$this->isReleaseMimeType){
362 /* Set new base if allowed */
363 $tmp = $this->config->idepartments;
364 if(isset($_POST['base'])){
365 if(isset($tmp[$_POST['base']])){
366 $this->base= $_POST['base'];
367 }
368 }
370 }
372 /* Save radio buttons */
373 if(chkacl($this->acl,"gotoMimeLeftClickAction") == ""){
374 if(isset($_POST['gotoMimeLeftClickAction_IE'])){
375 $chr = $_POST['gotoMimeLeftClickAction_IE'];
376 if($chr == "E"){
377 $this->gotoMimeLeftClickAction_E = true;
378 $this->gotoMimeLeftClickAction_I = false;
379 }else{
380 $this->gotoMimeLeftClickAction_E = false;
381 $this->gotoMimeLeftClickAction_I = true;
382 }
383 }
384 if(isset($_POST['gotoMimeLeftClickAction_Q'])){
385 $this->gotoMimeLeftClickAction_Q = true;
386 }else{
387 $this->gotoMimeLeftClickAction_Q = false;
388 }
389 }
390 }
391 }
394 /* save current changes */
395 function save()
396 {
397 /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */
398 $arr = array ("E","I","Q");
399 $str = "";
400 foreach ($arr as $Chr){
401 $var = "gotoMimeLeftClickAction_".$Chr;
402 if($this->$var){
403 $str .= $Chr;
404 }
405 }
406 $this->gotoMimeLeftClickAction = $str;
408 /* Create array entries with priority tag ( Test|3 )*/
409 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
410 $i = 0;
411 $use_attr = "use_".$attr;
412 $tmp = array();
413 $this->$attr = array();
414 foreach($this->$use_attr as $entry){
415 $tmp[] = $entry."|".$i ++;
416 }
417 $this->$attr = $tmp;
418 }
420 /* Create array entries */
421 foreach(array("gotoMimeFilePattern") as $attr){
422 $i = 0;
423 $use_attr = "use_".$attr;
424 $tmp = array();
425 $this->$attr = array();
426 foreach($this->$use_attr as $entry){
427 $tmp[] = $entry;
428 }
429 $this->$attr = $tmp;
430 }
432 /* Remove Icon if requested */
433 if($this->use_gotoMimeIcon != "*removed*"){
434 $this->gotoMimeIcon = $this->iconData;
435 }else{
436 $this->gotoMimeIcon = "";
437 }
439 plugin::save();
441 /* If this is a newly created object, skip storing those
442 attributes that contain an empty array */
443 if($this->orig_dn == "new"){
444 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
445 if(!count($this->$attr)){
446 unset($this->attrs[$attr]);
447 }
448 }
449 }
451 $ldap = $this->config->get_ldap_link();
452 $ldap-> cd ( $this->config->current['BASE']);
453 $ldap->cat($this->dn);
454 if($ldap->count()){
455 $ldap->cd($this->dn);
456 $this->cleanup();
457 $ldap->modify($this->attrs);
458 }else{
459 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
460 $ldap->cd($this->dn);
461 $ldap->add($this->attrs);
462 }
463 show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
464 }
467 /* Remove current mime type */
468 function remove_from_parent()
469 {
470 plugin::remove_from_parent();
471 $ldap = $this->config->get_ldap_link();
472 $ldap->rmDir($this->dn);
473 show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
475 /* Optionally execute a command after we're done */
476 $this->handle_post_events("remove");
478 /* Delete references to object groups */
479 $ldap->cd ($this->config->current['BASE']);
480 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
481 while ($ldap->fetch()){
482 $og= new ogroup($this->config, $ldap->getDN());
483 unset($og->member[$this->dn]);
484 $og->save ();
485 show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
486 }
487 }
490 /* Check given values */
491 function check()
492 {
493 $message = plugin::check();
494 if(empty($this->cn)){
495 $message[] = _("Please specify a valid name for this mime type.");
496 }
497 if(!count($this->use_gotoMimeFilePattern)){
498 $message[] = _("Please specify at least one file pattern.") ;
499 }
501 /* Check if there is already a mime type with this cn */
502 $ldap = $this->config->get_ldap_link();
503 $ldap->cd($this->config->current["BASE"]);
504 if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
505 $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
506 $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
507 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
508 if($ldap->count()){
509 $attrs = $ldap->fetch();
510 if($this->dn != $attrs['dn']) {
511 $message[]= _("There's already a mime type with this 'Name'.");
512 }
513 }
514 }else{
515 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
516 if ($ldap->count()){
517 $attrs = $ldap->fetch();
518 if($this->dn != $attrs['dn']) {
519 $message[]= _("There's already an mime with this 'Name'.");
520 }
521 }
522 }
524 return($message);
525 }
527 /** Helper functions **/
529 /* Set a new picture */
530 function set_new_picture($filename)
531 {
532 if (empty($filename)){
533 $filename= "./images/default_icon.png";
534 $this->use_gotoMimeIcon= "*removed*";
535 }else{
536 $this->use_gotoMimeIcon= $filename;
537 }
539 if (file_exists($filename)){
540 $fd = fopen ($filename, "rb");
541 $this->iconData= fread ($fd, filesize ($filename));
542 $_SESSION['binary']= $this->iconData;
543 $_SESSION['binarytype']= "image/jpeg";
544 fclose ($fd);
545 }
546 }
548 /* Get picture link */
549 function get_picture()
550 {
551 $_SESSION['binary']= $this->iconData;
552 $_SESSION['binarytype']= "image/jpeg";
553 return("getbin.php");
554 }
556 /* Transports the given Arraykey one position up*/
557 function ArrayUp($atr,$attrs)
558 {
559 $ret = $attrs;
560 $pos = $this->getpos($atr,$attrs) ;
561 $cn = count($attrs);
562 if(!(($pos == -1)||($pos == 1))){
563 $before = array_slice($attrs,0,($pos-2));
564 $mitte = array_reverse(array_slice($attrs,($pos-2),2));
565 $unten = array_slice($attrs,$pos);
566 $ret = array();
567 $ret = $this->combineArrays($before,$mitte,$unten);
568 }
569 return($ret);
570 }
573 /* Transports the given Arraykey one position down*/
574 function ArrayDown($atr,$attrs)
575 {
576 $ret = $attrs;
577 $pos = $this->getpos($atr,$attrs) ;
578 $cn = count($attrs);
579 if(!(($pos == -1)||($pos == $cn))){
580 $before = array_slice($attrs,0,($pos-1));
581 $mitte = array_reverse(array_slice($attrs,($pos-1),2));
582 $unten = array_slice($attrs,($pos+1));
583 $ret = array();
584 $ret = $this->combineArrays($before,$mitte,$unten);
585 }
586 return($ret);
587 }
590 /* return the position of the element in the array */
591 function getpos($atr,$attrs)
592 {
593 $i = 0;
594 foreach($attrs as $attr => $name) {
595 $i++;
596 if($attr == $atr){
597 return($i);
598 }
599 }
600 return(-1);
601 }
604 /* Remove this element from array */
605 function ArrayRemove($key,$array,$reorder = false)
606 {
607 if(isset($array[$key])){
608 unset($array[$key]);
609 if($reorder){
610 $tmp = array();
611 foreach($array as $entry){
612 $tmp[] = $entry;
613 }
614 $array = $tmp;
615 }
616 }
617 return($array);
618 }
621 /* Combine new array */
622 function combineArrays($ar0,$ar1,$ar2)
623 {
624 $ret = array();
625 if(is_array($ar0))
626 foreach($ar0 as $ar => $a){
627 $ret[]=$a;
628 }
629 if(is_array($ar1))
630 foreach($ar1 as $ar => $a){
631 $ret[]=$a;
632 }
633 if(is_array($ar2))
634 foreach($ar2 as $ar => $a){
635 $ret[]=$a;
636 }
637 return($ret);
638 }
641 /* Return a dialog with all fields that must be changed,
642 if we want to copy this entry */
643 function getCopyDialog()
644 {
645 $str = "";
647 $smarty = get_smarty();
648 $smarty->assign("cn", $this->cn);
649 $smarty->assign("description", $this->description);
650 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
652 $ret = array();
653 $ret['string'] = $str;
654 $ret['status'] = "";
655 return($ret);
656 }
659 /* Save all */
660 function saveCopyDialog()
661 {
662 $attrs = array("cn","description");
663 foreach($attrs as $attr){
664 if(isset($_POST[$attr])){
665 $this->$attr = $_POST[$attr];
666 }
667 }
668 }
671 function PrepareForCopyPaste($source)
672 {
673 plugin::PrepareForCopyPaste($source);
675 $source_o = new mimetype($this->config,$source->dn,$this->parent);
677 foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
678 $use_attr = "use_".$name;
679 if(isset($this->$use_attr)){
680 $this->$use_attr= $source_o->$use_attr;
681 }
682 $this->$name = $source_o->$name;
683 }
684 foreach($this->attributes as $name){
685 $this->$name = $source_o->$name;
686 }
688 if($this->iconData){
689 $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
690 }
691 }
692 }
693 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
694 ?>