1 | <?php |
---|
2 | define('PHPWG_ROOT_PATH','../../../'); |
---|
3 | define('IN_ADMIN', true); |
---|
4 | |
---|
5 | $_COOKIE['pwg_id'] = $_POST['session_id']; |
---|
6 | |
---|
7 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
8 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
9 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); |
---|
10 | |
---|
11 | check_pwg_token(); |
---|
12 | |
---|
13 | ob_start(); |
---|
14 | echo '$_FILES'."\n"; |
---|
15 | print_r($_FILES); |
---|
16 | echo '$_POST'."\n"; |
---|
17 | print_r($_POST); |
---|
18 | echo '$user'."\n"; |
---|
19 | print_r($user); |
---|
20 | $tmp = ob_get_contents(); |
---|
21 | ob_end_clean(); |
---|
22 | // error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log"); |
---|
23 | |
---|
24 | if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK) |
---|
25 | { |
---|
26 | $error_message = file_upload_error_message($_FILES['Filedata']['error']); |
---|
27 | |
---|
28 | add_upload_error( |
---|
29 | $_POST['upload_id'], |
---|
30 | sprintf( |
---|
31 | l10n('Error on file "%s" : %s'), |
---|
32 | $_FILES['Filedata']['name'], |
---|
33 | $error_message |
---|
34 | ) |
---|
35 | ); |
---|
36 | |
---|
37 | echo "File Size Error"; |
---|
38 | exit(); |
---|
39 | } |
---|
40 | |
---|
41 | ob_start(); |
---|
42 | |
---|
43 | $image_id = add_uploaded_file( |
---|
44 | $_FILES['Filedata']['tmp_name'], |
---|
45 | $_FILES['Filedata']['name'], |
---|
46 | null, |
---|
47 | 8 |
---|
48 | ); |
---|
49 | |
---|
50 | if (!isset($_SESSION['uploads'])) |
---|
51 | { |
---|
52 | $_SESSION['uploads'] = array(); |
---|
53 | } |
---|
54 | |
---|
55 | if (!isset($_SESSION['uploads'][ $_POST['upload_id'] ])) |
---|
56 | { |
---|
57 | $_SESSION['uploads'][ $_POST['upload_id'] ] = array(); |
---|
58 | } |
---|
59 | |
---|
60 | array_push( |
---|
61 | $_SESSION['uploads'][ $_POST['upload_id'] ], |
---|
62 | $image_id |
---|
63 | ); |
---|
64 | |
---|
65 | $output = ob_get_contents(); |
---|
66 | ob_end_clean(); |
---|
67 | if (!empty($output)) |
---|
68 | { |
---|
69 | add_upload_error($_POST['upload_id'], $output); |
---|
70 | } |
---|
71 | |
---|
72 | echo "1"; |
---|
73 | ?> |
---|