made a copy
[atutor.git] / users / prog.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg        */
6 /* Adaptive Technology Resource Centre / University of Toronto  */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14
15 $_user_location = 'users';
16 define('AT_INCLUDE_PATH', '../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18
19 ?>
20 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
21 <html lang="en">
22 <head>
23         <title><?php echo _AT('upload_progress'); ?></title>
24         <?php if ($_GET['frame']) { ?>
25                 <META HTTP-EQUIV="refresh" content="3;URL=prog.php?frame=1"> 
26         <?php } ?>
27         <link rel="stylesheet" href="../stylesheet.css" type="text/css" />
28         <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
29 </head>
30 <body <?php
31         if ($_SESSION['done']) {
32                 echo 'onLoad="parent.window.close();"';
33         }
34
35 ?>>
36
37 <?php if (!$_GET['frame']) { 
38         
39         $_SESSION['done'] = 0;
40         session_write_close();
41 ?>
42 &nbsp;<a href="javascript:window.close();"><?php echo _AT('close'); ?></a>
43 <h3><?php echo _AT('upload_progress'); ?></h3>
44 <p><small><?php echo _AT('window_auto_close'); ?></small></p>
45
46 <br /><br />
47 <table border="0" align="center">
48 <tr>
49         <td><img src="../images/transfer.gif" height="20" width="90" alt="file upload in progress..."></td>
50         <td valign="middle"><iframe src="prog.php?frame=1" width="100" height="25" frameborder="0" scrolling=no marginwidth="0" marginheight="1">
51 </iframe>
52 <?php } else { 
53         if (!$_GET['t']) {
54                 $newest_file_name = '';
55                 $newest_file_time = 0;
56                 // get the name of the temp file.
57                 if ($dir = @opendir('/tmp')) {
58                         while (($file = readdir($dir)) !== false) {
59                                 if ((strlen($file) == 9) && (substr($file, 0, 3) == 'php')) {
60                                         $filedata = stat('/tmp/'.$file);
61                                         if ($filedata['mtime'] > $newest_file_time) {
62                                                 $newest_file_time = $filedata['mtime'];
63                                                 $newest_file_name = $file;
64                                                 $size = $filedata['size'] / 1024;
65                                         }
66                                 }
67                         }
68                         closedir($dir);
69                 }
70         } else {
71                 $filedata = stat('/tmp/'.$_GET['t']);
72                 $size = $filedata['size'] / 1024;
73         }
74
75         echo '<small>';
76         // not sure where these are displayed in the progress popup
77         if ($size == '') {
78                 echo '<em>Unknown</em> '._AT('kb');
79         } else {
80                 echo $size.' '._AT('kb');
81         }
82         echo '</small>';
83 } ?></td>
84 </tr>
85 </table>
86 </body>
87 </html>