Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezfilemanager/admin/browse.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: browse.php 6969 2001-09-05 11:54:47Z jhe $
5 //
6 // Created on: <29-May-2001 14:58:11 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
31 // include_once( "ezfilemanager/classes/ezvirtualfile.php" );
32 // include_once( "ezfilemanager/classes/ezvirtualfolder.php" );
33
34 // include_once( "ezuser/classes/ezuser.php" );
35 // include_once( "ezuser/classes/ezpermission.php" );
36 // include_once( "ezuser/classes/ezobjectpermission.php" );
37
38 $ini =& eZINI::instance( 'site.ini' );
39 $Language = $ini->variable( "eZFileManagerMain", "Language" );
40 $ImageDir = $ini->variable( "eZFileManagerMain", "ImageDir" );
41
42 $t = new eZTemplate( "kernel/ezfilemanager/admin/" . $ini->variable( "eZFileManagerMain", "AdminTemplateDir" ),
43 "kernel/ezfilemanager/admin/intl/", $Language, "browse.php" );
44
45 $t->set_file( "browse_page_tpl", "browse.tpl" );
46
47 $t->setAllStrings();
48
49 $t->set_block( "browse_page_tpl", "current_folder_tpl", "current_folder" );
50
51 // path
52 $t->set_block( "browse_page_tpl", "path_item_tpl", "path_item" );
53
54 $t->set_block( "browse_page_tpl", "file_list_tpl", "file_list" );
55
56 $t->set_block( "file_list_tpl", "file_tpl", "file" );
57
58 $t->set_block( "file_tpl", "read_tpl", "read" );
59
60 $t->set_block( "browse_page_tpl", "folder_list_tpl", "folder_list" );
61 $t->set_block( "folder_list_tpl", "folder_tpl", "folder" );
62
63 $t->set_block( "folder_tpl", "folder_read_tpl", "folder_read" );
64
65 $t->set_var( "read", "" );
66
67 $user =& eZUser::currentUser();
68
69 if( !isset( $FolderID ) )
70 {
71 $FolderID = 0;
72 }
73
74 $folder = new eZVirtualFolder( $FolderID );
75
76 $error = true;
77
78 $session =& eZSession::globalSession();
79
80 $returnUrl = $session->variable( "FileListReturnTo" );
81 $t->set_var( "name", $session->variable( "NameInBrowse" ) );
82
83 $t->set_var( "action_url", $returnUrl );
84
85 // Check for read permission in the current folder.
86 if ( eZObjectPermission::hasPermission( $folder->id(), "filemanager_folder", "r", $user ) ||
87 eZVirtualFolder::isOwner( $user, $folder->id() ) )
88 {
89 $error = false;
90 }
91
92 if ( $FolderID == 0 )
93 {
94 $error = false;
95 }
96
97 $t->set_var( "write_menu", "" );
98 $t->set_var( "delete_menu", "" );
99 $t->set_var( "current_folder", "" );
100 $t->set_var( "current_folder_description", "" );
101
102 if ( $folder->id() != 0 )
103 {
104 $t->set_var( "current_folder_description", $folder->description() );
105 $t->set_var( "folder_id", $folder->id() );
106 $t->set_var( "folder_name", $folder->name() );
107
108 $t->parse( "current_folder", "current_folder_tpl" );
109 }
110
111 // path
112 $pathArray =& $folder->path();
113
114 $t->set_var( "path_item", "" );
115 foreach ( $pathArray as $path )
116 {
117 $t->set_var( "folder_id", $path[0] );
118
119 $t->set_var( "folder_name", $path[1] );
120
121 $t->parse( "path_item", "path_item_tpl", true );
122 }
123
124 // Print out the folders.
125
126 $folderList =& $folder->getByParent( $folder );
127
128 $i = 0;
129 $deleteFolders = false;
130 foreach ( $folderList as $folderItem )
131 {
132 $t->set_var( "folder_name", $folderItem->name() );
133 $t->set_var( "folder_id", $folderItem->id() );
134
135 $t->set_var( "folder_read", "" );
136 $t->set_var( "folder_write", "" );
137
138 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
139 if ( eZObjectPermission::hasPermission( $folderItem->id(), "filemanager_folder", "r", $user ) ||
140 eZVirtualFolder::isOwner( $user, $folderItem->id()) )
141
142 {
143 $t->parse( "folder_read", "folder_read_tpl" );
144 $i++;
145 }
146
147 $t->parse( "folder", "folder_tpl", true );
148 }
149
150
151 if ( count( $folderList ) > 0 )
152 {
153 $t->parse( "folder_list", "folder_list_tpl" );
154 }
155 else
156 {
157 $t->set_var( "folder_list", "" );
158 }
159
160 // Print out the files.
161
162 $count = $folder->countFiles();
163 $fileList =& $folder->files( "name", 0, $count );
164
165 $deleteFiles = false;
166 foreach ( $fileList as $file )
167 {
168 $t->set_var( "file_id", $file->id() );
169 // $t->set_var( "original_file_name", $file->originalFileName() );
170 $t->set_var( "original_file_name", $file->name() );
171 $t->set_var( "file_name", $file->name() );
172 $t->set_var( "file_url", $file->name() );
173 $t->set_var( "file_description", $file->description() );
174
175 $filePath = $file->filePath( true );
176
177 $size = $file->siFileSize();
178 $t->set_var( "file_size", $size["size-string"] );
179 $t->set_var( "file_unit", $size["unit"] );
180
181 $t->set_var( "file_read", "" );
182 $t->set_var( "file_write", "" );
183 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
184
185 if ( eZObjectPermission::hasPermission( $file->id(), "filemanager_file", "r", $user ) ||
186 eZVirtualFile::isOwner( $user ,$file->id() ) )
187 {
188 $t->parse( "read", "read_tpl" );
189 $i++;
190 }
191 else
192 {
193 $t->set_var( "read", "" );
194 }
195
196 $t->parse( "file", "file_tpl", true );
197
198 }
199
200 if ( count( $fileList ) > 0 )
201 {
202 $t->parse( "file_list", "file_list_tpl" );
203 }
204 else
205 {
206 $t->set_var( "file_list", "" );
207 }
208
209 $t->set_var( "image_dir", $ImageDir );
210 $t->set_var( "main_folder_id", $FolderID );
211
212 if ( $error == false )
213 {
214 $t->pparse( "output", "browse_page_tpl" );
215 }
216 else
217 {
218 eZHTTPTool::header( "Location: /error/403/" );
219 exit();
220 }
221
222 ?>
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZVirtualFile\isOwner
isOwner( $user, $file)
Definition: ezvirtualfile.php:376
eZVirtualFolder
Definition: ezvirtualfolder.php:43
eZVirtualFolder\isOwner
static isOwner( $user, $folderID)
Definition: ezvirtualfolder.php:421
$ImageDir
$ImageDir
Definition: ezfilemanager/admin/browse.php:40
$folderList
foreach( $pathArray as $path) $folderList
Definition: ezfilemanager/admin/browse.php:126
$pathArray
if( $folder->id() !=0) $pathArray
Definition: ezfilemanager/admin/browse.php:112
$t
$t
Definition: ezfilemanager/admin/browse.php:42
$returnUrl
$returnUrl
Definition: ezfilemanager/admin/browse.php:80
$user
$user
Definition: ezfilemanager/admin/browse.php:67
$folder
if(!isset( $FolderID)) $folder
Definition: ezfilemanager/admin/browse.php:74
$i
$i
Definition: ezfilemanager/admin/browse.php:128
$Language
$Language
Definition: ezfilemanager/admin/browse.php:39
$ini
$ini
Definition: ezfilemanager/admin/browse.php:38
$session
$session
Definition: ezfilemanager/admin/browse.php:78
$deleteFolders
$deleteFolders
Definition: ezfilemanager/admin/browse.php:129
$deleteFiles
$deleteFiles
Definition: ezfilemanager/admin/browse.php:165
$fileList
$fileList
Definition: ezfilemanager/admin/browse.php:163
$error
$error
Definition: ezfilemanager/admin/browse.php:76
$count
$count
Definition: ezfilemanager/admin/browse.php:162
$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
exit
exit
Definition: folder.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.