X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiPackage.inc;h=acabf1c97d4f7d0483052399abc211bddfcf027c;hb=8cd748822ec15f04dd8a97616de7c6ee2c7826e1;hp=fe7989ea1eb37c2f9fdecf7c278b2772bee4d0e9;hpb=6d7573648de097813245616c1027236001b34db3;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc index fe7989ea1..acabf1c97 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -33,26 +33,22 @@ class faiPackage extends plugin var $FAIdebianRelease = ""; // The selected release var $FAIdebianSection = array(); // selected section var $FAIinstallMethod = "aptitude"; // hard coded - var $mirror = ""; // selected mirror - var $servers = array(); // All available servers - var $releases = array(); // All possible releases var $sections = array(); // All section types var $list = NULL; - var $mirrors = array(); // The combination of server/release/section - var $confDir = ""; var $usedPackages = array(); var $buffer = NULL; - var $strID =""; - var $newDialogShown =false; + var $newDialogShown = false; var $FAIstate = ""; var $view_logged = FALSE; var $base; var $FAIpackage ; + var $packageSelect ; + var $FAIinstallMethods = array( "install", "ninstall", "remove", "dselect-upgrade", "taskinst", "taskrm", "hold", "clean", "aptitude", "aptitude-r", @@ -71,18 +67,14 @@ class faiPackage extends plugin if($dn != "new"){ $this->dn =$dn; - /* Get FAIstate */ - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - /* Check if there are already some packages in this list */ $this->usedPackages = array(); if(isset($this->attrs['FAIpackage'])){ unset($this->attrs['FAIpackage']['count']); foreach($this->attrs['FAIpackage'] as $pkg){ - $this->usedPackages[$pkg] = $pkg; + $name = preg_replace("/\-$/","",$pkg); + $this->usedPackages[$name] = $pkg; } ksort($this->usedPackages); } @@ -90,7 +82,7 @@ class faiPackage extends plugin /* Fetch all package configurations from ldap */ $PackageFilter = ""; - foreach($this->usedPackages as $name){ + foreach($this->usedPackages as $name => $value){ $PackageFilter .= "(FAIpackage=".$name.")"; } $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))"; @@ -130,20 +122,13 @@ class faiPackage extends plugin } } - if (isset($this->attrs['FAIdebianSection']['count'])){ - unset($this->attrs['FAIdebianSection']['count']); - } - if((isset($this->attrs['FAIdebianSection']))&&(is_array($this->attrs['FAIdebianSection']))){ - $this->FAIdebianSection = array(); - foreach($this->attrs['FAIdebianSection'] as $sec){ + $this->FAIdebianSection = array(); + if(isset($this->attrs['FAIdebianSection'])){ + for($i = 0 ; $i < $this->attrs['FAIdebianSection']['count'] ; $i++ ){ + $sec = $this->attrs['FAIdebianSection'][$i]; $this->FAIdebianSection[$sec]=$sec; } } - - if((isset($this->attrs['FAIdebianSection']))&&(is_string($this->attrs['FAIdebianSection']))){ - $this->FAIdebianSection=array($this->attrs['FAIdebianSection']=>$this->attrs['FAIdebianSection']) ; - } - $this->confDir = CONFIG_DIR."/fai/"; $this->FAIpackage = array(); } // ENDE dn != new @@ -158,6 +143,23 @@ class faiPackage extends plugin if ($this->dn != "new"){ $this->newDialogShown= true; } + $this->is_new = FALSE; + if($this->dn == "new"){ + $this->is_new =TRUE; + } + + /* Generate package list */ + $this->list= $this->genPkgs(TRUE); + + // Prepare lists + $this->packageList = new sortableListing(); + $this->packageList->setDeleteable(false); + $this->packageList->setEditable(false); + $this->packageList->setWidth("100%"); + $this->packageList->setHeight("200px"); + $this->packageList->setColspecs(array('20px','*','*','100px','60px')); + $this->packageList->setHeader(array(_("Status"),_("Name"),_("Description"),_("Version"))); + $this->packageList->setDefaultSortColumn(1); } @@ -175,20 +177,22 @@ class faiPackage extends plugin $smarty= get_smarty(); $display= ""; - $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods ); - + /****** + * Initialize a new Package List with release and section name + ******/ + if(!$this->is_account){ /* Assemble release name */ - $faifilter = session::get('faifilter'); - $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']); + $release = $this->parent->parent->fai_release; + $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $release); $tmp= preg_replace('/ou=/', '', $tmp); - $rev= array_reverse(split(',', $tmp)); - $this->FAIdebianRelease= ""; + $rev= array_reverse(explode(',', $tmp)); + $this->FAIdebianRelease= "/"; foreach ($rev as $part){ $this->FAIdebianRelease.= "/$part"; } - $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease); + $this->FAIdebianRelease= preg_replace('#^[/]*#', '', $this->FAIdebianRelease); /* Assemble sections */ $repos= $this->getServerInfos(); @@ -200,87 +204,187 @@ class faiPackage extends plugin /* Assign Repository settings*/ $this->is_account = true; } + + + /****** + * Add + ******/ + + if(isset($_POST['AddManualpkg']) && + isset($_POST['addPpkgsText']) && + strlen($_POST['addPpkgsText']) && + $this->acl_is_writeable("FAIpackage") && + !preg_match("/freeze/",$this->FAIstate)){ + + // Check all splitted packages for valid package names + $add_packages = preg_split( "/[\s,]+/", get_post('addPpkgsText'), -1, PREG_SPLIT_NO_EMPTY ); + if( is_array($add_packages) ) { + $invalid_packages = array(); + foreach ($add_packages as $value) { + if(!preg_match( "/^[a-z0-9][-0-9a-z+\.]+$/",$value)){ + $invalid_packages[] = trim($value); + }else{ + $valid_packages[] = trim($value); + } + } + if(count($invalid_packages)){ + $str = implode(", ",$invalid_packages); + msg_dialog::display(_("Invalid package names"), + sprintf(_("The following package names don't match the Debian policy: %s"),$str), + ERROR_DIALOG); + } - /* Assign variables */ - foreach($this->attributes as $attrs){ - $smarty->assign($attrs,$this->$attrs); + + // If we have a complete list of valid packages, add them + if(count($valid_packages)){ + + foreach($valid_packages as $key => $value){ + if(array_key_exists($value,$this->usedPackages)) { + unset($valid_packages[$key]); + } + } + + // Query SI-Deamon for additional package information + $daemon = new gosaSupportDaemon(); + $query_attrs = array("distribution", "package","version", "section", "description", "timestamp"); + $do_si_query = true; + + + foreach ($valid_packages as $value) { + + if( $do_si_query == true ) { + $res = $daemon->FAI_get_packages($this->FAIdebianRelease,$query_attrs,array($value),0,1); + if( ! $daemon->is_error()){ + + if(count($res)){ + + // We just use the last answer - there shouldn't be multiple + $res_attrs = array_pop( $res ); + $this->list[$value] = $res_attrs; + $this->usedPackages[$value] = $res_attrs['PACKAGE']; + + }else{ + $this->usedPackages[$value] = $value; + } + }else{ + msg_dialog::display(_("Service infrastructure"), + msgPool::siError($daemon->get_error()), + ERROR_DIALOG); + $do_si_query = false; + } + } + } + + ksort($this->usedPackages); + + /* Generate package list */ + $this->list= $this->genPkgs(TRUE); + } + } } - /* Generate package list */ - $this->list= $this->genPkgs(); + // Open the packageSelect dialog to allow adding packages out of a list. + if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage") && !preg_match("/freeze/",$this->FAIstate)){ + $this->packageSelect = new packageSelect($this->config, get_userinfo()); + session::set('packageSelect_Release',$this->FAIdebianRelease); + $this->dialog =true; + } - /* + was pressed to open the package dialog */ - if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){ - $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->list,$this->usedPackages); - $this->is_dialog =true; + // Close packageSelect dialog. + if(isset($_POST['packageSelect_cancel'])){ + $this->packageSelect = FALSE; + $this->dialog =FALSE; } - /* Delete selected package */ - if(isset($_POST['Delpkg']) && $this->acl_is_writeable("FAIpackage")){ - if(!preg_match("/^freeze/", $this->FAIstate)){ - foreach($_POST['usedPackages'] as $del){ - if(isset($this->usedPackages[$del])){ - unset($this->usedPackages[$del]); + // Close packageSelect dialog and add the selected packages. + if(isset($_POST['packageSelect_save']) && $this->packageSelect instanceOf packageSelect){ + if(!preg_match("/freeze/i", $this->FAIstate)){ + $use = $this->packageSelect->save(); + + foreach($use as $pkg){ + $item = array(); + for($i =0; $i < $pkg['count']; $i++){ + $item[$pkg[$i]] = $pkg[$pkg[$i]][0]; } + $this->usedPackages[$item['PACKAGE']] = $item['PACKAGE']; } + + ksort($this->usedPackages); + + /* Generate package list */ + $this->list= $this->genPkgs(TRUE); } + $this->packageSelect = FALSE; + $this->dialog =FALSE; } - /* Abort package selection dialog */ - if(isset($_POST['CancelSubObject'])){ - $this->dialog = false; - $this->is_dialog=false; + // Display package add dialog + if($this->packageSelect instanceOf packageSelect){ + + session::set('filterBlacklist', array('PACKAGE' => $this->usedPackages)); + return $this->packageSelect->execute(); } - /* attach new packages */ - if(isset($_POST['SaveSubObject'])) { - if(!preg_match("/^freeze/", $this->FAIstate)){ - $this->dialog->save_object(); - if(count($this->dialog->check())){ - foreach($this->dialog->check() as $msgs){ - msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG); + + /* Check image Posts + */ + foreach($_POST as $name => $value){ + + /****** + * Mark as removed + ******/ + + if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^removal_package_/",$name)){ + $id = @postDecode(preg_replace("/^removal_package_(.*)$/","\\1",$name)); + if(isset($this->usedPackages[$id])){ + $pkg = $this->usedPackages[$id]; + if (preg_match('/\-$/', $pkg)){ + $pkg= preg_replace('/\-$/', '', $pkg); + } else { + $pkg= preg_replace('/$/', '-', $pkg); } - }else{ - $use = $this->dialog->save(); - $this->usedPackages = $use; - $this->dialog = false; - $this->is_dialog=false; - ksort($this->usedPackages); + $this->usedPackages[$id] = $pkg; } - }else{ - $this->dialog = false; - $this->is_dialog=false; + break; } - } - /* Configuration dialog open*/ - if((isset($_POST['Conpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages'][0])) && $this->acl_is_writeable("FAIdebconfInfo")){ - $pkg_config = array(); - $pkg = $_POST['usedPackages'][0]; - if(isset($this->ConfiguredPackages[$pkg])){ - $pkg_config = $this->ConfiguredPackages[$pkg]; + /****** + * Delete Pkgs + ******/ + if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^remove_package_/",$name)){ + $id = @postDecode(preg_replace("/^remove_package_(.*)$/","\\1",$name)); + if(isset($this->usedPackages[$id])){ + unset($this->usedPackages[$id]); + } + break; } - $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $this->FAIdebianRelease , $pkg_config); - $this->is_dialog =true; - } - - /* Configuration dialog open*/ - if(preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){ - if((isset($_POST['Markpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages']))){ - foreach($_POST['usedPackages'] as $pkg){ - if (isset($this->usedPackages[$pkg])){ - unset($this->usedPackages[$pkg]); - if (preg_match('/^-/', $pkg)){ - $pkg= preg_replace('/^-/', '', $pkg); - } else { - $pkg= preg_replace('/^/', '-', $pkg); - } - $this->usedPackages[$pkg]= $pkg; + + /****** + * Configure Pkgs + ******/ + if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^configure_package_/",$name)){ + $pkg = @postDecode(preg_replace("/^configure_package_(.*)$/","\\1",$name)); + + if(isset($this->usedPackages[$pkg])){ + + /* Configuration dialog open*/ + $pkg_config = array(); + if(isset($this->ConfiguredPackages[$pkg])){ + $pkg_config = $this->ConfiguredPackages[$pkg]; } + $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $this->FAIdebianRelease , $pkg_config); + $this->is_dialog =true; } + break; } } + /* Abort package selection dialog */ + if(isset($_POST['CancelSubObject'])){ + $this->dialog = false; + $this->is_dialog=false; + } + /* Save Configuration */ if(isset($_POST['SaveObjectConfig'])){ if(!preg_match("/^freeze/", $this->FAIstate)){ @@ -298,9 +402,77 @@ class faiPackage extends plugin /* Display dialog */ if($this->is_dialog){ + $this->dialog->save_object(); return $this->dialog->execute(); } + + /****** + * Display UI / HTML / smarty + ******/ + + /* Create list to display a list of all currently used packages + */ + $data = $lData = array(); + if(is_array($this->usedPackages)){ + foreach($this->usedPackages as $usedName => $name){ + + /* Append message if package is configured */ + $configured = image('images/empty.png'); + if(isset($this->ConfiguredPackages[$usedName])){ + $configured = image('plugins/fai/images/package_configure.png','',_("Configured")); + } + + /* Adapt used name if we're marked for removal */ + $removal = image('images/empty.png'); + if (preg_match('/\-$/', $name)){ + $removal = image('plugins/fai/images/removal_mark.png','',_("Package marked for removal")); + } + + /* Get Version */ + $version = ""; + if(isset($this->list[$usedName]['VERSION'])){ + $version = $this->list[$usedName]['VERSION']; + } + + /* Get description */ + $description = ""; + if(isset($this->list[$usedName]['DESCRIPTION'])){ + $description = base64_decode($this->list[$usedName]['DESCRIPTION']); + } + + $actions= image('plugins/fai/images/removal_mark.png', + 'removal_package_'.postEncode($usedName), + _("Mark package for removal")); + + if(isset($this->list[$usedName]['TEMPLATE']) && + !preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIdebconfInfo")){ + $actions.= image('plugins/fai/images/package_configure.png', + 'configure_package_'.postEncode($usedName), + _("Configure this package")); + } + if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){ + $actions.= image('images/lists/trash.png', + 'remove_package_'.postEncode($usedName), + _("Remove this package")); + } + $data[$usedName] = $usedName; + $lData[$usedName] = array('data'=> + array( + $configured." ".$removal, + $usedName ,$version,htmlentities($description), $actions)); + } + } + $this->packageList->setAcl($this->getacl("FAIpackage",preg_match('/^freeze/', $this->FAIstate))); + $this->packageList->setListData($data,$lData); + $this->packageList->update(); + + /* Assign variables */ + foreach($this->attributes as $attrs){ + $smarty->assign($attrs,$this->$attrs); + } + $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods ); + /* Assign section to smarty */ $strsec = ""; foreach($this->FAIdebianSection as $sec){ @@ -311,40 +483,31 @@ class faiPackage extends plugin foreach($tmp['plProvidedAcls'] as $name => $translated){ $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/",$this->FAIstate))); } - - $smarty->assign("releases",$this->releases); + + $smarty->assign("freeze", preg_match("/freeze/",$this->FAIstate)); + $smarty->assign("listing",$this->packageList->render()); $smarty->assign("release" ,$this->FAIdebianRelease); $smarty->assign("sections",$this->sections); $smarty->assign("section" ,$strsec); - $smarty->assign("usedPackages",$this->printUsedPackages()); $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE)); return($display); } - /* Delete me, and all my subtrees + + /*! \brief Removes this packageList from the ldap database */ function remove_from_parent() { $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $this->dn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); - new log("remove","fai/".get_class($this),$use_dn,$this->attributes); - foreach($this->ConfiguredPackages as $pkgname => $attrs){ foreach($attrs as $name => $attr){ $pkgdn = "FAIvariable=".$name.",".$this->dn; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $pkgdn); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; - } + $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $pkgdn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } } @@ -352,7 +515,7 @@ class faiPackage extends plugin } - /* Save data to object + /*! \brief Collect all relevant POST vars for this plugin */ function save_object() { @@ -361,7 +524,9 @@ class faiPackage extends plugin } - /* Check supplied data */ + /*! \brief Check given inputs for this package list + @return Array Containing all error messages, or an empty array if no error occured + */ function check() { /* Call common method to give check the hook */ @@ -378,12 +543,8 @@ class faiPackage extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faipackageou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_release; + $new_dn= 'cn='.$this->cn.",".get_ou('faiPackageRDN').get_ou('faiBaseRDN').$release; $res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); @@ -392,77 +553,45 @@ class faiPackage extends plugin return ($message); } - function printUsedPackages(){ - $a_ret=array(); - if(is_array($this->usedPackages)) { - foreach($this->usedPackages as $usedName){ - - $config = 0; - - foreach($this->ConfiguredPackages as $name => $value){ - if($name == $usedName){ - $config ++; - } - } - - $c_str =""; - if($config){ - $c_str = " - "._("package is configured"); - } - /* Adapt used name if we're marked for removal */ - $dsc= ""; - if (preg_match('/^-/', $usedName)){ - $dsc= " - "._("Package marked for removal"); - // Generally a bad idea here, because the toggel triggers on -, not on ! - //$usedName= preg_replace('/^-/', '! ', $usedName); - }else{ - $usedName2= $usedName; - } + /*! \brief Reload the list of cached packages. + @return Returns the currently cached list of packages. + */ + function genPkgs($force = false) + { + if(empty($this->FAIdebianRelease)) return; - if(isset($this->list[$usedName][1])){ - $a_ret[$usedName] = $usedName2." [".$this->list[$usedName][1]."]".$c_str.$dsc; - }else{ - $a_ret[$usedName] = $usedName2.$c_str.$dsc; - } - } - } - return($a_ret); - } + if(!count($this->buffer) || $force){ + $q = new gosaSupportDaemon(); + $attrs = array("distribution", "package","version", "section", "description", "timestamp","template"); + $packages = array_keys($this->usedPackages); - function genPkgs() - { - $start = microtime(1); - if($this->buffer === NULL || !count($this->buffer)){ - $this->buffer = array(); - $q = new gosaSupportDaemon(); - $attrs = array("distribution", "package","version", "section", "description", "timestamp","template=''"); - $ret = $q->FAI_get_packages($this->FAIdebianRelease,$attrs); + $ret = $q->FAI_get_packages($this->FAIdebianRelease,$attrs,$packages); if($q->is_error()){ msg_dialog::display(_("Service infrastructure"),msgPool::siError($q->get_error()),ERROR_DIALOG); }else{ foreach($ret as $attr){ - $this->buffer[$attr['PACKAGE']] = array($attr['PACKAGE'],$attr['VERSION'],$attr['SECTION'],$attr['DESCRIPTION']); + $this->buffer[$attr['PACKAGE']] = $attr; } } } - -# printf("%0.6f",(microtime(1) - $start)); return $this->buffer; } - /* Save to LDAP */ + /*! \brief Save packages and their configuration to ldap + */ function save() { /* Assemble release name */ if($this->FAIdebianRelease == "ClearFromCopyPaste"){ - $faifilter = session::get('faifilter'); - $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']); + + $current_release = $this->parent->parent->fai_release; + $tmp= preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $current_release); $tmp= preg_replace('/ou=/', '', $tmp); - $rev= array_reverse(split(',', $tmp)); + $rev= array_reverse(explode(',', $tmp)); $this->FAIdebianRelease= ""; foreach ($rev as $part){ $this->FAIdebianRelease.= "/$part"; @@ -475,7 +604,7 @@ class faiPackage extends plugin $ldap = $this->config->get_ldap_link(); $this->attrs['FAIpackage'] = array(); - foreach($this->usedPackages as $pkg => $obj){ + foreach($this->usedPackages as $pkg){ $this->attrs['FAIpackage'][] = $pkg; } @@ -513,17 +642,25 @@ class faiPackage extends plugin $pkgattrs['FAIvariableContent'] = $attr['Value']; $pkgdn = "FAIvariable=".$name.",".$this->dn; - /* Tag object */ - $this->tag_attrs($pkgattrs, $pkgdn, $this->gosaUnitTag); + /* Tag object */ + $this->tag_attrs($pkgattrs, $pkgdn, $this->gosaUnitTag); if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){ - FAI::prepare_to_save_FAI_object($pkgdn,$pkgattrs); + + if($pkgattrs['FAIvariableType'] == "text" && $pkgattrs['FAIvariableContent'] == ""){ + gosa_log("Skipped saving FAIvariable '$name' empty string can't be saved."); + }else{ + FAI::prepare_to_save_FAI_object($pkgdn,$pkgattrs); + } } } } } - /* Return plugin informations for acl handling */ + + /*! \brief Return plugin informations for acl handling + @return Array ACL infos of this plugin. + */ static function plInfo() { return (array( @@ -546,8 +683,9 @@ class faiPackage extends plugin } - - + /*! \brief prepares this plugin to be inserted after it was copied or cut. + @param Array All attributes from the source object. + */ function PrepareForCopyPaste($source) { plugin::PrepareForCopyPaste($source); @@ -619,6 +757,9 @@ class faiPackage extends plugin } + /*! \brief Returns a list of all configured servers with repositories. + @return Array All repository server + */ function getServerInfos() { $ret = array(); @@ -629,9 +770,9 @@ class faiPackage extends plugin if(isset($attrs['FAIrepository'])){ for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){ $obj = $attrs['FAIrepository'][$i]; - $tmp = split("\|",$obj); + $tmp = explode("|",$obj); if(count($tmp)==4){ - foreach(split(",",$tmp[3]) as $sec){ + foreach(explode(",",$tmp[3]) as $sec){ if(!empty($sec)){ $ret[$tmp[2]][] = $sec; }