Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

fileview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: fileview.php 9491 2002-04-30 13:51:15Z br $
5 //
6 // Created on: <04-Jan-2001 16:47:23 ce>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlog.php" );
30 // include_once( "classes/ezhttptool.php" );
31
32 // include_once( "ezfilemanager/classes/ezvirtualfile.php" );
33 // include_once( "ezfilemanager/classes/ezvirtualfolder.php" );
34 // include_once( "ezuser/classes/ezuser.php" );
35 // include_once( "ezuser/classes/ezpermission.php" );
36 // include_once( "ezuser/classes/ezobjectpermission.php" );
37
38
39 $ini =& eZINI::instance( 'site.ini' );
40
41 $Language = $ini->variable( "eZFileManagerMain", "Language" );
42
43
44 $t = new eZTemplate( "kernel/ezfilemanager/user/" . $ini->variable( "eZFileManagerMain", "TemplateDir" ),
45 "kernel/ezfilemanager/user/intl/", $Language, "fileview.php" );
46
47 $t->set_file( "file_view", "fileview.tpl" );
48
49 $t->setAllStrings();
50
51 // $t->set_block( "file_view", "value_tpl", "value" );
52 $t->set_block( "file_view", "view_tpl", "view" );
53 $t->set_block( "file_view", "delete_tpl", "delete" );
54 $t->set_block( "file_view", "edit_tpl", "edit" );
55 $t->set_block( "file_view", "download_tpl", "download" );
56
57 $t->set_var( "delete", "" );
58 $t->set_var( "edit", "" );
59 $t->set_var( "download", "" );
60
61 if ( $FileID != 0 )
62 {
63 $file = new eZVirtualFile( $FileID );
64
65 if ( $file->id() == 0 )
66 {
67 eZHTTPTool::header( "Location: /error/404/" );
68 exit();
69 }
70
71 $t->set_var( "file_name", $file->name() );
72 $t->set_var( "file_id", $file->id() );
73 $t->set_var( "file_description", $file->description() );
74
75 $user =& eZUser::currentUser();
76
77 // sections
78 // include_once( "ezsitemanager/classes/ezsection.php" );
79
80 $parent_folder = $file->folder();
81 if ( $parent_folder )
82 {
83 $t->set_var( "folder_name", $parent_folder->name() );
84
85 $FolderID = $parent_folder->id();
86
87 // tempo fix for admin users - maybe in the future must be changed
88 if ( $parent_folder != 0 && ! eZPermission::checkPermission( $user, "eZUser", "AdminLogin" ) )
89 {
90 $GlobalSectionID = eZVirtualFolder::sectionIDstatic ( $parent_folder->id() );
91 }
92 }
93 else
94 {
95 $t->set_var( "folder_name", "" );
96 }
97
98 // init the section
99 $sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
100 $sectionObject->setOverrideVariables();
101
102 if ( eZObjectPermission::hasPermission( $file->id(), "filemanager_file", "r", $user ) &&
103 ( eZObjectPermission::hasPermission( $file->folder( false ), "filemanager_folder", "r", $user ) ||
104 eZVirtualFolder::isOwner( $user, $file->folder( false ) ) ) )
105 {
106 $t->parse( "download", "download_tpl" );
107 }
108 else
109 {
110 eZHTTPTool::header( "Location: /error/403/" );
111 exit();
112 }
113
114 if ( eZObjectPermission::hasPermission( $file->id(), "filemanager_file", "w", $user ) )
115 {
116 $t->parse( "delete", "delete_tpl" );
117 $t->parse( "edit", "edit_tpl" );
118 }
119
120 $filePath =& $file->filePath( true );
121
122 $size = $file->siFileSize();
123 $t->set_var( "file_size", $size["size-string"] );
124 $t->set_var( "file_unit", $size["unit"] );
125
126 $fileOwner = $file->user();
127
128 if ( $fileOwner )
129 {
130 $t->set_var( "file_owner", $fileOwner->firstName() . " " . $fileOwner->lastName() );
131 }
132 else
133 {
134 $t->set_var( "file_owner", "" );
135 }
136
137 $t->parse( "view", "view_tpl" );
138 }
139
140
141 $folder = new eZVirtualFolder( $FolderID );
142
143 $folderList =& $folder->getByParent( $folder );
144
145 foreach ( $folderList as $folder )
146 {
147 $t->set_var( "option_name", $folder->name() );
148 $t->set_var( "option_value", $folder->id() );
149
150 $t->set_var( "selected", "" );
151 $t->set_var( "option_level", "" );
152
153 // $t->parse( "value", "value_tpl", true );
154 }
155
156 $t->pparse( "output", "file_view" );
157
158 ?>
$sectionObject
$sectionObject
Definition: articleheaderlist.php:49
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZSection\globalSectionObject
static & globalSectionObject( $sectionID)
Definition: ezsection.php:366
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZVirtualFile
Definition: ezvirtualfile.php:42
eZVirtualFolder
Definition: ezvirtualfolder.php:43
eZVirtualFolder\isOwner
static isOwner( $user, $folderID)
Definition: ezvirtualfolder.php:421
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$size
if($file_debug) $size
Definition: ezfilemanager/user/filedownload.php:165
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$filePath
$filePath
Definition: ezfilemanager/user/filedownload.php:50
$t
$t
Definition: fileview.php:44
$Language
$Language
Definition: fileview.php:41
$ini
$ini
Definition: fileview.php:39
$folder
if( $FileID !=0) $folder
Definition: fileview.php:141
$folderList
$folderList
Definition: fileview.php:143
exit
exit
Definition: folder.php:81
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.