1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
<?php /** * upload.php * * Displays and runs the file upload dialog * * @package TeamCalPro * @version 3.3.001 * @author George Lewe * @copyright Copyright (c) 2004-2010 by George Lewe * @link http://www.lewe.com * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License */
//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";
/** * Set parent flag to control access to child scripts */ define( '_VALID_TCPRO', 1 );
/** * Includes */ require ("config.tcpro.php"); require_once ("includes/functions.tcpro.php"); getOptions(); if (strlen($CONF['options']['lang'])) require ("includes/lang/" . $CONF['options']['lang'] . ".tcpro.php"); else require ("includes/lang/english.tcpro.php");
require_once ("includes/upload.class.php");
$UPL = new tcUpload;
/** * Check if allowed */ if (!checkAuth("admin")) { // Not authorized. Get outta here jsCloseAndReload("index.php"); }
/** * Check what type of Upload is desired */ switch ($_REQUEST['target']) { case "avatar": $imagedir=$CONF['app_avatar_dir']; $max_size = 1024 * 250; // the max. size for uploading $UPL->upload_dir = $CONF['app_root'] . $CONF['app_avatar_dir']; $UPL->extensions = array ( ".gif", ".jpg", ".png" ); $UPL->max_length_filename = 50; $UPL->rename_file = true; break; case "icon": $imagedir=$CONF['app_icon_dir']; $max_size = 1024 * 250; // the max. size for uploading $UPL->upload_dir = $CONF['app_root'] . $CONF['app_icon_dir']; $UPL->extensions = array ( ".gif", ".jpg", ".png" ); $UPL->max_length_filename = 50; $UPL->rename_file = true; break; default: jsCloseAndReload("index.php"); break; }
if ($CONF['options']['lang']=="deutsch") $UPL->language="de";
if (isset ($_POST['Submit'])) { $UPL->the_temp_file = $_FILES['upload']['tmp_name']; $UPL->the_file = $_FILES['upload']['name']; $UPL->http_error = $_FILES['upload']['error']; $UPL->replace = (isset ($_POST['replace'])) ? $_POST['replace'] : "n"; $UPL->do_filename_check = "y"; $new_name = (isset($_POST['newname'])) ? $_POST['newname'] : ""; if ($UPL->upload($new_name)) { $full_path = $UPL->upload_dir . $UPL->file_copy; $info = $UPL->get_uploaded_file_info($full_path); } }
require("includes/header.html.inc.php"); ?> <body> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> <table class="dlg"> <tr> <td class="dlg-header"> <?php printDialogTop($LANG['upload_title'],"upload_dialog.html","ico_upload.png"); ?> </td> </tr> <tr> <td class="dlg-body"> <form name="form1" enctype="multipart/form-data" method="post" action="<?=$_SERVER['PHP_SELF']?>?lang=<?=$CONF['options']['lang']?>&target=<?=$_REQUEST['target']?>"> <input type="hidden" name="MAX_FILE_SIZE" value="<?=$max_size?>"><br> <table class="dlg-frame"> <tr> <td class="dlg-body"><strong><?=$LANG['upload_maxsize']?>:</strong></td> <td class="dlg-body"><?=$max_size?> bytes</td> </tr> <tr> <td class="dlg-body"><strong><?=$LANG['upload_extensions']?>:</strong></td> <td class="dlg-body"><?php echo implode(" ", $UPL->extensions); ?></td> </tr> <tr> <td class="dlg-body"><strong><?=$LANG['upload_file']?>:</strong></td> <td class="dlg-body"><input type="file" name="upload" size="30" class="text"></td> </tr> <tr> <td class="dlg-body"> <strong><?=$LANG['upload_rename']?>:</strong> <img src="<?=$config['app_url']?>themes/<?=$theme?>/img/ico_help.png" border="0" align="absmiddle" alt="Tooltip" onmouseover="return overlib('<?=$LANG['upload_tt_rename']?>',<?=$CONF['ovl_tt_settings']?>);" onmouseout="return nd();"> </td> <td class="dlg-body"><input type="text" name="newname" size="20" class="text"> <?=$LANG['upload_rename_noext']?></td> </tr> <tr> <td class="dlg-body"> <strong><?=$LANG['upload_replace']?>:</strong> <img src="<?=$config['app_url']?>themes/<?=$theme?>/img/ico_help.png" border="0" align="absmiddle" alt="Tooltip" onmouseover="return overlib('<?=$LANG['upload_tt_replace']?>',<?=$CONF['ovl_tt_settings']?>);" onmouseout="return nd();"> </td> <td class="dlg-body"><input type="checkbox" name="replace" value="y"></td> </tr> <tr> <td class="dlg-body"> </td> <td class="dlg-body"><input class="button" type="submit" name="Submit" value="<?=$LANG['btn_upload']?>"></td> </tr> </table> </form> <table style="border-top: 1px solid #BBBBBB; width: 100%;"> <tr> <td style="text-align: left; vertical-align: top;"> <?php if ($_REQUEST['target']=="avatar" || $_REQUEST['target']=="icon") { ?> <img src="<?=$CONF['app_icon_dir'].$UPL->the_new_file?>" alt=""> <?php } else { ?> <?php } ?> </td> <td> <?=$UPL->show_error_string()?><br /> <?php if (isset($info)) echo nl2br($info); ?> </td> </tr> </table> </td> </tr> <tr> <td class="dlg-menu"> <input name="btn_help" type="button" class="button" onclick="javascript:this.blur(); openPopup('help/<?=$CONF['options']['helplang']?>/html/index.html?upload_dialog.html','help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,titlebar=0,resizable=0,dependent=1,width=740,height=500');" value="<?=$LANG['btn_help']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';"> <input name="btn_close" type="button" class="button" onclick="javascript:window.close();" value="<?=$LANG['btn_close']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';"> </td> </tr> </table> <?php require("includes/footer.html.inc.php"); ?>
|