diff --git a/app/Classes/LDAP/Attribute.php b/app/Classes/LDAP/Attribute.php index ca67b92..f973d9a 100644 --- a/app/Classes/LDAP/Attribute.php +++ b/app/Classes/LDAP/Attribute.php @@ -95,6 +95,11 @@ class Attribute */ } + /** + * Determine how we render this attribute's value + * + * @return string + */ public function __toString(): string { return join('
',$this->values); diff --git a/app/Classes/LDAP/Attribute/Binary.php b/app/Classes/LDAP/Attribute/Binary.php index 1ff5a18..4f84e14 100644 --- a/app/Classes/LDAP/Attribute/Binary.php +++ b/app/Classes/LDAP/Attribute/Binary.php @@ -6,55 +6,7 @@ use App\Classes\LDAP\Attribute; /** * Represents an attribute whose values are binary - * - * @package phpLDAPadmin - * @subpackage Templates */ class Binary extends Attribute { - /* - protected $filepaths; - protected $filenames; - - public function __construct($name,$values,$server_id,$source=null) { - parent::__construct($name,$values,$server_id,$source); - - $this->filepaths = array(); - $this->filenames = array(); - } - - public function getFileNames() { - return $this->filenames; - } - - public function getFileName($i) { - if (isset($this->filenames[$i])) return $this->filenames[$i]; - else return null; - } - - public function addFileName($name, $i = -1) { - if ($i < 0) { - $this->filenames[] = $name; - } else { - $this->filenames[$i] = $name; - } - } - - public function getFilePaths() { - return $this->filepaths; - } - - public function getFilePath($i) { - if (isset($this->filepaths[$i])) return $this->filepaths[$i]; - else return null; - } - - public function addFilePath($path, $i = -1) { - if ($i < 0) { - $this->filepaths[] = $path; - } else { - $this->filepaths[$i] = $path; - } - } - */ } \ No newline at end of file diff --git a/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php b/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php index da3660d..4572eb0 100644 --- a/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php +++ b/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php @@ -7,18 +7,19 @@ use App\Classes\LDAP\Attribute\Binary; /** * Represents an attribute whose values are jpeg pictures */ -class JpegPhoto extends Binary +final class JpegPhoto extends Binary { public function __toString(): string { $result = ''; + // We'll use finfo to try and figure out what type of image is stored $f = new \finfo; foreach ($this->values as $value) { switch ($x=$f->buffer($value,FILEINFO_MIME_TYPE)) { case 'image/jpeg': default: - $result .= sprintf("",$x,base64_encode($value)); + $result .= sprintf('',$x,base64_encode($value)); } } diff --git a/app/Classes/LDAP/Attribute/Factory.php b/app/Classes/LDAP/Attribute/Factory.php index e67de98..ee96236 100644 --- a/app/Classes/LDAP/Attribute/Factory.php +++ b/app/Classes/LDAP/Attribute/Factory.php @@ -7,19 +7,24 @@ use Illuminate\Support\Facades\Log; use App\Classes\LDAP\{Attribute}; +/** + * This factory is used to return LDAP attributes as an object + * + * If there is no specific Attribute defined, then the default Attribute::class is return + */ class Factory { private const LOGKEY = 'LAf'; /** - * @var array event type to event class mapping + * Map of attributes to appropriate class */ public const map = [ 'jpegphoto'=>Attribute\Binary\JpegPhoto::class, ]; /** - * Returns new event instance + * Create the new Object for an attribute * * @param string $attribute * @param array $values diff --git a/public/css/custom.css b/public/css/custom.css new file mode 100644 index 0000000..2a90b2d --- /dev/null +++ b/public/css/custom.css @@ -0,0 +1,5 @@ +img.jpegphoto { + display:block; + max-width:100px; + height:100px; +} \ No newline at end of file