moved code up one level to eliminate the docs subdirectory
[acontent.git] / home / prog.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 sleep(1);
14
15 define('TR_INCLUDE_PATH', '../include/');
16 require(TR_INCLUDE_PATH.'vitals.inc.php');
17 session_write_close();
18 if ($_GET['tile']) {
19         $lang_variable = 'tile_progress';
20 } else {
21         $lang_variable = 'upload_progress';
22 }
23
24 ?>
25 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
26 <html lang="<?php echo $myLang->getCode(); ?>">
27 <head>
28         <title><?php echo _AT($lang_variable); ?></title>
29         <?php if ($_GET['frame']) { ?>
30                 <META HTTP-EQUIV="refresh" content="3;URL=prog.php?frame=1"> 
31         <?php } ?>
32         <link rel="stylesheet" href="<?php echo $_base_path; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/styles.css" type="text/css" />
33         <meta http-equiv="Content-Type" content="text/html; <?php echo $myLang->getCharacterSet(); ?>" />
34 </head>
35 <body <?php
36         if ($_SESSION['done']) {
37                 echo 'onload="parent.window.close();"';
38         }
39 ?>>
40 <?php 
41 if (!$_GET['frame']) {  ?>
42 &nbsp;<a href="javascript:window.close();"><?php echo _AT('close'); ?></a>
43 <h3><?php echo _AT($lang_variable); ?></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="<?php echo TR_BASE_HREF; ?>images/transfer.gif" height="20" width="90" alt="<?php echo _AT($lang_variable); ?>"></td>
50         <td valign="middle"><iframe src="home/prog.php?frame=1" width="100" height="25" frameborder="0" scrolling="no" marginwidth="0" marginheight="1">
51 </iframe>
52 <?php } else { 
53         $tmp_dir = ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR;
54         if (!$_GET['t']) {
55                 $newest_file_name = '';
56                 $newest_file_time = 0;
57                 // get the name of the temp file.
58                 if ($dir = @opendir($tmp_dir)) {
59                         while (($file = readdir($dir)) !== false) {
60                                 if ((strlen($file) == 9) && (substr($file, 0, 3) == 'php')) {
61                                         $filedata = stat($tmp_dir . $file);
62                                         if ($filedata['mtime'] > $newest_file_time) {
63                                                 $newest_file_time = $filedata['mtime'];
64                                                 $newest_file_name = $file;
65                                                 $size = $filedata['size'] / 1024;
66                                         }
67                                 }
68                         }
69                         closedir($dir);
70                 }
71         } else {
72                 $filedata = stat($tmp_dir . $_GET['t']);
73                 $size = $filedata['size'] / TR_KBYTE_SIZE;
74         }
75         // not sure where these are displayed in the progress popup
76         echo '<small>';
77         if ($size == '') {
78                 echo '<em>'._AT('unknown').' </em>  '._AT('kb');
79         } else {
80                 echo number_format($size, 2).' '._AT('kb');
81         }
82         echo '</small>';
83 } ?></td>
84 </tr>
85 </table>
86 </body>
87 </html>