File modules/cms/action/FileAction.class.php
Last commit: Sun Dec 5 20:33:24 2021 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'.
1 <?php 2 3 namespace cms\action; 4 5 use cms\base\Configuration; 6 use cms\generator\FileContext; 7 use cms\generator\FileGenerator; 8 use cms\generator\Producer; 9 use cms\generator\Publisher; 10 use cms\generator\PublishOrder; 11 use cms\model\BaseObject; 12 use cms\model\File; 13 use cms\model\Folder; 14 use util\exception\ValidationException; 15 use util\Html; 16 use util\Upload; 17 18 // OpenRat Content Management System 19 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 20 // 21 // This program is free software; you can redistribute it and/or 22 // modify it under the terms of the GNU General Public License 23 // as published by the Free Software Foundation; either version 2 24 // of the License, or (at your option) any later version. 25 // 26 // This program is distributed in the hope that it will be useful, 27 // but WITHOUT ANY WARRANTY; without even the implied warranty of 28 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 // GNU General Public License for more details. 30 // 31 // You should have received a copy of the GNU General Public License 32 // along with this program; if not, write to the Free Software 33 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 34 35 36 /** 37 * Action-Klasse zum Bearbeiten einer Datei 38 * 39 * @author Jan Dankert 40 */ 41 class FileAction extends ObjectAction 42 { 43 /** 44 * @var File 45 */ 46 protected $file; 47 48 /** 49 * Konstruktor 50 */ 51 function __construct() 52 { 53 parent::__construct(); 54 } 55 56 57 public function init() 58 { 59 $file = new File( $this->request->getId() ); 60 $file->load(); 61 62 $this->setBaseObject( $file ); 63 } 64 65 66 protected function setBaseObject( $file ) { 67 $this->file = $file; 68 69 parent::setBaseObject( $file ); 70 } 71 72 73 protected function getCompressionTypes() 74 { 75 $compressionTypes = array(); 76 if ( function_exists('gzencode' ) ) $compressionTypes[] = 'gz'; 77 //if ( function_exists('gzencode' ) ) $compressionTypes[] = 'zip'; 78 if ( function_exists('bzipcompress') ) $compressionTypes[] = 'bz2'; 79 return $compressionTypes; 80 } 81 82 protected function getArchiveTypes() 83 { 84 $archiveTypes = array(); 85 $archiveTypes[] = 'tar'; 86 $archiveTypes[] = 'zip'; 87 return $archiveTypes; 88 } 89 90 91 /** 92 * @return string MIME-type 93 */ 94 protected function getMimeType() { 95 $context = new FileContext( $this->file->objectid,Producer::SCHEME_PREVIEW ); 96 $fileGenerator = new FileGenerator( $context ); 97 return $fileGenerator->getMimeType(); 98 99 } 100 }
Downloadmodules/cms/action/FileAction.class.php
History Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Sat, 6 Mar 2021 02:50:20 +0100 Jan Dankert New: Enable actions for guest users. Thu, 4 Mar 2021 03:39:25 +0100 Jan Dankert New: Separate edit action for images and texts. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Wed, 18 Nov 2020 00:18:10 +0100 Jan Dankert Refactoring Part 2: Removing all unnecessary methods in the action base classes. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class. Sat, 14 Nov 2020 22:02:21 +0100 Jan Dankert Fixed: Notices may display a message. Wed, 11 Nov 2020 23:24:28 +0100 Jan Dankert Fixing editing value of files,images,texts. Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Fri, 23 Oct 2020 23:09:52 +0200 Jan Dankert Refactoring: Using the new config classes. Wed, 14 Oct 2020 23:49:54 +0200 Jan Dankert Refactoring: Creating the target instance with a Factory (Java style); Asynchronous publishing of files. Fri, 2 Oct 2020 23:11:48 +0200 Jan Dankert Cleanup: No '.inputholder' any more, notices with links to objects. Tue, 29 Sep 2020 22:17:11 +0200 Jan Dankert Refactoring: Do not use global constants. Mon, 28 Sep 2020 21:07:21 +0200 Jan Dankert Cleanup: Removing unused code. Sat, 26 Sep 2020 10:32:02 +0200 Jan Dankert Refactoring: No global $conf array any more. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Sat, 26 Sep 2020 04:03:53 +0200 Jan Dankert Refactoring: read language keys with a class. Mon, 21 Sep 2020 22:48:59 +0200 Jan Dankert Complexe refactoring: Moving all generation logic from the model (Value,Page,File) to generators classes. Fri, 18 Sep 2020 23:04:13 +0200 Jan Dankert Refactoring: Renaming module "cms/publish" to "cms/generator" Thu, 10 Sep 2020 18:30:16 +0200 Jan Dankert Some code cleanup, killing the old "checkMenu()"-methods. Sat, 29 Aug 2020 03:23:06 +0200 Jan Dankert Refactoring: Improved Exception-Handling; New: Generating pages using a page context which considers page aliases. Thu, 27 Aug 2020 00:32:27 +0200 Jan Dankert Cleanup: Remove unused template components page,tree; remove unused action method 'structure'. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.