function ConfDisp() { global $inputs; switch (VIEWSTYLE) { case 'Table': foreach ($inputs as $key => $value) { $_SESSION[$key] = zeromail_regtag_replace($_SESSION, $key); echo convert_encode('<tr><th scope="row">' . $value . '</th><td>'); echo $_SESSION[$key]; echo convert_encode('</td></tr>'); } break; case 'List': foreach ($inputs as $key => $value) { $_SESSION[$key] = zeromail_regtag_replace($_SESSION, $key); echo convert_encode('<dt>' . $value . '</dt><dd>'); echo $_SESSION[$key]; echo convert_encode('</dd>'); } break; default: foreach ($inputs as $key => $value) { $_SESSION[$key] = zeromail_regtag_replace($_SESSION, $key); echo convert_encode('<p><em class="label">' . $value . '</em><span class="value">'); echo $_SESSION[$key]; echo convert_encode('</span></p>'); } } }
function Button() { if ($_SESSION['Err'] > 1 || $_SESSION['Err'] === -1) { $str = "<noscript><p class=\"return\">ブラウザのボタンで戻ってください。</p></noscript>\n<script type=\"text/javascript\">\n//<![CDATA[\ndocument.write('<button id=\"myreset\" type=\"button\" onclick=\"history.back()\">入力画面に戻る</button>');\n//]]>\n</script>"; $str .= zm_copyright(false); session_unset(); } else { $str = '<input name="mode" type="hidden" id="mode" value="Send" /><button id="submit" type="submit">この内容で送信</button>'; $str .= "<script type=\"text/javascript\">\n//<![CDATA[\ndocument.write('<button id=\"myreset\" type=\"button\" onclick=\"history.back()\">入力画面に戻る</button>');\n//]]>\n</script>"; $str .= zm_copyright(false); } echo convert_encode($str); }
function checkUploadData($FILES) { $err = 0; foreach ($FILES as $name => $array) { $filename = $array["name"]; if (FILETEMP === false) { $_SESSION[$name] = convert_encode("<strong class=\"error\">ファイルのアップロードが許可されていません。</strong>"); $err = 1; } elseif ($array["error"] == 0) { $tmp_name = $array["tmp_name"]; $filesize = $array["size"]; $filetype = $array['type']; preg_match("/^.+?((?:\\.\\w{3})*\\.\\w{2,4})\$/i", $filename, $extension); //拡張子 if (!check_minetype($filetype, strtolower($extension[1]))) { $_SESSION[$name] = convert_encode('<strong class="error">' . $label . "[" . $filename . "] のファイル形式が不適切です。</strong>"); $err = 1; } if ($filesize >= MAXSIZE * 1000) { //ファイルサイズ $_SESSION[$name] = convert_encode('<strong class="error">' . $label . "[" . $filename . "] のファイルサイズ(" . $filesize / 1000 . "kb)が大きすぎます</strong>"); $err = 1; } if (!$err) { if (FILEPOOL === true || !preg_match("/^[\\w\\d_\\-\\.]+?\\.\\w{2,4}\$/i", $filename)) { //FILEPOOL=ON | 画像が日本語だったら $filename = substr(md5(microtime()), 0, rand(5, 8)) . $extension[1]; //適当に名前付ける } else { $filename = strtolower($filename); } $target = strpos(IMG_CHECK_TARGET, "_") === 0 ? ' target="' . IMG_CHECK_TARGET . '"' : ' rel="' . IMG_CHECK_TARGET . '"'; $_SESSION[$name] = convert_encode($filename . " (" . $filesize / 1000 . "kb)" . ' <a href="' . UPLOADPASS . $filename . '"' . $target . ' class="zmPreview">ファイルの確認</a>'); $_SESSION["FILES"][] = array('filename' => $filename, 'type' => $filetype); $_SESSION["FILETEMP"] = true; //tmpファイルを移動 move_uploaded_file($tmp_name, UPLOADPASS . $filename); } } elseif ($array["error"] != 4) { switch ($array["error"]) { case 1: $_SESSION[$name] = convert_encode("<strong class=\"error\">[" . $filename . "] のファイルサイズが大きすぎます</strong>"); $err = 1; break; case 2: $_SESSION[$name] = convert_encode("<strong class=\"error\">[" . $filename . "] のファイルサイズが大きすぎます</strong>"); $err = 1; break; case 6: $_SESSION[$name] = convert_encode("<strong class=\"error\">テンポラリフォルダがありません</strong>"); $err = 1; break; default: $_SESSION[$name] = convert_encode("<strong class=\"error\">[" . $filename . "] はアップロードできませんでした</strong>"); $err = 1; } } } if (isset($err)) { return $err; } }
function zeromail_create_table() { global $inputs; $row = 1; $table = ''; if (file_exists(ZM_LOGFILE)) { $filesize = filesize(ZM_LOGFILE); $data = zeromail_load_file(ZM_LOGFILE); $count = count($data); if ($filesize > 3000) { $table .= '<p class="caution message">ファイルサイズが300kbを超えています。(現在' . floor($filesize / 1000) . 'kb)<br />ダウンロードを行ってください。</p>'; } $table .= "<form method=\"post\" action=\"\" class=\"loglist zeromail\">\n"; $table .= "<div id=\"logbody\">\n<table>\n"; $headers = '<tr><th scope="col">#</th><td scope="col">送信日時</td><td scope="col">' . implode('</td><td scope="col">', array_values($inputs)) . "</td><td>IP</td><td>Host</td><td>User Agent</td></tr>"; $table .= "<thead>" . $headers . "</thead>\n"; if ($count > 5) { $table .= "<tfoot>" . $headers . "</tfoot>\n"; } $table .= "<tbody>\n"; if ($count > 0) { foreach ($data as $row => $line) { $table .= "<tr>\n"; $table .= '<th scope="row">' . ($row + 1) . "</th>\n"; $line = convert_encode($line); $cell = explode(",", str_replace('"', "", $line)); $num = count($cell); for ($c = 0; $c < $num; $c++) { $table .= '<td>'; if (FILETEMP === true && FILEPOOL === true && preg_match("/([\\w\\d]+.\\w{2,3})\\s*\\([\\d\\.]+kb\\)\\s*/", $cell[$c], $ma)) { $target = strpos(IMG_CHECK_TARGET, "_") === 0 ? ' target="' . IMG_CHECK_TARGET . '"' : ' rel="' . IMG_CHECK_TARGET . '"'; if (file_exists(ZEROMAIL_ADMDIR . UPLOADPASS . $ma[1])) { $table .= '<input type="checkbox" name="delTempFile[]" value="' . $ma[1] . '" />'; $table .= '<a href="../' . UPLOADPASS . $ma[1] . '"' . $target . '>' . $cell[$c] . '</a>'; } else { $table .= $cell[$c]; } } elseif (preg_match("/^(?:http|https|ftp):\\/\\//", $cell[$c])) { $table .= '<a href="' . $cell[$c] . '">' . $cell[$c] . '</a>'; } else { $table .= $cell[$c] == "" ? " " : $cell[$c]; } $table .= "</td>\n"; } $table .= "</tr>\n"; } } else { $table .= "<tr>\n"; $table .= '<td colspan="' . (count($inputs) + 5) . '" class="nodata">'; $table .= "データがありません</td>\n"; $table .= "</tr>\n"; } $table .= "</tbody>\n</table></div>\n"; if (isset($ma) || $count > 0) { $table .= "<p class=\"button\">\n"; if (isset($ma)) { $table .= "<button type=\"submit\" id=\"submit\" name=\"mode\" value=\"delete\">チェックしたファイルを削除</button>"; } if ($count > 0) { $table .= "<button type=\"submit\" id=\"submit\" name=\"mode\" value=\"deleteall\">ログを全て削除</button>"; } $table .= "</p>\n"; } $table .= "</form>"; } else { $_GET['message'] = 'nologfile'; } return $table; }
function output($str) { $error = @ob_get_contents(); @ob_end_clean(); header("Content-Type: text/plain"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); echo isset($GLOBALS['encode']) && $GLOBALS['encode'] != 'utf-8' ? convert_encode($GLOBALS['encode'], 'utf-8', $str) : $str; die; }