Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbug/user/imageedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: imageedit.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <16-Feb-2001 14:32:36 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
31 // // include_once( "classes/ezfile.php" );
32 // include_once( "classes/ezimagefile.php" );
33 // include_once( "ezbug/classes/ezbug.php" );
34
35 // include_once( "ezimagecatalogue/classes/ezimage.php" );
36
37 $ini = eZINI::instance( 'site.ini' );
38
39 $Language = $ini->variable( "eZBugMain", "Language" );
40
41 $session = new eZSession();
42
43 // This turns out to be not needed.
44 // $BugID = $session->variable( "BugID" );
45
46 if ( $Action == "Insert" )
47 {
48 $file = new eZPBImageFile();
49
50 if ( $file->getUploadedFile( "userfile" ) )
51 {
52 $bug = new eZBug( $BugID );
53 $image = new eZImage();
54 if( $image->checkImage( $file ) && $image->setImage( $file ) )
55 {
56 $image->setName( $Name );
57 $image->setCaption( $Caption );
58
59 $image->store();
60
61 $bug->addImage( $image );
62 eZPBLog::writeNotice( "Picture added to bug: $BugID from IP: $REMOTE_ADDR" );
63 }
64 }
65 else
66 {
67 print( $file->name() . " not uploaded successfully" );
68 }
69
70 // include_once( "classes/ezhttptool.php" );
71 eZHTTPTool::header( "Location: /bug/report/edit/" . $BugID . "/" );
72 exit();
73 }
74
75 if ( $Action == "Update" )
76 {
77 $file = new eZPBImageFile();
78
79 if ( $file->getUploadedFile( "userfile" ) )
80 {
81 $bug = new eZBug( $BugID );
82 $image = new eZImage();
83 if( $image->checkImage( $file ) && $image->setImage( $file ) )
84 {
85 $oldImage = new eZImage( $ImageID );
86 $bug->deleteImage( $oldImage );
87
88 $image->setName( $Name );
89 $image->setCaption( $Caption );
90 $image->store();
91
92 $bug->addImage( $image );
93 }
94 }
95 else
96 {
97 $image = new eZImage( $ImageID );
98 $image->setName( $Name );
99 $image->setCaption( $Caption );
100 $image->store();
101 }
102
103 // include_once( "classes/ezhttptool.php" );
104 eZHTTPTool::header( "Location: /bug/report/edit/" . $BugID . "/" );
105 exit();
106 }
107
108
109 if ( $Action == "Delete" )
110 {
111 $bug = new eZBug( $ButID );
112 $image = new eZImage( $ImageID );
113
114 $bug->deleteImage( $image );
115
116 // include_once( "classes/ezhttptool.php" );
117 eZHTTPTool::header( "Location: /bug/report/edit/" . $BugID . "/" );
118 exit();
119 }
120
121 // store the image definition
122 if ( $Action == "StoreDef" )
123 {
124 // $article = new eZArticle( $ArticleID );
125 //
126 // if ( isset( $ThumbnailImageID ) && ( $ThumbnailImageID != 0 ) && ( $ThumbnailImageID != "" ) )
127 // {
128 // $thumbnail = new eZImage( $ThumbnailImageID );
129 // $article->setThumbnailImage( $thumbnail );
130 // }
131 //
132 // if ( isset( $NewImage ) )
133 // {
134 // print( "new image" );
135 // // include_once( "classes/ezhttptool.php" );
136 // eZHTTPTool::header( "Location: /article/articleedit/imageedit/new/$ArticleID/" );
137 // exit();
138 // }
139 //
140 // // include_once( "classes/ezhttptool.php" );
141 // eZHTTPTool::header( "Location: /article/articleedit/edit/" . $ArticleID . "/" );
142 // exit();
143 }
144
145 $t = new eZTemplate( "kernel/ezbug/user/" . $ini->variable( "eZBugMain", "TemplateDir" ),
146 "kernel/ezbug/user/intl/", $Language, "imageedit.php" );
147
148 $t->setAllStrings();
149
150 $t->set_file( array(
151 "image_edit_page" => "imageedit.tpl",
152 ) );
153
154
155 $t->set_block( "image_edit_page", "image_tpl", "image" );
156
157 //default values
158 $t->set_var( "name_value", "" );
159 $t->set_var( "caption_value", "" );
160 $t->set_var( "action_value", "Insert" );
161 $t->set_var( "option_id", "" );
162 $t->set_var( "image", "" );
163
164 if ( $Action == "Edit" )
165 {
166 $bug = new eZBug( $BugID );
167 $image = new eZImage( $ImageID );
168
169 $t->set_var( "image_id", $image->id() );
170 $t->set_var( "name_value", $image->name() );
171 $t->set_var( "caption_value", $image->caption() );
172 $t->set_var( "action_value", "Update" );
173
174
175 $t->set_var( "image_alt", $image->caption() );
176
177 $variation = $image->requestImageVariation( 150, 150 );
178
179 $t->set_var( "image_src", "/" .$variation->imagePath() );
180 $t->set_var( "image_width", $variation->width() );
181 $t->set_var( "image_height", $variation->height() );
182 $t->set_var( "image_file_name", $image->originalFileName() );
183 $t->parse( "image", "image_tpl" );
184 }
185
186 $bug = new eZBug( $BugID );
187
188 $t->set_var( "bug_name", $bug->name() );
189 $t->set_var( "bug_id", $bug->id() );
190
191
192
193 $t->pparse( "output", "image_edit_page" );
194
195 ?>
eZBug
Definition: ezbug.php:80
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZImage
Definition: ezimage.php:95
eZPBImageFile
Definition: ezpbimagefile.php:71
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZSession
Definition: lib/ezsession/classes/ezsession.php:65
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$ImageID
$ImageID
Definition: companytypelist.php:201
$t
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") if( $Action=="StoreDef") $t
Definition: ezbug/user/imageedit.php:145
$bug
if( $Action=="Edit") $bug
Definition: ezbug/user/imageedit.php:186
$Language
$Language
Definition: ezbug/user/imageedit.php:39
$ini
$ini
Definition: ezbug/user/imageedit.php:37
$session
$session
Definition: ezbug/user/imageedit.php:41
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
$image
$image
Definition: user/articlelist.php:242
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.