/usr/share/gosa/plugins/admin/fai/packageSelect/class_filterFAIPackages.inc is in gosa-plugin-fai 2.7.4+reloaded1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | <?php
class filterFAIPackages {
static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
{
$filter= preg_replace('/\*/', '', $filter);
$pkgs = array();
$q = new gosaSupportDaemon();
$filter = array("%$filter%");
$attrs = array("distribution", "package","version", "section", "description", "timestamp");
$release = session::get('packageSelect_Release');
$ret = $q->FAI_get_packages($release,$attrs,$filter,0,200);
if($q->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($q->get_error()),ERROR_DIALOG);
}else{
foreach($ret as $attr){
$attr['objectClass'] = "FAKE_OC__FaiPackage";
$attr['DESCRIPTION'] = base64_decode($attr['DESCRIPTION']);
$item = array();
$item['dn'] = "dn=".$attr['PACKAGE'].",".$attr['DISTRIBUTION'].",".$base;
$item['count']= 0;
foreach($attr as $key => $value){
$item['count']++;
$item[] = $key;
$item[$key] = array('count' => 1, $value);
}
$pkgs[] = $item;
}
}
return(filterLDAPBlacklist::filterByBlacklist($pkgs));
}
static function filterByBlacklist($entries)
{
if(session::is_set('filterBlacklist')){
$blist = session::get('filterBlacklist');
foreach($blist as $attr_name => $attr_values){
foreach($attr_values as $match){
foreach($entries as $id => $entry){
if(isset($entry[$attr_name])){
$test = $entry[$attr_name];
if(!is_array($test)) $test = array($test);
if(in_array_strict($match, $test)) unset($entries[$id]);
}
}
}
}
}
return(array_values($entries));
}
function save()
{
$act = $this->detectPostActions();
$headpage = $this->getHeadpage();
if(!isset($act['targets'])) return(array());
$ret = array();
foreach($act['targets'] as $dn){
$ret[] = $headpage->getEntry($dn);
}
return($ret);
}
}
?>
|