Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbug/user/fileedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: fileedit.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <16-Feb-2001 14:33:48 fh>
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/ezfile.php" );
31 // include_once( "ezbug/classes/ezbug.php" );
32 // include_once( "ezfilemanager/classes/ezvirtualfile.php" );
33
34 $ini = eZINI::instance( 'site.ini' );
35
36 $Language = $ini->variable( "eZBugMain", "Language" );
37
38 $session = new eZSession();
39
40 // Turns out this is not needed.
41 // $BugID = $session->variable( "BugID" );
42
43 if ( $Action == "Insert" )
44 {
45 $file = new eZPBFile();
46
47 if ( $file->getUploadedFile( "userfile" ) )
48 {
49 $bug = new eZBug( $BugID );
50
51 $uploadedFile = new eZVirtualFile();
52 $uploadedFile->setName( $Name );
53 $uploadedFile->setDescription( $Description );
54
55 $uploadedFile->setFile( $file );
56
57 $uploadedFile->store();
58
59 $bug->addFile( $uploadedFile );
60
61 eZPBLog::writeNotice( "File added to bug $BugID from IP: $REMOTE_ADDR" );
62 }
63 else
64 {
65 print( $file->name() . " not uploaded successfully" );
66 }
67
68 // include_once( "classes/ezhttptool.php" );
69 echo "Location: /bug/report/edit/" . $BugID . "/";
70 die();
71 eZHTTPTool::header( "Location: /bug/report/edit/" . $BugID . "/" );
72 exit();
73 }
74
75 if ( $Action == "Update" )
76 {
77 // $file = new eZFilerFile();
78
79 // if ( $file->getUploadedFile( "userfile" ) )
80 // {
81 // $article = new eZArticle( $ArticleID );
82
83 // $oldFiler = new eZFiler( $FilerID );
84 // $article->deleteFiler( $oldFiler );
85
86 // $filer = new eZFiler();
87 // $filer->setName( $Name );
88 // $filer->setCaption( $Caption );
89
90 // $filer->setFiler( $file );
91
92 // $filer->store();
93
94 // $article->addFiler( $filer );
95 // }
96 // else
97 // {
98 // $filer = new eZFiler( $FilerID );
99 // $filer->setName( $Name );
100 // $filer->setCaption( $Caption );
101 // $filer->store();
102 // }
103
104 // include_once( "classes/ezhttptool.php" );
105 eZHTTPTool::header( "Location: /bug/edit/edit/" . $BugID . "/" );
106 exit();
107 }
108
109
110 if ( $Action == "Delete" )
111 {
112 $bug = new eZBug( $BugID );
113 $file = new eZVirtualFile( $FileID );
114
115 $bug->deleteFile( $file );
116
117 // include_once( "classes/ezhttptool.php" );
118 eZHTTPTool::header( "Location: /bug/edit/" . $BugID . "/" );
119 exit();
120 }
121
122
123 $t = new eZTemplate( "kernel/ezbug/user/" . $ini->variable( "eZBugMain", "TemplateDir" ),
124 "kernel/ezbug/user/intl", $Language, "fileedit.php" );
125
126 $t->setAllStrings();
127
128 $t->set_file( array(
129 "file_edit_page" => "fileedit.tpl",
130 ) );
131
132
133 //default values
134 $t->set_var( "name_value", "" );
135 $t->set_var( "description_value", "" );
136 $t->set_var( "action_value", "Insert" );
137 $t->set_var( "option_id", "" );
138 $t->set_var( "file", "" );
139
140 if ( $Action == "Edit" )
141 {
142 $bug = new eZBug( $BugID );
143 $file = new eZVirtualFile( $FileID );
144
145 $t->set_var( "bug_name", $bug->name() );
146
147 $t->set_var( "file_id", $file->id() );
148 $t->set_var( "name_value", $file->name() );
149 $t->set_var( "description_value", $file->description() );
150 $t->set_var( "action_value", "Update" );
151 }
152
153 $bug = new eZBug( $BugID );
154
155 $t->set_var( "bug_name", $bug->name() );
156 $t->set_var( "bug_id", $bug->id() );
157
158
159
160 $t->pparse( "output", "file_edit_page" );
161
162 ?>
$Description
$Description
Definition: articlelistrss.php:38
eZBug
Definition: ezbug.php:80
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZPBFile
Definition: ezpbfile.php:49
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZSession
Definition: lib/ezsession/classes/ezsession.php:65
eZTemplate
Definition: eztemplate.php:107
eZVirtualFile
Definition: ezvirtualfile.php:42
$Action
$Action
Definition: companysearch.php:80
$bug
if( $Action=="Edit") $bug
Definition: ezbug/user/fileedit.php:153
$Language
$Language
Definition: ezbug/user/fileedit.php:36
$ini
$ini
Definition: ezbug/user/fileedit.php:34
$t
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $t
Definition: ezbug/user/fileedit.php:123
$session
$session
Definition: ezbug/user/fileedit.php:38
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.