move code up one directory
[atutor.git] / tools / prog.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
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 sleep(1);
15 $_user_location = 'prog';
16 define('AT_INCLUDE_PATH', '../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 session_write_close();
19 if ($_GET['tile']) {
20         $lang_variable = 'tile_progress';
21 } else {
22         $lang_variable = 'upload_progress';
23 }
24
25 ?>
26 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
27 <html lang="<?php echo $myLang->getCode(); ?>">
28 <head>
29         <title><?php echo _AT($lang_variable); ?></title>
30         <?php if ($_GET['frame']) { ?>
31                 <meta http-equiv="refresh" content="3;URL=prog.php?frame=1" /> 
32         <?php } ?>
33         <meta http-equiv="Content-Type" content="text/html; <?php echo $myLang->getCharacterSet(); ?>" />
34     <script src="<?php echo $_base_path; ?>jscripts/infusion/InfusionAll.js" type="text/javascript"></script>
35     <script language="javascript" type="text/javascript">
36     //<!--
37     jQuery.noConflict();
38     //-->
39     </script>
40     <script src="<?php echo $_base_path; ?>jscripts/ATutor.js" type="text/javascript"></script>   
41     <link rel="stylesheet" href="<?php echo $_base_path; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/styles.css" type="text/css" />
42     <style id="pref_style" type="text/css"></style> 
43 </head>
44 <body <?php
45         if ($_SESSION['done']) {
46                 echo 'onload="parent.window.close();"';
47         }
48 ?>>
49 <?php 
50 if (!$_GET['frame']) {  ?>
51 &nbsp;<a href="javascript:window.close();"><?php echo _AT('close'); ?></a>
52 <h3><?php echo _AT($lang_variable); ?></h3>
53 <p><small><?php echo _AT('window_auto_close'); ?></small></p>
54
55 <br /><br />
56 <table border="0" align="center">
57 <tr>
58         <td><img src="<?php echo AT_BASE_HREF; ?>images/transfer.gif" height="20" width="90" alt="<?php echo _AT($lang_variable); ?>"></td>
59         <td valign="middle"><iframe src="prog.php?frame=1" width="100" height="25" frameborder="0" scrolling="no" marginwidth="0" marginheight="1">
60 </iframe>
61 <?php } else { 
62         $tmp_dir = ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR;
63         if (!$_GET['t']) {
64                 $newest_file_name = '';
65                 $newest_file_time = 0;
66                 // get the name of the temp file.
67                 if ($dir = @opendir($tmp_dir)) {
68                         while (($file = readdir($dir)) !== false) {
69                                 if ((strlen($file) == 9) && (substr($file, 0, 3) == 'php')) {
70                                         $filedata = stat($tmp_dir . $file);
71                                         if ($filedata['mtime'] > $newest_file_time) {
72                                                 $newest_file_time = $filedata['mtime'];
73                                                 $newest_file_name = $file;
74                                                 $size = $filedata['size'] / 1024;
75                                         }
76                                 }
77                         }
78                         closedir($dir);
79                 }
80         } else {
81                 $filedata = stat($tmp_dir . $_GET['t']);
82                 $size = $filedata['size'] / AT_KBYTE_SIZE;
83         }
84         // not sure where these are displayed in the progress popup
85         echo '<small>';
86         if ($size == '') {
87                 echo '<strong>'._AT('unknown').' </strong>  '._AT('kb');
88         } else {
89                 echo number_format($size, 2).' '._AT('kb');
90         }
91         echo '</small>';
92 } ?></td>
93 </tr>
94 </table>
95 <script type="text/javascript">
96 //<!--
97     <?php require_once(AT_INCLUDE_PATH.'../jscripts/ATutor_js.php'); ?>
98 //-->
99 </script>
100 </body>
101 </html>