access_check(); } function access_check() { # バージョン差異による補正 if(phpversion() < "4.1.0") { $_POST = $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; $_COOKIE = $HTTP_COOKIE_VARS; $_SERVER = $HTTP_SERVER_VARS; define(LOCK_SH, 1); define(LOCK_EX, 2); define(LOCK_UN, 3); } # 禁止IPのチェック foreach($this->aryDenied_ip as $valDenied_ip) { if(@eregi($valDenied_ip, $_SERVER['REMOTE_ADDR'])) $this->error_print("あなたは禁止IPの対象になっています。"); } # 禁止ホストのチェック foreach($this->aryDenied_host as $valDenied_host) { if(@eregi($valDenied_host, gethostbyaddr($_SERVER['REMOTE_ADDR']))) $this->error_print("あなたは禁止ホストの対象になっています。"); } # プロキシのチェック if($this->deny_stranger) { $pstatus = 0; $aryProxy_value = Array( $_SERVER['HTTP_CACHE_INFO'], $_SERVER['HTTP_EXTENSION'], $_SERVER['HTTP_MAX_FORWARDED'], $_SERVER['HTTP_PROXY_CONNECTION'], $_SERVER['HTTP_REMOTE_HOST_WP'], $_SERVER['HTTP_SP_HOST'], $_SERVER['HTTP_TE'], $_SERVER['HTTP_XROXY_CONNECTION'], $_SERVER['HTTP_X_CISCO_BBSM_CLIENTIP'], $_SERVER['HTTP_X_HTX_AGENT'], $_SERVER['HTTP_X_LOCKING'], $_SERVER['HTTP_XONNECTION'], $_SERVER['HTTP_XXXXXXXXXXXXXXX'], $_SERVER['HTTP_CACHE_CONTROL'], $_SERVER['HTTP_CLIENT_IP'], $_SERVER['HTTP_FORWARDED'], $_SERVER['HTTP_VIA'], $_SERVER['HTTP_X_FORWARDED_FOR'], ); foreach($aryProxy_value as $valProxy_value) { if($valProxy_value != "") { $pstatus = 1; break; } } switch($pstatus) { case '0': //プロキシの可能性なし break; case '1': //匿名プロキシの判断 foreach($aryProxy_value as $valProxy_value) { if( preg_match("/\D*(\d+)\.(\d+)\.(\d+)\.(\d+)\D*/i", $valProxy_value, $matches) ) { # マッチした IP を調べる $proxyip = "$matches[1].$matches[2].$matches[3].$matches[4]"; if($proxyip == "127.0.0.1" || $proxyip == "0.0.0.0" || $proxyip == "255.255.255.255") break; if($proxyip == $_SERVER['REMOTE_ADDR']) break; if( preg_match("/proxy|cache|via|delegate|www|mail/i", $proxyhost) ) break; } } $pstatus = 0; break; } if($pstatus>=1) $this->error_print("匿名プロキシからアクセスしていませんか?"); } } /* * ---------------------------------------------------------------------------- * スキンファイル - データ表示部を読み込むサブルーチン * ---------------------------------------------------------------------------- * 関数名 :read_skin * 引数説明 :全て参照する * 戻り値説明 :void * 処理内容 :スキンファイル - データ表示部 を引数に読み込む * クッキーに関するスキンを変換し、変数 $form と $footer に代入 * ---------------------------------------------------------------------------- */ function read_skin($sfile, &$header, &$form, &$thread, &$resthread, &$thread_end, &$footer) { $fd = @fopen($sfile, "r") or $this->error_print("スキンファイルが存在しないか、開けません({$sfile})"); flock($fd, LOCK_SH); $skin = fread($fd, filesize($sfile)); flock($fd, LOCK_UN); fclose($fd); list( $header, $form, $thread, $resthread, $thread_end, $footer, ) = explode("", $skin); # クッキー挿入 $form = str_replace("", $_COOKIE['name'], $form); $form = str_replace("", $_COOKIE['mail'], $form); $form = str_replace("", $_COOKIE['web'], $form); $form = str_replace("", $_COOKIE['key'], $form); $footer = str_replace("", $_COOKIE['key'], $footer); } /* * ---------------------------------------------------------------------------- * ログファイルに送信、返信データを書き込むサブルーチン * ---------------------------------------------------------------------------- * 関数名 :write_data * 引数説明 :void * 戻り値説明 :void * 処理内容 :クッキー情報を記録する * 以前の記事番号を読み込む * 送信、返信されたデータを書き込みフォーマットに変換(str2wformat) * データを書き込んでよいか吟味(posted_strCheck) * 送信、返信されたデータを配列化する * メール送信オプションを起動する * データを数値化する * 新規投稿か返信かを判断する * 書き込みフォーマットを作成後、データを書き込み * ロケーションヘッダにより、自分自身にリダイレクト * ---------------------------------------------------------------------------- */ function write_data() { # クッキー情報の記録 if($this->allow_setcookie) { setcookie("name", $_POST['name'], time()+$this->cookie_time_lag); setcookie("mail", $_POST['mail'], time()+$this->cookie_time_lag); setcookie("web", $_POST['web'], time()+$this->cookie_time_lag); setcookie("key", $_POST['key'], time()+$this->cookie_time_lag); } # no 読み込み $fd = @fopen($this->logf, "r") or $this->error_print("ログファイルが存在しないか、開けません({$this->logf})"); flock($fd, LOCK_SH); $pdata = fgets($fd); flock($fd, LOCK_UN); fclose($fd); list($preno,) = explode(",", $pdata); $no = $preno + 1; $time = time(); $uip = $_SERVER['REMOTE_ADDR']; $browser = $_SERVER['HTTP_USER_AGENT']; $this->str2wformat($_POST['subject'], $browser, $_POST['name'], $_POST['mail'], $_POST['web'], $_POST['msg'], $_POST['key']); # 文字列チェック $this->posted_strCheck($_POST['subject'], $_POST['name'], $_POST['mail'], $_POST['web'], $_POST['msg'], $_POST['key']); # ファイルのアップロード if(!empty($_FILES['userfile']['name']) && $this->allow_file_upload) { $upfile = $this->option_file_upload(); } $aryData = Array( $no, $_POST['rid'], $time, $_POST['subject'], $uip, $browser, $_POST['name'], $_POST['mail'], $_POST['web'], $_POST['msg'], $_POST['key'], $upfile, ); # メール送信 if(!empty($this->admin_mail_address)) $this->option_send_mail($aryData); # 書き込みフォーマットを作成 $aryLines = file($this->logf); array_shift($aryLines); $aryDataFormat = implode(",", $aryData)."\n"; if(empty($_POST['rid'])) { # 新規投稿 # 総ログ数のチェック $this->devide_log($aryLines, $assLines); if(sizeof($assLines[''])+1 >= $this->max_log) { list($check_no,) = explode(",", @end($assLines[''])); for($c=0; $callow_past_created){ if($this->move2past($deleted_log) == -1){ # 生成異常 $this->error_print("過去ログが生成できませんでした。"); } } }// end of if log is over on file $written_format = $aryDataFormat.$aryDataFormat.implode("", $aryLines); }else { # 返信 if($this->up_thread) { # スレッドを一番上にあげる for($i=0; $ilogf, "w") or $this->error_print("ログファイルが存在しないか、開けません({$this->logf})"); flock($fd, LOCK_EX); fwrite($fd, $written_format); flock($fd, LOCK_UN); fclose($fd); # ロケーションヘッダ if($this->allow_header_location) header("Location: ".$this->me_url); } /* * ---------------------------------------------------------------------------- * 過去ログ生成を行うサブルーチン * ---------------------------------------------------------------------------- * 関数名 :move2past * 引数説明 :void * 戻り値説明 :void * 処理内容 :ログファイルから消去されたログを別のログファイルとして復帰 * 最も新しい過去ログファイルを参照して、それに書き込みを行う * ---------------------------------------------------------------------------- */ function move2past($deleted_log){ $objdir = dir($this->pastdir); $new_pastf = $this->pastdir.$this->ref_pastno().".dat"; # 書き込み $fd = @fopen($new_pastf, "a+") or $this->error_print("過去ログファイルが存在しないか、開けません({$new_pastf})"); flock($fd, LOCK_EX); //ファイルサイズがZEROならば、先頭行にUNIX時を追加 if( filesize($new_pastf)== 0 ) fwrite($fd, time()."\n"); $ret = fwrite($fd, $deleted_log); flock($fd, LOCK_UN); fclose($fd); # 過去ログNo.の更新 $aryLines = file($new_pastf); $this->devide_log($aryLines, $assLines); if( sizeof($assLines[''])+1 >= $this->max_pastlog) if( $this->update_pastno() == -1) $this->error_print("過去ログNo.が更新できませんでした。"); return $ret; } /* * ---------------------------------------------------------------------------- * 過去ログNo.を参照するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :ref_pastno * 引数説明 :void * 戻り値説明 :void * 処理内容 :過去ログNo.ファイルを読み込む * ---------------------------------------------------------------------------- */ function ref_pastno(){ $fd = @fopen($this->pastnof, "r") or $this->error_print("過去ログNo.ファイルが存在しないか、開けません({$this->pastnof})"); flock($fd, LOCK_SH); $pastno = fgets($fd); flock($fd, LOCK_UN); fclose($fd); return $pastno; } /* * ---------------------------------------------------------------------------- * 過去ログNo.を更新するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :update_pastno * 引数説明 :void * 戻り値説明 :void * 処理内容 :現在の過去ログNo.を読み込み、そこに1を加え、書き込みする * ---------------------------------------------------------------------------- */ function update_pastno(){ $fd = @fopen($this->pastnof, "r+") or $this->error_print("過去ログNo.ファイルが存在しないか開けません($this->pastnof)"); flock($fd, LOCK_EX); $new_pastno = fgets($fd) +1; rewind($fd); ftruncate($fd, 0); fwrite($fd, $new_pastno); flock($fd, LOCK_UN); fclose($fd); } /* * ---------------------------------------------------------------------------- * 投稿された文字を走査するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :posted_strCheck * 引数説明 :全て参照する * 戻り値説明 :void * 処理内容 :必須項目かどうかを確認し、デフォルトの文字を代入する * 二重投稿かどうかをチェックする * リンク元をチェックする * ---------------------------------------------------------------------------- */ function posted_strCheck(&$subject, &$name, &$mail, &$web, &$msg, &$key) { # 必須項目: タイトル、名前、メール、ウェブ、キー $aryComparable = Array( $subject, $name, $mail, $web, $key ); for($i=0; $iaryIndispensable[$i]) { $this->error_print("必須項目がありません。"); }else { switch($i) { case '0': $subject = $this->aryStrIndispensable[$i]; break; case '1': $name = $this->aryStrIndispensable[$i]; break; case '2': $mail = $this->aryStrIndispensable[$i]; break; case '3': $web = $this->aryStrIndispensable[$i]; break; case '4': $key = $this->aryStrIndispensable[$i]; break; } } } } if(empty($msg) || eregi("^( | |\n)*$", $msg)) { $this->error_print("メッセージは必ず入力してください。"); } # 二重投稿チェック $fd = @fopen($this->logf, "r") or $this->error_print("ログファイルが存在しないか、開けません({$this->logf})"); flock($fd, LOCK_SH); $pdata = fgets($fd); flock($fd, LOCK_UN); fclose($fd); list(,,,,,,,,,$premsg,$upfile) = explode(",", $pdata); $premsg = rtrim($premsg); if($msg==$premsg) $this->error_print("二重投稿は禁止です。"); # リンク元チェック if($this->deny_outsider && !eregi($this->me_url, $_SERVER['HTTP_REFERER'])) $this->error_print("外部からの投稿は禁止です。"); } /* * ---------------------------------------------------------------------------- * 投稿された文字を書き込み文字に初期化するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :str2wformat * 引数説明 :全て参照する * 戻り値説明 :void * 処理内容 :タグを取り除く * 区切り文字を置き換えする * ダブルコーテーションをエスケープ * 改行文字を処理する * キーをMD5暗号化 * ---------------------------------------------------------------------------- */ function str2wformat(&$subject, &$browser, &$name, &$mail, &$web, &$msg, &$key) { $this->remove_tag($subject); $this->remove_tag($browser); $this->remove_tag($name); $this->remove_tag($mail); $this->remove_tag($web); $this->remove_tag($msg); $this->remove_tag($key); $subject = str_replace(",", ",", $subject); $browser = str_replace(",", ",", $browser); $name = str_replace(",", ",", $name); $mail = str_replace(",", ",", $mail); $web = str_replace(",", ",", $web); $msg = str_replace(",", ",", $msg); $key = str_replace(",", ",", $key); if(get_magic_quotes_gpc()) { $subject = stripslashes($subject); $browser = stripslashes($browser); $name = stripslashes($name); $mail = stripslashes($mail); $web = stripslashes($web); $msg = stripslashes($msg); $key = stripslashes($key); } $msg = str_replace("\r\n", "\n", $msg); $msg = str_replace("\r", "\n", $msg); $msg = str_replace("\n", "
", $msg); $key = $this->keycode($key); } /* * ---------------------------------------------------------------------------- * タグを除去するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :remove_tag * 引数説明 :参照する * 戻り値説明 :void * 処理内容 :タグを取り除く設定かどうかを判断した上で、タグを取り除く * ---------------------------------------------------------------------------- */ function remove_tag(&$string) { $string = ($this->allow_tags) ? strip_tags($string, $this->allowable_tags) : htmlspecialchars($string); } /* * ---------------------------------------------------------------------------- * キーをMD5暗号化するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :keycode * 引数説明 :void * 戻り値説明 :暗号化されたキー * 処理内容 :MD5暗号化して、1文字目から8文字目を切り出す * ---------------------------------------------------------------------------- */ function keycode($key) { return substr(md5($key), 1, 8); } /* * ---------------------------------------------------------------------------- * データを読み込むサブルーチン * ---------------------------------------------------------------------------- * 関数名 :read_data * 引数説明 :$thread_data と $fsize は参照渡し * 戻り値説明 :void * 処理内容 :$thread, $resthread $thread_end を使って、$thread_data * を作成する。またこのサブリーチンは 返信画面も作成する。 * 返信画面は多少処理が異なるので $flagMode によって判断する。 * 通常の場合は、まずログの先頭から親記事を読み込み、 * その親記事に返信があった場合はその返信ログを全て読み込む。 * さらに次の親記事を読み込む。(その数は $_GET['order'])で定まる。 * 返信画面表示の場合は $_POST['parent_no'] によって親記事を探し、 * その返信ログを全て読み込み終了する。 * $fsize は現在のログ数を参照するもので、後ほどの処理で使われる。 * ---------------------------------------------------------------------------- * $flgMode について * 新規投稿の場合は 0 を指定する * 返信の場合は 1 を指定する */ function read_data($thread, $resthread, &$thread_data, $thread_end, &$fsize, $flagMode) { # 既存ログ or 過去ログファイルとの分岐 if($_GET['command'] == 'pastdata') { $this->logf = $this->pastdir.$_GET['pastno'].".dat"; $this->viewed_thread_num = 4096; } $flgResMode_finished = false; $fd = @fopen($this->logf, "r") or $this->error_print("ログファイルが存在しないか、開けません({$this->logf})"); flock($fd, LOCK_SH); $aryLines = file($this->logf); flock($fd, LOCK_UN); fclose($fd); $this->devide_log($aryLines, $assLines); $fsize = sizeof($assLines['']); $viewed_count = (sizeof($assLines['']) > $this->viewed_thread_num) ? $this->viewed_thread_num : sizeof($assLines['']); # 返信・過去ログモード / 全て読み込む if($flagMode) $viewed_count = sizeof($assLines['']); # ログを進める for($k=0; $k<$_GET['order']; $k++) { @next($assLines['']); } for($i=0; $i<$viewed_count; $i++) { list(, $valLines) = @each($assLines['']); if(empty($valLines)) break; list( $no, $rid, $time, $subject, $uip, $browser, $name, $mail, $web, $msg, $key, $upfile, ) = explode(",", $valLines); # 返信モード if($flagMode==1) { if($no!=$_GET['parent_no']) { continue; }else { $flgResMode_finished = true; } } $this->str2rformat($time, $subject, $uip, $browser, $name, $mail, $web , $msg); $reqThread = $thread; $reqThread = str_replace("", $no, $reqThread); $reqThread = str_replace("", $rid, $reqThread); $reqThread = str_replace("", $time, $reqThread); $reqThread = str_replace("", $subject, $reqThread); $reqThread = str_replace("", $uip, $reqThread); $reqThread = str_replace("", $browser, $reqThread); $reqThread = str_replace("", $name, $reqThread); $reqThread = str_replace("", $mail, $reqThread); $reqThread = str_replace("", $web, $reqThread); $reqThread = str_replace("", $msg, $reqThread); # 添付ファイルの表示 $upfile = rtrim($upfile); if(!empty($upfile)) $this->option_image_create($reqThread,$upfile); $thread_data .= $reqThread; # 返信ログオペレーション if($assLines[$no]) { $res_count=0;$read_res_count=0; foreach($assLines[$no] as $valLines) { $res_count++; # データ表示画面ならレスの枝刈りを行う if(!$flagMode) { if($read_res_count < sizeof($assLines[$no]) - $this->viewed_res_num) { $read_res_count++; continue; } } list( $no, $rid, $time, $subject, $uip, $browser, $name, $mail, $web, $msg, $key, $upfile, ) = explode(",", $valLines); $this->str2rformat($time, $subject, $uip, $browser, $name, $mail, $web , $msg); $reqThread = $resthread; $reqThread = str_replace("", $no, $reqThread); $reqThread = str_replace("", $rid, $reqThread); $reqThread = str_replace("", $res_count, $reqThread); $reqThread = str_replace("", $time, $reqThread); $reqThread = str_replace("", $subject, $reqThread); $reqThread = str_replace("", $uip, $reqThread); $reqThread = str_replace("", $browser, $reqThread); $reqThread = str_replace("", $name, $reqThread); $reqThread = str_replace("", $mail, $reqThread); $reqThread = str_replace("", $web, $reqThread); $reqThread = str_replace("", $msg, $reqThread); # 添付ファイルの表示 $upfile = rtrim($upfile); if(!empty($upfile)) $this->option_image_create($reqThread,$upfile); $thread_data .= $reqThread; } } $thread_data .= $thread_end; if($flgResMode_finished) break; //レスモードの場合、他のログを走査せずスピードアップ }//親記事for文Loop点 } /* * ---------------------------------------------------------------------------- * データを削除するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :delete_data * 引数説明 :void * 戻り値説明 :void * 処理内容 :$_POST['target_no'](配列)、 $_POST['target_key'] によって、 * 定められる。 * 処理後はロケーションヘッダによって自分自身にリダイレクトする。 * ---------------------------------------------------------------------------- */ function delete_data() { # キーが入力されていない場合、強制終了 if(empty($_POST['target_key'])) $this->error_print("削除するには投稿時の削除キーを入力して下さい。"); $_POST['target_key'] = $this->keycode($_POST['target_key']); if(empty($_POST['target_no'])) $_POST['target_no'] = Array(); $aryLines = file($this->logf); for($i=1; $idelete_upfile){ $upfile = rtrim($upfile); @unlink($this->updir.$upfile); @unlink($this->thumbdir.$upfile); } } } } $fd = @fopen($this->logf, "w") or $this->error_print("ログファイルが存在しないか、開けません({$this->logf})"); flock($fd, LOCK_EX); fwrite($fd, implode("", $aryLines)); flock($fd, LOCK_UN); fclose($fd); # ロケーションヘッダ if($this->allow_header_location) header("Location: ".$this->me_url); } /* * ---------------------------------------------------------------------------- * ログ配列のインデックスを変更するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :devide_log * 引数説明 :$assLines(連想配列)は参照渡し * 戻り値説明 :void * 処理内容 :ログのインデックスを 記事No と 返信No に変える。 * 値をログとし、二次元配列とする。 * ---------------------------------------------------------------------------- */ function devide_log($aryLines, &$assLines) { for($i=1; $idate_format, $time); $mail = ( !empty($mail) ) ? "$this->icon_mail_y" : "$this->icon_mail_n"; $web = ( !empty($web) ) ? "$this->icon_web_y" : "$this->icon_web_n"; if($this->allow_auto_link) $msg = eregi_replace("(https?|ftp|news)"."(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)", "\\1\\2", $msg); } /* * メイン関数: print_data(); * 通常の表示用 */ function print_data() { if($_POST['submit']) $this->write_data(); if($_POST['sbm_del']) $this->delete_data(); $this->read_skin($this->s_sbdata, $header, $form, $thread, $resthread, $thread_end, $footer); $this->read_data($thread, $resthread, $thread_data, $thread_end, $fsize, 0); $this->set_navigation($fsize, $header); $this->set_navigation($fsize, $form); $this->set_navigation($fsize, $footer); echo $header,$form; echo $thread_data; echo $footer; } /* * メイン関数: print_resdata(); * レス画面の表示用 */ function print_resdata() { $this->read_skin($this->s_sbres, $header, $form, $thread, $resthread, $thread_end, $footer); $this->read_data($thread, $resthread, $thread_data, $thread_end, $fsize, 1); $form = str_replace("", $_GET['parent_no'], $form); echo $header; echo $form; echo $thread_data; echo $footer; } /* * メイン関数: print_pastdata(); * 過去ログ表示用 */ function print_pastdata() { $this->read_skin($this->s_sbpast, $header, $form, $thread, $resthread, $thread_end, $footer); $this->read_data($thread, $resthread, $thread_data, $thread_end, $fsize, 2); $header = str_replace("", $this->pastnumber(), $header); $footer = str_replace("", $this->pastnumber(), $footer); echo $header; echo $thread_data; echo $footer; } /* * ---------------------------------------------------------------------------- * 読み込みフォーマットを作成するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :set_navigation * 引数説明 :$footerが参照渡し * 戻り値説明 :void * 処理内容 :次頁と前頁の移動リンクを作成し、スキンを変換する。 * ---------------------------------------------------------------------------- */ function set_navigation($fsize, &$footer) { $increase = $_GET['order'] + $this->viewed_thread_num; $decrease = $_GET['order'] - $this->viewed_thread_num; $footer = ($fsize-$_GET['order'] > $this->viewed_thread_num) ? str_replace("", "$this->icon_next_y", $footer) : str_replace("", $this->icon_next_n, $footer); $footer = ($_GET['order'] >= $this->viewed_thread_num) ? str_replace("", "$this->icon_prev_y", $footer) : str_replace("", $this->icon_prev_n, $footer); $footer = str_replace("", $this->backnumber($fsize), $footer); } /* * ---------------------------------------------------------------------------- * バックナンバーを返すサブルーチン * ---------------------------------------------------------------------------- * 関数名 :backnumber * 引数説明 :$fsize * 戻り値説明 :バックナンバーリスト * 処理内容 : * ---------------------------------------------------------------------------- */ function backnumber($fsize) { $numbers = $fsize / $this->viewed_thread_num; for($i=0; $i<$numbers; $i++) { if($_GET['order'] == $i*$this->viewed_thread_num){ $backnumber .= sprintf("[ %d ] ", $i+1); }else{ $backnumber .= sprintf("[ %d ] ", $i*$this->viewed_thread_num, $i+1); } } return $backnumber; } /* * ---------------------------------------------------------------------------- * 過去ログNo.リストを返すサブルーチン * ---------------------------------------------------------------------------- * 関数名 :pastnumber * 引数説明 :void * 戻り値説明 :過去ログNo.リスト * 処理内容 : * ---------------------------------------------------------------------------- */ function pastnumber(){ $pastno = $this->ref_pastno(); for($i=0; $i<$pastno; $i++) { $pastnumber .= sprintf("[ %d ] ", $i+1, $i+1); } return $pastnumber; } /* * ---------------------------------------------------------------------------- * ファイルのアップロードをするサブルーチン * ---------------------------------------------------------------------------- * 関数名 :option_file_upload * 引数説明 :void * 戻り値説明 :void * 処理内容 :ファイルをアップロードする * ---------------------------------------------------------------------------- */ function option_file_upload() { if( $pos = strrchr ($_FILES['userfile']['name'], ".") ){ $extention = substr ($pos, 1); } else { $this->error_print("ファイルに拡張子が見つかりません。({$_FILES['userfile']['name']})"); } foreach($this->aryMIME as $mime) { if( $mime == $_FILES['userfile']['type'] ) { $mflag = true; break; } } if(!$mflag) $this->error_print("アップロードが許可されていないMIMEタイプです。({$_FILES['userfile']['type']})"); if( $_FILES['userfile']['size'] > $this->upload_max_size*1000 ){ $this->error_print("アップロードのファイルサイズが大きすぎます。({$_FILES['userfile']['size']}byte)"); } $filename = time() . "." . urlencode($extention); $uploadfile = $this->updir.$filename; if( !file_exists($uploadfile) ){ if ( !move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile) ) { $this->error_print("ファイルアップロードに失敗しました。"); } } else { $this->error_print("存在するファイルのアップロードが行われようとしました。"); } return $filename; } /* * ---------------------------------------------------------------------------- * サムネイルファイルを生成する * ---------------------------------------------------------------------------- * 関数名 :option_image_create * 引数説明 :void * 戻り値説明 :void * 処理内容 :ファイルをアップロードする * ---------------------------------------------------------------------------- */ function option_image_create(&$reqThread,$upfile) { $upfilepass = $this->updir.$upfile; $thumbfilepass = $this->thumbdir.$upfile; $aryImgInfo = @getimagesize($upfilepass); # 画像ではないとき if(!$aryImgInfo || !$this->view_image) { $reqThread = str_replace("", "$upfile", $reqThread); } list($width,$height,$type,) = $aryImgInfo; # 画像幅超過 if($width > $this->image_width) { $ox = $this->image_width; $oy = $height * ($this->image_width/$width); # 縮小表示 if($this->use_thumbnail) { if(!file_exists($thumbfilepass)){ # サムネイル生成 switch($type) { case 1 : $im_in = @ImageCreateFromGif($upfilepass); break; case 2 : $im_in = @ImageCreateFromJPEG($upfilepass); break; case 3 : $im_in = @ImageCreateFromPNG($upfilepass); break; }// end of switch if($im_in) { $ox = $this->image_width; $oy = $height * ($this->image_width/$width); $im_out = @ImageCreateTrueColor($ox, $oy); // new if (!$im_out) $im_out = ImageCreate($ox, $oy); $rt = @ImageCopyResampled($im_out, $im_in, 0, 0, 0, 0, $ox, $oy, $width, $height); // new if (!$rt) ImageCopyResized($im_out, $im_in, 0, 0, 0, 0, $ox, $oy, $width, $height); // 画像生成 ImageJPEG($im_out, $thumbfilepass); //ImagePNG($im_out, $thumbfilepass); //ImageGIF($im_out, $thumbfilepass); //ImageBMP($im_out, $thumbfilepass); // メモリーの解放 ImageDestroy($im_in); ImageDestroy($im_out); } else { $this->error_print("サムネイルの作成に失敗しました。サーバーにGDがインストールされているか確認してください。"); }// end of exists $im_in } else { $reqThread = str_replace("", "\"クリックすると画像を拡大します\"", $reqThread); }// end of exists thumnail file } else { $reqThread = str_replace("", "", $reqThread); }// end of use thumnail } else { $reqThread = str_replace("", "", $reqThread); }// end of over } /* * ---------------------------------------------------------------------------- * メールを送信するサブルーチン * ---------------------------------------------------------------------------- * 関数名 :option_send_mail * 引数説明 :$aryData は 投稿するデータ * 戻り値説明 :void * 処理内容 :メールを送信する。 * その際にメッセージは
を改行文字に変換する。 * ---------------------------------------------------------------------------- */ function option_send_mail($aryData) { require_once($this->lib_jcode); $subject = $this->mail_subject; $subject = "=?iso-2022-jp?B?".base64_encode(jcodeconvert($subject, 0, 3))."?="; $body = "_/_/_/_/_/_/_/_/_/_/メール配信システム_/_/_/_/_/_/_/_/_/_/\n"; $body .= "掲示板に以下の内容で投稿がされました。ご確認ください。 \n"; $body .= "\n"; foreach($aryData as $keyData => $valData) { switch($keyData) { case 0: $keyData = "No."; break; case 1: $keyData = "レスNo."; break; case 2: $keyData = "時間"; $valData = date($this->date_format, $valData); break; case 3: $keyData = "タイトル"; break; case 4: $keyData = "IP アドレス"; break; case 5: $keyData = "ブラウザ"; break; case 6: $keyData = "ニックネーム"; break; case 7: $keyData = "メールアドレス"; break; case 8: $keyData = "ウェブ"; break; case 9: $keyData = "メッセージ"; $valData = str_replace("
", "\n", $valData); break; case 10: $keyData = "キー"; break; default: $keyData = "undefined"; break; } $body .= "[ $keyData ]\n$valData\n\n"; } $body .= "__________________________________________________________\n"; $body .= "\n"; $body .= "< Present BY SIMPLET BOARD >\n"; $body .= "\n"; $body = jcodeconvert($body, 0, 3); $header = "Reply-To: ".$this->admin_mail_address."\nX-Mailer: PHP/".phpversion(); mail($this->admin_mail_address, $subject, $body, $header); } function error_print($errmsg) { print <<

Error!

エラーが発生しました。
「 $errmsg 」

もしこの問題が改善されない場合は、管理人までご連絡ください。
ブラウザの「戻る」ボタンを押すか、こちらからお戻りください。

EOD; exit; } }//_____end of class $objBoard = new simplet_board; switch($_GET['command']) { case 'response': $objBoard->print_resdata(); break; case 'pastdata': $objBoard->print_pastdata(); break; default: $objBoard->print_data(); } ?>