3 require_once('define.php');
5 function multiply_unit($str) {
6 $str = preg_replace('/(\d+)G/ei', "$1*1024*1024*1024", $str);
7 $str = preg_replace('/(\d+)M/ei', "$1*1024*1024", $str);
8 $str = preg_replace('/(\d+)K/ei', "$1*1024", $str);
9 $str = preg_replace('/(\d+)B/ei', "$1", $str);
12 $upload_max_filesize = ini_get('upload_max_filesize');
13 $upload_max_filesize_bytes = multiply_unit($upload_max_filesize);
16 if (! empty($_FILES['swffile']['tmp_name'])) {
17 $filename = $_FILES['swffile']['tmp_name'];
18 $swfdata = file_get_contents($filename);
19 $upload_max_filesize = ini_get('upload_max_filesize');
20 if (strlen($swfdata) > $upload_max_filesize_bytes) {
21 echo "$upload_max_filesize Bytes 以内のファイルしか受け付けません。\n";
24 $tmp_name = sha1($swfdata, false);
25 $id = substr($tmp_name, 0, 16); // XXX
26 $tmp_filename = "$tmp_prefix$id.swf";
27 if ((! is_readable($tmp_filename)) &&
28 (! file_put_contents($tmp_filename, $swfdata))) {
29 fprintf(stderr, "index.php: file_put_contents failed. zero size?\n");
30 unlink($tmp_filename);
33 header("Location: ./index.php?id=$id");
40 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
42 <body bgcolor="#f0fff0">
43 <form enctype="multipart/form-data" action="" method="POST">
44 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $upload_max_filesize_bytes ?>" />
45 SWF ファイルをアップロード: <input name="swffile" type="file" />
46 <input type="submit" value="ファイルを送信" />
51 if (empty($_REQUEST['id'])) {
52 echo "ファイルを指定してください。($upload_max_filesize Bytes 以内に限定してます)";
55 $id = $_REQUEST['id'];
56 $tmp_filename = "$tmp_prefix$id.swf";
57 $swfdata = file_get_contents($tmp_filename);
59 echo "<a href=\"./swfimagelist.php?id=$id&noshape=y\" target=\"_blank\"> ビットマップ画像一覧 </a> - ";
60 echo "<a href=\"./swfimagelist.php?id=$id\" target=\"_blank\"> ベクター画像含む(重たいので注意) </a> <br />\n";
62 $swf = new SWFEditor();
63 $swf->input($swfdata);
65 $header_info = $swf->getHeaderInfo();
67 if ($header_info['compress']) {
73 echo "<table border=1>\n";
74 echo "<tr> <th> compress </th> </tr>\n";
75 echo "<tr> <td> $compress </td> </tr>\n";
78 echo "<table border=1>\n";
79 echo "<th> tag </th> <th> length </th> <th> detail </th>\n";
80 foreach ($swf->getTagList() as $tag_seqno => $tagblock) {
81 $tag= $tagblock['tag'];
82 if (empty($tagblock['tagName'])) {
85 $name = $tagblock['tagName'];
87 $length = $tagblock['length'];
88 $detail = @$tagblock['detail'];
90 echo "<td> $name($tag) </td> ";
91 echo "<td> $length </td>\n";
93 $detail_info = $swf->getTagDetail($tag_seqno);
95 if (is_array($detail_info)) {
96 foreach ($detail_info as $key => $value) {
97 if (is_array($value)) {
98 $value = implode(',', $value);
100 $detail_str .= "$key($value) ";
103 $detail_str .= var_export($detail_info, true);
106 if (@$header_info['version'] < 6) { // for flash lite
107 $detail_str = mb_convert_encoding($detail_str, "UTF-8", "SJIS-win");
109 $detail_str = htmlspecialchars($detail_str);
111 case 6: // 'DefineBitsJPEG'
112 case 21: // 'DefineBitsJPEG2'
113 case 35: // 'DefineBitsJPEG3'
114 case 20: // 'DefineBitsLossless'
115 case 36: // 'DefineBitsLossless2'
116 $image_id = $detail_info['image_id'];
117 $detail_str .= " <a href=\"swfimagereplace.php?id=$id&image_id=$image_id\"> replace </a>";
120 echo "<td> $detail_str </td>";