view e2gallerypro/e2upload/outputxml.php @ 8:1b77e8657088 judyates

[svn r9] saving for transference to cd
author rlm
date Fri, 19 Mar 2010 07:17:36 -0400
parents 3f6b44aa6b35
children
line wrap: on
line source
1 <?php include('../e2config.php'); include ("password_protect.php"); ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <title>(E)2 Gallery Pro File Manager</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8 <link rel="shortcut icon" href="http://e2interactive.com/favicon.ico" />
9 <style type="text/css">
10 body {
11 font-size: 11px;
12 font-family: Tahoma, sans-serif;
13 background: #F1F1F1 url(images/bodybg.png) repeat-x top center;
14 }
15 .dsep{
16 clear:both;
17 border-bottom: dotted 1px #999;
18 margin:20px 0;
19 }
20 #maincontent img{
21 margin: 0 10px 10px;
22 }
23 #container #header {
24 background-image: url(images/adminheader.png);
25 background-repeat: no-repeat;
26 background-position: center top;
27 width:750px;
28 text-align: center;
29 height: 87px;
30 }
31 #container {
32 text-align: center;
33 width: 750px;
34 margin:0 auto;
35 }
36 #container #maincontent {
37 text-align: left;
38 padding: 10px 10px;
39 border: dotted #CCC 1px;
40 -moz-border-radius: 10px;
41 -khtml-border-radius: 10px;
42 -webkit-border-radius: 10px;
43 border-radius: 10px;
44 margin-top: 10px;
45 background: #E1E1E1;
46 }
47 #container #navigation {
48 height: 35px;
49 padding: 0 10px;
50 }
51 #navigation #manage, #navigation #managexml, #navigation #outputxml, #navigation #seegallery {
52 background-image: url(images/tab_bg.png);
53 background-repeat: repeat-x;
54 background-position: center top;
55 height: 19px;
56 float: left;
57 padding: 5px 6px 0;
58 margin: 1px 5px 5px;
59 border-left: solid 1px #CCC;
60 border-right: solid 1px #CCC;
61 border-bottom: solid 1px #CCC;
62 -moz-border-radius: 0 0 5px 5px;
63 -webkit-border-bottom-left-radius: 5px;
64 -webkit-border-bottom-right-radius: 5px;
65 -khtml-border-bottom-left-radius: 5px;
66 -khtml-border-bottom-right-radius: 5px;
67 border-bottom-left-radius: 5px;
68 border-bottom-right-radius: 5px;
69 cursor:pointer;
70 }
71 #navigation #logout{
72 background-image: url(images/tab_bg.png);
73 background-repeat: repeat-x;
74 background-position: center top;
75 height: 19px;
76 float: right;
77 padding: 5px 6px 0;
78 margin: 1px 5px 5px;
79 border-left: solid 1px #CCC;
80 border-right: solid 1px #CCC;
81 border-bottom: solid 1px #CCC;
82 -moz-border-radius: 0 0 5px 5px;
83 -webkit-border-bottom-left-radius: 5px;
84 -webkit-border-bottom-right-radius: 5px;
85 -khtml-border-bottom-left-radius: 5px;
86 -khtml-border-bottom-right-radius: 5px;
87 border-bottom-left-radius: 5px;
88 border-bottom-right-radius: 5px;
89 cursor:pointer;
90 }
91 #navigation a{
92 text-decoration:none;
93 color:#333;
94 }
95 #navigation a:hover{
96 text-decoration:underline;
97 color:#333;
98 }
99 .xmloutput{
100 padding:15px;
101 background: #FFF;
102 margin:10px 3px;
103 }
104 #maincontent .textinput{
105 width:550px;
106 font:16px "Trebuchet MS", Verdana, Arial, sans-serif;
107 }
108 #maincontent .alrignright{
109 float:right;
110 }
111 .floatleft{
112 float:left;
113 padding:0 15px;
114 }
115 .clear{
116 clear:both;
117 }
118 .error{
119 color:#990000;
120 font-size:16px;
121 }
122 </style>
124 <link rel="stylesheet" media="all" type="text/css" href="Css/FileManager.css" />
125 <link rel="stylesheet" media="all" type="text/css" href="Css/Additions.css" />
127 <script type="text/javascript" src="js/mootools-core.js"></script>
128 <script type="text/javascript" src="js/mootools-more.js"></script>
130 <script type="text/javascript" src="Source/FileManager.js"></script>
131 <script type="text/javascript" src="Source/Language/Language.en.js"></script>
132 <script type="text/javascript" src="Source/Language/Language.de.js"></script>
133 <script type="text/javascript" src="Source/Additions.js"></script>
135 <script type="text/javascript" src="Source/Uploader/Fx.ProgressBar.js"></script>
136 <script type="text/javascript" src="Source/Uploader/Swiff.Uploader.js"></script>
138 <script type="text/javascript" src="Source/Uploader.js"></script>
140 <script type="text/javascript">
141 window.addEvent('domready', function(){
142 /* Simple Example */
143 var manager = new FileManager({
144 url: 'manager.php',
145 assetBasePath: 'Assets',
146 language: 'en',
147 uploadAuthData: {session: 'MySessionId'}
148 });
149 $('manage').addEvent('click', manager.show.bind(manager));
151 /* XML upload*/
152 var manager = new FileManager({
153 url: 'managerxml.php',
154 assetBasePath: 'Assets',
155 language: 'en',
156 uploadAuthData: {session: 'MySessionId'}
157 });
158 $('managexml').addEvent('click', manager.show.bind(manager));
160 });
161 </script>
162 </head>
163 <body>
164 <div id="container">
165 <a href="index.php"><div id="header"></div></a>
166 <div id="navigation">
167 <div id="manage">Upload/Manage Images</div>
168 <div id="managexml">Upload/Edit XML</div>
169 <a href="outputxml.php"><div id="outputxml">Output XML</div></a>
170 <a href="../"><div id="seegallery">See Gallery</div></a>
171 <a href="?logout=1"><div id="logout">Log Out</div></a>
172 </div>
173 <div id="maincontent">
174 <a href="xml/e2galleryproXMLsample.xml" class="alrignright">Download XML Sample File</a>
175 <h2>Output XML for Image Gallery</h2>
176 Create the xml for the image inside which folder? Set the folder to look at to create the XML automagically.
177 <br />
178 <br />
179 Default file paths are:<br />
180 <?php
181 function rp($path) {
182 $out=array();
183 foreach(explode('/', $path) as $i=>$fold){
184 if ($fold=='' || $fold=='.') continue;
185 if ($fold=='..' && $i>0 && end($out)!='..') array_pop($out);
186 else $out[]= $fold;
187 } return ($path{0}=='/'?'/':'').join('/', $out);
188 }
189 ?>
190 <strong>Gallery Path:</strong> Galleries/gallery1/
191 <br />
192 <strong>Large Path:</strong> Galleries/gallery1/large/
193 <br />
194 <strong>Thumbnail Path:</strong> Galleries/gallery1/thumbs/
195 <br /><br />
196 <?php
198 function getImages($path, $thumbPath) {
200 $files = array();
201 $fileNames = array();
202 $i = 0;
203 $errorMessage='';
204 if (is_dir($path)) {
205 if ($dh = opendir($path)) {
206 while (($file = readdir($dh)) !== false) {
207 if ($file == "." || $file == ".." || $file == ".DS_Store") continue;
208 $fullpath = $path . "/" . $file;
209 $fkey = strtolower($file);
210 while (array_key_exists($fkey,$fileNames)) $fkey .= " ";
211 $a = stat($fullpath);
212 $files[$fkey]['size'] = $a['size'];
213 if ($a['size'] == 0) $files[$fkey]['sizetext'] = "-";
214 else if ($a['size'] > 1024) $files[$fkey]['sizetext'] = (ceil($a['size']/1024*100)/100) . " K";
215 else if ($a['size'] > 1024*1024) $files[$fkey]['sizetext'] = (ceil($a['size']/(1024*1024)*100)/100) . " Mb";
216 else $files[$fkey]['sizetext'] = $a['size'] . " bytes";
217 $files[$fkey]['name'] = $file;
218 $files[$fkey]['type'] = filetype($fullpath);
219 $fileNames[$i++] = $fkey;
220 }
221 closedir($dh);
222 } else {$errorMessage= true; echo "<strong class='error'>Cannot open directory: $path | Fill out a valid Gallery Path</strong>";}
223 } else {$errorMessage= true; echo "<strong class='error'>Path is not a directory: $path | Fill out a valid Gallery Path</strong>";}
224 sort($fileNames,SORT_STRING);
225 $sortedFiles = array();
226 $i = 0;
227 $photos = array();
228 $relativePath = rp( dirname($_SERVER['PHP_SELF']) );
229 if($errorMessage != true){
230 foreach($fileNames as $f) $sortedFiles[$i++] = $files[$f];
233 echo'Copy the below XML and create your XML file and upload it via the Upload XML button above:';
234 echo'<a href="outputxml.php" class="alrignright">Reset Output</a><div class="clear"></div>';
235 echo '<div class="xmloutput">';
236 echo'&lt;gallery&gt;<br />';
237 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;'.$_GET['gallerytitle'].'&lt;/title&gt;<br />';
238 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;'.$_GET['galleryDescription'].'&lt;/description&gt;<br />';
239 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;gallerypath&gt;'.$relativePath.'/'.$_GET['gallerypath'].'&lt;/gallerypath&gt; <br />';
240 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;largeimgpath&gt;'.$relativePath.'/'.$_GET['largepath'].'&lt;/largeimgpath&gt;<br />';
241 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;thumbpath&gt;'.$relativePath.'/'.$_GET['thumbpath'].'&lt;/thumbpath&gt;<br />';
242 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;mainthumb&gt;'.$relativePath.'/'.$_GET['gallerypath'].'&lt;/mainthumb&gt;<br />';
243 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;mainthumbsrc&gt;mainthumb.jpg&lt;/mainthumbsrc&gt;<br />';
244 $j = 0;
246 foreach ($sortedFiles as $file) {
248 if($file['type']!='dir'&& $file['name']!='mainthumb.jpg'){
249 // get image sizes
250 list($width, $height, $type, $attr) = getimagesize($path."/".$file['name'], $info);
251 $size = $file['sizetext'];
252 if(isset($info['APP13'])){
253 $iptc = iptcparse($info['APP13']);
254 $title = $iptc['2#005'][0];
255 if(isset($iptc['2#120'][0])){
256 $description = $iptc['2#120'][0];
257 $description = str_replace("\r", "<br/>", $description);
258 $description = addslashes($description);
259 }
260 if(isset($iptc['2#025'][0])){
261 $keywords = $iptc['2#025'][0];
262 }
263 $author = $iptc['2#080'][0];
264 $copyright = $iptc['2#116'][0];
266 }else if(isset($info['APP0']) && !isset($info['APP13'])){
267 $iptc = iptcparse($info['APP0']);
268 $title = $iptc['2#005'][0];
269 $description = $iptc['2#120'][0];
270 $description = str_replace("\r", "<br/>", $description);
271 $description = addslashes($description);
272 $keywords = $iptc['2#025'][0];
273 $author = $iptc['2#080'][0];
274 $copyright = $iptc['2#116'][0];
275 }else{
276 $title = '';
277 $description = '';
278 $description = '';
279 $keywords = '';
280 $author = '';
281 $copyright = '';
282 }
285 array_push($photos, $width);
286 array_push($photos, $height);
288 //echo'<image Thumb="galleries/'.$thumbePath.'/thumbs/'.$file[name].'" Large="galleries/'.$path."/".$file[name].'" Caption="'.$title.'" Colour="000000">';
289 //'<copy><![CDATA['.$title.']]></copy>';
290 //echo'</image>';
292 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;item type="image"&gt;<br />';
293 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;'.$title.'&lt;/title&gt;<br />';
294 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;author&gt;'.$author.'&lt;/author&gt;<br />';
295 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copyright&gt;'.$copyright.'&lt;/copyright&gt;<br />';
296 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;'.$description.'&lt;/description&gt;<br />';
297 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;src&gt;'.$file['name'].'&lt;/src&gt;<br />';
298 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;demensions width="'.$width.'" height="'.$height.'" /&gt;<br />';
299 if(isset($_GET['largepath'])){
300 $largePath = $_GET['largepath'];
301 if(is_file($largePath."/".$file['name'])){
302 list($largeWidth, $largeHeight, $largeType, $largeAttr) = getimagesize($largePath."/".$file['name'], $info);
303 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;large width="'.$largeWidth.'" height="'.$largeHeight.'" /&gt;<br />';
304 }
305 }
306 if(isset($_GET['showforsale'])){
307 $showforsale = $_GET['showforsale'];
308 if($showforsale=='true'){
309 if($_GET['currency']=="USD"){$currencySymbol='$';}else if($_GET['currency']=="EURO"){$currencySymbol='&euro;';}
310 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sellprint type="'.$_GET['checkouttype'].'" currency="'.$_GET['currency'].'" currencysymbol="'.$currencySymbol.'"&gt;<br />';
311 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;price size="8x10"&gt;15&lt;/price&gt;<br />';
312 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;price size="11x14"&gt;25&lt;/price&gt;<br />';
313 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;price size="16x20"&gt;55&lt;/price&gt;<br />';
314 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;price size="20x24"&gt;65&lt;/price&gt;<br />';
315 echo'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sellprint&gt;<br />';
316 }
317 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;/item&gt;<br />';
319 $j++;
320 }
321 }
323 }
324 echo'&nbsp;&nbsp;&nbsp;&nbsp;&lt;totalitems&gt;'.$j.'&lt;/totalitems&gt;<br />';
325 echo'&lt;/gallery&gt;<br />';
326 echo'</div>';
327 }
328 }
329 if(isset($_GET['gallerypath'])&&isset($_GET['thumbpath'])){
330 getImages($_GET['gallerypath'], $_GET['thumbpath'] );
331 ?>
332 <a href="outputxml.php" class="alrignright">Reset Output</a><div class="clear"></div>
333 <h2>Create New Gallery XML:</h2><br />
334 <br />
335 <form name="form1" method="get" action="<?php echo $_SERVER['PHP_SELF'] ;?>">
336 <label id="gallerytitle"><strong>Gallery Title</strong></label>
337 <br />
338 <input type="text" class="textinput" name="gallerytitle" value="" />
339 <br /><br />
340 <label id="galleryDescription"><strong>Gallery Description</strong> <small>(No Special Characters)</small></label>
341 <br />
342 <textarea name="galleryDescription" rows="4" class="textinput"></textarea>
343 <br /><br />
344 <label id="gallerypath"><strong>Gallery Path</strong></label>
345 <br />
346 <input type="text" class="textinput" name="gallerypath" value="Galleries/gallery1/" />
347 <br /><br />
348 <label id="thumbpath"><strong>Thumbnail Path</strong></label>
349 <br />
350 <input type="text" class="textinput" name="thumbpath" value="Galleries/gallery1/thumbs/" />
351 <br /> <br />
352 <label id="largepath"><strong>Large Path</strong></label>
353 <br />
354 <input type="text" class="textinput" name="largepath" value="Galleries/gallery1/large/" /> <br />
355 <small>(Fill out path even if you uploaded no large images it will detect that they're not there. unless there is no large folder)</small>
356 <br /> <br />
357 <div class="floatleft"><h3>Sell Prints?</h3>
358 <input type="radio" name="showforsale" id="true" value="true" align="absmiddle" /><label for="true">Yes</label> <input type="radio" id="false" name="showforsale" value="false" align="absmiddle" /><label for="false">No</label>
359 <br /> <br /></div>
360 <div class="floatleft"><h3>Checkout Type</h3>
361 <input type="radio" value="google" name="checkouttype" id="google" align="absmiddle" /><label for="google">Google Checkout</label> <input type="radio" id="paypal" value="paypal" name="checkouttype" align="absmiddle" /><label for="paypal">Paypal</label>
362 <br /> <br /></div>
364 <div class="floatleft"><h3>Currency:</h3>
365 <input type="radio" value="USD" name="currency" id="USD" align="absmiddle" /><label for="USD">USD</label> <input type="radio" id="EURO" value="EURO" name="currency" align="absmiddle" /><label for="EURO">EURO</label>
366 <br /> <br /></div>
367 <div class="clear"></div>
368 <input type="submit" name="submit" value="Output XML">
369 </form>
370 <br />
371 <?php
372 }else{
373 ?>
374 <form name="form1" method="get" action="<?php echo $_SERVER['PHP_SELF'] ;?>">
375 <label id="gallerytitle"><strong>Gallery Title</strong></label>
376 <br />
377 <input type="text" class="textinput" name="gallerytitle" value="" />
378 <br /><br />
379 <label id="galleryDescription"><strong>Gallery Description</strong> <small>(No Special Characters)</small></label>
380 <br />
381 <textarea name="galleryDescription" rows="4" class="textinput"></textarea>
382 <br /><br />
383 <label id="gallerypath"><strong>Gallery Path</strong></label>
384 <br />
385 <input type="text" class="textinput" name="gallerypath" value="Galleries/gallery1/" />
386 <br /><br />
387 <label id="thumbpath"><strong>Thumbnail Path</strong></label>
388 <br />
389 <input type="text" class="textinput" name="thumbpath" value="Galleries/gallery1/thumbs/" />
390 <br /> <br />
391 <label id="largepath"><strong>Large Path</strong></label>
392 <br />
393 <input type="text" class="textinput" name="largepath" value="Galleries/gallery1/large/" /> <br />
394 <small>(Fill out path even if you uploaded no large images it will detect that they're not there. unless there is no large folder)</small>
395 <br /> <br />
396 <div class="floatleft"><h3>Sell Prints?</h3>
397 <input type="radio" name="showforsale" id="true" value="true" align="absmiddle" /><label for="true">Yes</label> <input type="radio" id="false" name="showforsale" value="false" align="absmiddle" /><label for="false">No</label>
398 <br /> <br /></div>
399 <div class="floatleft"><h3>Checkout Type</h3>
400 <input type="radio" value="google" name="checkouttype" id="google" align="absmiddle" /><label for="google">Google Checkout</label> <input type="radio" id="paypal" value="paypal" name="checkouttype" align="absmiddle" /><label for="paypal">Paypal</label>
401 <br /> <br /></div>
403 <div class="floatleft"><h3>Currency:</h3>
404 <input type="radio" value="USD" name="currency" id="USD" align="absmiddle" /><label for="USD">USD</label> <input type="radio" id="EURO" value="EURO" name="currency" align="absmiddle" /><label for="EURO">EURO</label>
405 <br /> <br /></div>
406 <div class="clear"></div>
407 <input type="submit" name="submit" value="Output XML">
408 </form>
409 <?php
410 }
411 ?>
416 <div class="dsep"></div>
417 </div>
418 </div>
419 </body>
420 </html>