diff --git a/plugins/generic/references/class_reference.inc b/plugins/generic/references/class_reference.inc
index 5b97749d70f6cc8d92d87cb3d088ea33708bb797..4b17529dbbbf318a30ffc91b5e3ebb99f40418d4 100644 (file)
function execute()
{
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Set government mode */
$smarty= get_smarty();
/* Set government mode */
$smarty= get_smarty();
{
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
{
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))");
+ $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
$cycle= array("F5F5F5", "ECECEC");
$id= 0;
$cycle= array("F5F5F5", "ECECEC");
$id= 0;
}
foreach ($attrs[$memberattr] as $uid){
$content= $this->getCacheObject($uid);
}
foreach ($attrs[$memberattr] as $uid){
$content= $this->getCacheObject($uid);
+ if ($content == NULL){
+ continue;
+ }
$addon.= '<tr style="background-color:'.$cycle[$id&1].';"><td title="'.$attrs['cn'][0].'"> '.$content['name'].'</td><td>'.$content['description'].'</td><td>'.$content['type'].'</td> </tr>';
}
}
$addon.= '<tr style="background-color:'.$cycle[$id&1].';"><td title="'.$attrs['cn'][0].'"> '.$content['name'].'</td><td>'.$content['description'].'</td><td>'.$content['type'].'</td> </tr>';
}
}
} else {
$img= "images/sort_down.png";
}
} else {
$img= "images/sort_down.png";
}
- $this->objectlist.= '<tr style="background-color:'.$cycle[$id&1].';"><td class="phonelist" title="'.$attrs['cn'][0].'"><a href=main.php?plug='.$_GET['plug'].'&start=&show='.base64_encode($attrs['dn']).'><img alt=\"\" src="'.$img.'" border=0> '.$attrs['cn'][0].'</a></td><td>'.$description.'</td><td>'.$content.'</td> </tr>'.$addon;
+ $this->objectlist.= '<tr style="background-color:'.$cycle[$id&1].';"><td class="phonelist" title="'.$attrs['cn'][0].'"><a href="main.php?plug='.$_GET['plug'].'&start=&show='.base64_encode($attrs['dn']).'"><img alt="" src="'.$img.'" border=0> '.$attrs['cn'][0].'</a></td><td>'.$description.'</td><td>'.$content.'</td> </tr>'.$addon;
$id++;
}
$id++;
}
} else {
$ldap->search("(uid=$dn)", array("cn", "objectClass", "description"));
}
} else {
$ldap->search("(uid=$dn)", array("cn", "objectClass", "description"));
}
- $attrs= $ldap->fetch();
- if (isset($attrs['description'])){
- $description= $attrs['description'][0];
+ if ($ldap->count()){
+ $attrs= $ldap->fetch();
+ if (isset($attrs['description'])){
+ $description= $attrs['description'][0];
+ } else {
+ $description= "-";
+ }
+ $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0],
+ 'description' => "$description",
+ 'type' => $this->createContentString($attrs['objectClass']));
} else {
} else {
- $description= "-";
+ return NULL;
}
}
- $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0],
- 'description' => "$description",
- 'type' => $this->createContentString($attrs['objectClass']));
}
return ($this->objectCache[$dn]);
}
}
return ($this->objectCache[$dn]);
}
function createContentString($classes)
{
$result= "";
function createContentString($classes)
{
$result= "";
- foreach ($classes as $class){
- if (isset($this->obtypes[$class])){
- $result.= "<a><img alt=\"\" border=0 src='images/".$this->obtypes[$class]['image']."'> ".$this->obtypes[$class]['text']."</a> ";
+ if(!is_null($classes)) {
+ foreach ($classes as $class){
+ if (isset($this->obtypes[$class])){
+ $result.= "<a><img alt=\"\" border=0 src='images/".$this->obtypes[$class]['image']."'> ".$this->obtypes[$class]['text']."</a> ";
+ }
}
}
- }
+ }
return (preg_replace('/ $/', '', $result));
}
return (preg_replace('/ $/', '', $result));
}