openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ef6353c709e2b6fea7e1b890c1b8dbb827d23183
parent 82973c1ca257a17a3049a3b50b5ab2c8d1c49890
Author: dankert <devnull@localhost>
Date:   Sat, 24 Nov 2007 13:16:32 +0100

Neue Methode mimeType()

Diffstat:
objectClasses/Page.class.php | 36+++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/objectClasses/Page.class.php b/objectClasses/Page.class.php @@ -20,6 +20,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ +// Revision 1.23 2007-11-24 12:16:32 dankert +// Neue Methode mimeType() +// // Revision 1.22 2007-11-07 23:29:05 dankert // Wenn Seite direkt aufgerufen wird, dann sofort Seitenelement anzeigen. // @@ -182,7 +185,8 @@ class Page extends Object return array_merge( parent::getProperties(), array('full_filename'=>$this->fullFilename, 'pageid' =>$this->pageid, - 'templateid' =>$this->templateid ) ); + 'templateid' =>$this->templateid, + 'mime_type' =>$this->mimeType() ) ); } @@ -825,6 +829,36 @@ class Page extends Object } } + + + /** + * Ermittelt den Mime-Type zu dieser Seite + * + * @return String Mime-Type + */ + function mimeType() + { + if ( !empty( $this->mime_type ) ) + return $this->mime_type; + + global $conf; + $mime_types = $conf['mime-types']; + + if ( ! is_object($this->template) ) + $this->template = new Template( $this->templateid ); + + $this->template->load(); + $extension = strtolower($this->template->extension); + + if ( !empty($mime_types[$extension]) ) + $this->mime_type = $mime_types[$extension]; + else + // Wenn kein Mime-Type gefunden, dann Standartwert setzen + $this->mime_type = 'application/octet-stream'; + + return( $this->mime_type ); + } + }