1 <?php
2 /*
3 * This code is part of GOsa (http://www.gosa-project.org)
4 * Copyright (C) 2003-2008 GONICUS GmbH
5 *
6 * ID: $$Id: class_sudo.inc 9975 2008-03-25 14:09:30Z hickert $$
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
24 /*! \brief Sudo generic class. Allow setting User/Host/Command/Runas
25 for a sudo role object.
26 */
27 class sudo extends plugin
28 {
30 protected $cn= "";
31 protected $description= "";
33 protected $sudoUser = array("ALL");
34 protected $sudoCommand= array();
35 protected $sudoHost = array("ALL");
36 protected $sudoRunAs = array("ALL");
37 protected $accessTo = array();
38 protected $trustModel = "";
40 private $is_default = FALSE;
41 private $show_ws_dialog = FALSE;
42 private $was_trust_account= FALSE;
44 public $objectclasses = array("top","sudoRole");
45 public $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel");
47 public $ignore_account = TRUE;
49 public $orig_dn;
51 /*! \brief Returns to the base department for sudo roles.
52 This department is then used to store new roles.
53 @param Object GOsa configuration object.
54 @return String sudo store department
55 */
56 public static function get_sudoers_ou($config)
57 {
58 return(get_ou("sudoRDN").$config->current['BASE']);
59 }
61 /*! \brief Initializes this sudo class, with all required attributes.
62 @param Object $config GOsa configuration object.
63 @param String $db "new" or the sudo role dn.
64 @return .
65 */
66 function sudo(&$config, $dn= NULL)
67 {
68 plugin::plugin ($config, $dn);
70 if($this->initially_was_account){
71 foreach(array("sudoUser","sudoCommand","sudoHost","sudoRunAs") as $attr){
72 $this->$attr = array();
73 if(isset($this->attrs[$attr])){
74 $tmp = array();
75 for($i = 0 ; $i < $this->attrs[$attr]['count']; $i++){
76 $tmp[] = $this->attrs[$attr][$i];
77 }
78 $this->$attr = $tmp;
79 }
80 }
82 /* Is this account a trustAccount? */
83 if (isset($this->attrs['trustModel'])){
84 $this->trustModel= $this->attrs['trustModel'][0];
85 $this->was_trust_account= TRUE;
86 } else {
87 $this->was_trust_account= FALSE;
88 $this->trustModel= "";
89 }
91 $this->accessTo = array();
92 if (isset($this->attrs['accessTo'])){
93 for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){
94 $tmp= $this->attrs['accessTo'][$i];
95 $this->accessTo[$tmp]= $tmp;
96 }
97 }
99 }
101 if(preg_match("/^defaults$/i",$this->cn)){
102 $this->is_default = TRUE;
103 }
105 /* Get global filter config */
106 if (!session::is_set("sysfilter")){
107 $ui= get_userinfo();
108 $base= get_base_from_people($ui->dn);
109 $sysfilter= array( "depselect" => $base,
110 "regex" => "*");
111 session::set("sysfilter", $sysfilter);
112 }
114 $this->orig_dn = $this->dn;
115 }
118 /*! \brief Creates the sudo generic ui.
119 @return String The generated HTML content for this plugin.
120 */
121 function execute()
122 {
123 /* Call parent execute */
124 plugin::execute();
126 /*********************
127 Access control list / trust mode
128 *********************/
130 /* Add user workstation? */
131 if (isset($_POST["add_ws"])){
132 $this->show_ws_dialog= TRUE;
133 $this->dialog= TRUE;
134 }
136 /* Add user workstation? */
137 if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
138 foreach($_POST['wslist'] as $ws){
139 $this->accessTo[$ws]= $ws;
140 }
141 ksort($this->accessTo);
142 $this->is_modified= TRUE;
143 }
145 /* Remove user workstations? */
146 if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
147 foreach($_POST['workstation_list'] as $name){
148 unset ($this->accessTo[$name]);
149 }
150 $this->is_modified= TRUE;
151 }
153 /* Add user workstation finished? */
154 if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
155 $this->show_ws_dialog= FALSE;
156 $this->dialog= FALSE;
157 }
159 /* Show ws dialog */
160 if ($this->show_ws_dialog){
161 return($this->display_trust_add_dialog());
162 }
165 /*********************
166 Add users
167 *********************/
169 if(isset($_POST['list_sudoUser']) && !is_object($this->dialog) && $this->acl_is_writeable("sudoUser")){
170 $used = array();
171 foreach($this->sudoUser as $name){
172 $used[] = preg_replace("/^!/","",$name);
173 }
174 $this->dialog =new target_list_users($this->config,$used);
175 }
177 /* Add selected hosts to the sudoUser list */
178 if(isset($_POST['SaveMultiSelectWindow']) && $this->dialog instanceof target_list_users){
179 if($this->acl_is_writeable("sudoUser")){
180 foreach($this->dialog->save() as $entry){
181 if(in_array("posixGroup",$entry['objectClass'])){
182 $name = trim("%".$entry['cn'][0]);
183 }else{
184 $name = trim($entry['uid'][0]);
185 }
186 if(!in_array($name,$this->sudoUser) && !in_array("!".$name,$this->sudoUser)){
187 $this->sudoUser[] = $name;
188 }
189 }
190 }
191 unset($this->dialog);
192 $this->dialog = NULL;
193 }
196 /*********************
197 Add systems
198 *********************/
200 if(isset($_POST['list_sudoHost']) && !is_object($this->dialog) && $this->acl_is_writeable("sudoHost")){
201 $used = array();
202 foreach($this->sudoHost as $name){
203 $used[] = preg_replace("/^!/","",$name);
204 }
205 $this->dialog =new target_list_systems($this->config,$used);
206 }
208 /* Add selected hosts to the sudoHost list */
209 if(isset($_POST['SaveMultiSelectWindow']) && $this->dialog instanceof target_list_systems){
210 if($this->acl_is_writeable("sudoHost")){
211 foreach($this->dialog->save() as $entry){
212 $cn = trim($entry['cn'][0]);
213 if(!in_array($cn,$this->sudoHost) && !in_array("!".$cn,$this->sudoHost)){
214 $this->sudoHost[] = $cn;
215 }
216 }
217 }
218 unset($this->dialog);
219 $this->dialog = NULL;
220 }
223 /*********************
224 Dialog handling / display / close
225 *********************/
227 if(isset($_POST['CloseMultiSelectWindow']) && is_object($this->dialog)){
228 unset($this->dialog);
229 $this->dialog = NULL;
230 }
232 if(is_object($this->dialog)){
233 return($this->dialog->execute());
234 }
237 /*********************
238 NEGATE values
239 *********************/
240 foreach($_POST as $name => $value){
241 if(preg_match("/^neg_/",$name)){
242 $attr = preg_replace("/^neg_([^_]*)_.*$/","\\1",$name);
243 $value= preg_replace("/^neg_[^_]*_([0-9]*)_.*$/","\\1",$name);
245 if($this->acl_is_writeable($attr)){
246 $attrs = $this->$attr;
247 if(isset( $attrs[$value])){
248 $v = $attrs[$value];
249 if(preg_match("/^!/",$v)){
250 $attrs[$value] = preg_replace("/^!/","",$v);
251 }else{
252 $attrs[$value] = "!".$v;
253 }
254 $this->$attr = $attrs;
255 }
256 }
257 break; // Do it once, image inputs will be posted twice
258 }
259 }
261 /*********************
262 Delete values
263 *********************/
264 foreach($_POST as $name => $value){
265 if(preg_match("/^del_/",$name)){
266 $attr = preg_replace("/^del_([^_]*)_.*$/","\\1",$name);
267 $value= preg_replace("/^del_[^_]*_([0-9]*)_.*$/","\\1",$name);
268 if($this->acl_is_writeable($attr)){
269 $attrs = $this->$attr;
270 if(isset( $attrs[$value])){
271 unset($attrs[$value]);
272 $this->$attr = $attrs;
273 }
274 }
275 break; // Do it once, image inputs will be posted twice
276 }
277 }
280 /*********************
281 ADD values
282 *********************/
284 /* User / Host / Runas */
285 foreach(array("sudoUser","sudoHost","sudoRunAs") as $attr){
286 if($this->acl_is_writeable($attr) &&
287 isset($_POST["add_".$attr]) &&
288 isset($_POST['new_'.$attr]) &&
289 !empty($_POST['new_'.$attr])){
290 if(preg_match("/^[a-z\.0-9]*$/i",$_POST['new_'.$attr])){
291 $attrs = $this->$attr;
292 $attrs[] = trim($_POST['new_'.$attr]);
293 $this->$attr = $attrs;
294 }else{
295 msg_dialog::display(_("Error"),msgPool::invalid($attr,$_POST['new_'.$attr],"/[a-z0-9]/"));
296 }
297 }
298 }
300 /* Command */
301 foreach(array("sudoCommand") as $attr){
302 if($this->acl_is_writeable($attr) && isset($_POST["add_".$attr]) && isset($_POST['new_'.$attr])){
303 $attrs = $this->$attr;
304 $attrs[] = trim($_POST['new_'.$attr]);
305 $this->$attr = $attrs;
306 }
307 }
310 /*********************
311 SMARTY assignments
312 *********************/
314 $smarty = get_smarty();
315 $smarty->assign("is_default",$this->is_default);
316 foreach($this->attributes as $attr){
317 if(is_string($this->$attr)){
318 $smarty->assign($attr,htmlentities($this->$attr));
319 }else{
320 $smarty->assign($attr,$this->$attr);
321 }
322 $smarty->assign($attr."ACL",$this->getacl($attr));
323 }
325 /* Work on trust modes */
326 $smarty->assign("trusthide", " disabled ");
327 if ($this->trustModel == "fullaccess"){
328 $trustmode= 1;
329 } elseif ($this->trustModel == "byhost"){
330 $trustmode= 2;
331 $smarty->assign("trusthide", "");
332 } else {
333 $trustmode= 0;
334 }
335 $smarty->assign("trustmode", $trustmode);
336 $smarty->assign("trustmodes", array(
337 0 => _("disabled"),
338 1 => _("full access"),
339 2 => _("allow access to these hosts")));
341 if((count($this->accessTo))==0){
342 $smarty->assign("emptyArrAccess",true);
343 }else{
344 $smarty->assign("emptyArrAccess",false);
345 }
346 $smarty->assign("workstations", $this->accessTo);
348 /* Create lists
349 */
350 $divlist_sudoUser = new divSelectBox("divlist_sudoUser");
351 $divlist_sudoUser->SetHeight("90");
352 $divlist_sudoHost = new divSelectBox("divlist_sudoHost");
353 $divlist_sudoHost->Setheight("90");
354 $divlist_sudoRunAs = new divSelectBox("divlist_sudoRunAs");
355 $divlist_sudoRunAs->Setheight("90");
356 $divlist_sudoCommand = new divSelectBox("divlist_sudoCommand");
357 $divlist_sudoCommand->Setheight("90");
359 /* Fill divlists
360 */
361 $neg_img= "<img src='plugins/sudo/images/negate.png' alt='!' class='center'>";
362 $option = "<input type='image' src='plugins/sudo/images/negate.png' name='neg_%ATTR%_%KEY%' class='center'>";
363 $option.= "<input type='image' src='images/lists/trash.png' name='del_%ATTR%_%KEY%' class='center'>";
364 foreach(array("sudoCommand","sudoHost","sudoRunAs") as $attr){
365 if($this->acl_is_readable($attr)){
366 foreach($this->$attr as $key => $entry){
367 $neg = "";
368 if(preg_match("/^!/",$entry)){
369 $neg = $neg_img;
370 }
371 $entry = preg_replace("/^!/","",$entry);
372 $list_name = "divlist_".$attr;
373 $$list_name->AddEntry(
374 array(
375 array("string" => $neg,"attach" => "style='width:18px;'"),
376 array("string" => $entry),
377 array("string" => preg_replace(array("/%KEY%/","/%ATTR%/"),array($key,$attr),$option),
378 "attach" => "style='width:40px; border-right: 0px;'")));
379 }
380 }
381 }
383 foreach(array("sudoUser") as $attr){
384 $img1 = "<img src='plugins/users/images/select_user.png' alt='"._("User")."' class='center'>";
385 $img2 = "<img src='plugins/groups/images/groups.png' alt='"._("Group")."' class='center'>";
386 if($this->acl_is_readable($attr)){
387 foreach($this->$attr as $key => $entry){
388 $neg = "";
389 if(preg_match("/^!/",$entry)){
390 $neg = $neg_img;
391 }
392 $entry = preg_replace("/^!/","",$entry);
394 $img = $img1;
395 if(preg_match("/^%/",$entry)){
396 $img = $img2;
397 }
398 $entry = preg_replace("/^%/","",$entry);
400 $list_name = "divlist_".$attr;
401 $$list_name->AddEntry(
402 array(
403 array("string" => $neg,"attach" => "style='width:18px;'"),
404 array("string" => $img,"attach" => "style='width:18px;'"),
405 array("string" => $entry),
406 array("string" => preg_replace(array("/%KEY%/","/%ATTR%/"),array($key,$attr),$option),
407 "attach" => "style='width:40px; border-right: 0px;'")));
408 }
409 }
410 }
415 /* Tell smarty about our divlists
416 */
417 $smarty->assign("divlist_sudoUser", $divlist_sudoUser->DrawList());
418 $smarty->assign("divlist_sudoHost", $divlist_sudoHost->DrawList());
419 $smarty->assign("divlist_sudoRunAs", $divlist_sudoRunAs->DrawList());
420 $smarty->assign("divlist_sudoCommand",$divlist_sudoCommand->DrawList());
421 return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
422 }
425 /*! \brief Remove this sudo role from the ldap server
426 */
427 function remove_from_parent()
428 {
429 plugin::remove_from_parent();
431 $ldap = $this->config->get_ldap_link();
432 $ldap->cd($this->dn);
433 $ldap->rmdir($this->dn);
435 /* Send signal to the world that we've done */
436 $this->handle_post_events("remove");
437 }
440 /*! \brief Save all relevant HTML posts.
441 */
442 function save_object()
443 {
444 plugin::save_object();
446 if($this->is_default){
447 $this->cn = "defaults";
448 }
450 if(is_object($this->dialog)){
451 $this->dialog->save_object();
452 }
454 /* Trust mode - special handling */
455 if($this->acl_is_writeable("trustModel")){
456 if (isset($_POST['trustmode'])){
457 $saved= $this->trustModel;
458 if ($_POST['trustmode'] == "1"){
459 $this->trustModel= "fullaccess";
460 } elseif ($_POST['trustmode'] == "2"){
461 $this->trustModel= "byhost";
462 } else {
463 $this->trustModel= "";
464 }
465 if ($this->trustModel != $saved){
466 $this->is_modified= TRUE;
467 }
468 }
469 }
470 }
473 /*! \brief Save changes into the ldap database.
474 */
475 function save()
476 {
477 plugin::save();
478 /* Trust accounts */
479 $objectclasses= array();
480 foreach ($this->attrs['objectClass'] as $key => $class){
481 if (preg_match('/trustAccount/i', $class)){
482 continue;
483 }
484 $objectclasses[]= $this->attrs['objectClass'][$key];
485 }
487 $this->attrs['objectClass']= $objectclasses;
488 if ($this->trustModel != ""){
489 $this->attrs['objectClass'][]= "trustAccount";
490 $this->attrs['trustModel']= $this->trustModel;
491 $this->attrs['accessTo']= array();
492 if ($this->trustModel == "byhost"){
493 foreach ($this->accessTo as $host){
494 $this->attrs['accessTo'][]= $host;
495 }
496 }
497 } else {
498 if ($this->was_trust_account){
499 $this->attrs['accessTo']= array();
500 $this->attrs['trustModel']= array();
501 }
502 }
505 /* Ensure a correct array index
506 */
507 $this->attrs['sudoHost'] = array_values($this->attrs['sudoHost']);
508 $this->attrs['sudoRunAs'] = array_values($this->attrs['sudoRunAs']);
509 $this->attrs['sudoUser'] = array_values($this->attrs['sudoUser']);
510 $this->attrs['sudoCommand'] = array_values($this->attrs['sudoCommand']);
512 $this->cleanup();
514 $ldap = $this->config->get_ldap_link();
515 $ldap->cd($this->config->current['BASE']);
517 if($this->is_new){
518 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
519 $ldap->cd($this->dn);
520 $ldap->add($this->attrs);
522 /* Send signal to the world that we've done */
523 $this->handle_post_events("create");
524 }else{
525 $ldap->cd($this->dn);
526 $ldap->modify($this->attrs);;
528 /* Send signal to the world that we've done */
529 $this->handle_post_events("modify");
530 }
532 if (!$ldap->success()){
533 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
534 }
535 }
538 /*! \brief Check the given input.
539 @return Array All error messages in an array();
540 */
541 function check()
542 {
543 $message = plugin::check();
545 /* Is a name given? */
546 if($this->cn == ""){
547 $message[] = msgPool::required(_("Name"));
548 }
550 /* Check if name is reserved */
551 if(!$this->is_default && preg_match("/^defaults$/i",$this->cn)){
552 $message[] = msgPool::reserved(_("Name"));
553 }
555 /* Check name */
556 if(!preg_match("/^[0-9a-z\@]*$/i",$this->cn)){
557 $message[] = msgPool::invalid(_("Name"),$this->cn,"/[0-9a-z\@]/i");
558 }
560 /* Check if this entry will cause duplicated ldap entries */
561 $ldap = $this->config->get_ldap_link();
562 $ldap->cd($this->get_sudoers_ou($this->config));
563 $ldap->search("(&(objectClass=sudoRole)(cn=".$this->cn."))");
564 while($attrs = $ldap->fetch()){
565 if($attrs['dn'] != $this->dn){
566 $message[] = msgPool::duplicated(_("Name"));
567 }
568 }
570 /* Check if we are allowed to create or move this object
571 */
572 if($this->orig_dn == "new" && !$this->acl_is_createable($this->get_sudoers_ou($this->config))){
573 $message[] = msgPool::permCreate();
574 }
576 return ($message);
577 }
580 /*! \brief Display the System Trust Add Workstation dialog
581 @return String HTML dialog to add a system to the trust list.
583 */
584 private function display_trust_add_dialog()
585 {
586 $smarty = get_smarty();
588 /* Save data */
589 $sysfilter= session::get("sysfilter");
590 foreach( array("depselect", "regex") as $type){
591 if (isset($_POST[$type])){
592 $sysfilter[$type]= $_POST[$type];
593 }
594 }
595 if (isset($_GET['search'])){
596 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
597 if ($s == "**"){
598 $s= "*";
599 }
600 $sysfilter['regex']= $s;
601 }
602 session::set("sysfilter", $sysfilter);
604 /* Get workstation list */
605 $exclude= "";
606 foreach($this->accessTo as $ws){
607 $exclude.= "(cn=$ws)";
608 }
609 if ($exclude != ""){
610 $exclude= "(!(|$exclude))";
611 }
612 $regex= $sysfilter['regex'];
613 $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
615 $res = array();
616 $res= array_merge($res,get_sub_list($filter, array("terminal"), get_ou("terminalRDN"),
617 get_ou("systemRDN").$sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
618 $res= array_merge($res,get_sub_list($filter, array("server"), get_ou("serverRDN"),
619 get_ou("systemRDN").$sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
620 $res= array_merge($res,get_sub_list($filter, array("workstation"), get_ou("workstationRDN"),
621 get_ou("systemRDN").$sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
623 $wslist= array();
624 foreach ($res as $attrs){
625 $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
626 }
627 asort($wslist);
628 foreach( array("depselect","regex") as $type){
629 $smarty->assign("$type", $sysfilter[$type]);
630 }
631 $smarty->assign("search_image", get_template_path('images/lists/search.png'));
632 $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
633 $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
634 $smarty->assign("deplist", $this->config->idepartments);
635 $smarty->assign("alphabet", generate_alphabet());
636 $smarty->assign("hint", print_sizelimit_warning());
637 $smarty->assign("wslist", $wslist);
638 $smarty->assign("apply", apply_filter());
639 $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
640 return ($display);
641 }
644 /*! \brief Force this entry to be handled and saved as 'default'
645 @param BOOL TRUE -force defaults FALSE -normal
646 */
647 public function set_default($state)
648 {
649 $this->is_default = TRUE;
650 $this->cn = "defaults";
651 }
654 /*! \brief Add ACL object
655 @return Returns the ACL object.
656 */
657 static function plInfo()
658 {
659 return (array(
660 "plShortName" => _("Sudo"),
661 "plDescription" => _("Sudo role"),
662 "plSelfModify" => FALSE,
663 "plDepends" => array(),
664 "plPriority" => 0,
665 "plSection" => array("administration"),
666 "plCategory" => array("sudo" => array("objectClass" => "sudoRole", "description" => _("Sudo role"))),
668 "plProvidedAcls" => array(
669 "cn" => _("Name"),
670 "description" => _("Description"),
671 "sudoUser" => _("Users"),
672 "sudoHost" => _("Host"),
673 "sudoCommand" => _("Command"),
674 "sudoRunAs" => _("Run as user"),
675 "trustModel" => _("Access control list"))
676 ));
677 }
680 /*! \brief This function will be called if an object gets copied.
681 This function adapts attributes from the source object.
682 @param Array The source object.
683 */
684 function PrepareForCopyPaste($source)
685 {
686 plugin::PrepareForCopyPaste($source);
687 foreach(array("sudoUser","sudoCommand","sudoHost","sudoRunAs") as $attr){
688 $this->$attr = array();
689 if(isset($source[$attr])){
690 $tmp = array();
691 for($i = 0 ; $i < $source[$attr]['count']; $i++){
692 $tmp[] = $source[$attr][$i];
693 }
694 $this->$attr = $tmp;
695 }
696 }
698 /* Is this account a trustAccount? */
699 if (isset($source['trustModel'])){
700 $this->trustModel= $source['trustModel'][0];
701 $this->was_trust_account= TRUE;
702 } else {
703 $this->was_trust_account= FALSE;
704 $this->trustModel= "";
705 }
707 $this->accessTo = array();
708 if (isset($source['accessTo'])){
709 for ($i= 0; $i<$source['accessTo']['count']; $i++){
710 $tmp= $source['accessTo'][$i];
711 $this->accessTo[$tmp]= $tmp;
712 }
713 }
714 }
717 /*! \brief Used for copy & paste.
718 Returns a HTML input mask, which allows to change the cn of this entry.
719 @param Array Array containing current status && a HTML template.
720 */
721 function getCopyDialog()
722 {
723 $vars = array("cn");
724 $smarty = get_smarty();
725 $smarty->assign("cn", htmlentities($this->cn));
726 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
727 $ret = array();
728 $ret['string'] = $str;
729 $ret['status'] = "";
730 return($ret);
731 }
734 public function get_cn()
735 {
736 return($this->cn);
737 }
740 /*! \brief Used for copy & paste.
741 Some entries must be renamed to avaoid duplicate entries.
742 */
743 function saveCopyDialog()
744 {
745 if(isset($_POST['cn'])){
746 $this->cn = get_post('cn');
747 }
748 }
749 }
750 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
751 ?>