U+0020)。
* S 「半角」スペースを「全角」に変換します(U+0020 -> U+3000)。
* k 「全角カタカナ」を「半角カタカナ」に変換します。
* K 「半角カタカナ」を「全角カタカナ」に変換します。
* h 「全角ひらがな」を「半角カタカナ」に変換します。
* H 「半角カタカナ」を「全角ひらがな」に変換します。
* c 「全角カタカナ」を「全角ひらがな」に変換します。
* C 「全角ひらがな」を「全角カタカナ」に変換します。
* V 濁点付きの文字を一文字に変換します。"K", "H" と共に使用します。
*/
define( "_use_auto_conv" , "asKV" );
/******************************************************************
*
* データ保存先設定
*
*******************************************************************/
/**
* データ保存の設定
* データ保存をするときは true 使用しないときは false
*/
define( "_use_data_save" , true );
/**
* 保存時の文字コード
*/
define( "_save_charset" , "sjis-win" );
/**
* 保存方法
* TSV タブ区切り保存です、データ中のタブ記号(0x09)はスペース(0x20)へ変換されます
* CSV カンマ区切り保存です。EXCELでの利用を考慮して、すべてのカラムを「"」で括って出力します
*/
define( "_save_type" , "CSV" );
/**
* 保存データへ通し番号をふる
* 保存されるファイルの先頭に通し番号をふることが出来ます。
* consecutive 通し番号
* file ファイル単位での通し番号
* both 両方記録する
* false 記録しない場合 (false以外の場合は設定値を引用符で括って下さい、"consecutive" / "file" / "both" / false )
*/
define( "_save_consecutive_number" , false );
/**
* タイムスタンプの記録
* 保存されたファイルの末尾にタイムスタンプを記録することが出来ます
* 記録する場合は書式にdate関数のフォーマットが使用できます。引用符で括って記述してください。
* 記録しない場合はfalse (falseの場合は引用符は不要です)
*/
define( "_save_timestamp" , "Y/m/d H:i:s" );
/**
* ホストの記録
* 保存されたファイルの末尾にIPアドレスあるいはホスト名を記録することが出来ます
* ip IPアドレスを記録します
* host host名がわかる場合はホスト名わからない場合はIPアドレス
* false 記録しない場合(false以外の場合は設定値を引用符で括って下さい、"ip" / "host" / false )
*/
define( "_save_host" , "host" );
//保存設定系雑多な定数設定を外部関数で呼ぶ
//次の行は変更する必要はありません。
ext_define_seve_setting();
/**
* 改行タイプ
* _nl_win CR+LF
* _nl_mac CR
* _nl_unix LF
*/
define( "_nl" , _nl_win );
/**
* 日付単位の保存時の日付フォーマット
* (日付単位の通し番号にも使用します)
*/
define( "_save_date_format" , "Ymd" );
/**
* 保存形式
* _save_single 単一ファイルに保存します
* _save_by_date(type) 日付単位に保存します
* typeはdate関数のフォーマットが使用できます。引用符で括って記述してください。
* 例:1年単位 = Y / 1ヶ月単位 = Ym / 1日単位 = Ymd
*/
define( "_save_file" , _save_by_date( _save_date_format ) ); //実際の保存形式を上記から選択
$GLOBALS['_save_file_name'] = basename( _save_file );
/**
* 通し番号ファイルの保存先
* (変更不要です)
*/
define( "_save_counter_file" , _save_counter_by_date( _save_date_format ) ); //fileの時のカウンタファイル名
/**
* 公開鍵
* 次の項目の_use_save_data_by_rsa が trueになっているときにはデータの暗号化の鍵として使用します。
*/
define( "_public_key" , <<<_key_
_key_
);
/**
* 保存時の暗号化
* _rsa_save(type)
* typeは保存方法を示します。
* true … SSL関数が利用可能な場合は保存データを1行づつ暗号化します。
* SSL関数が使用できない場合は通常の保存となります。
* また、出力時はSSL環境にある場合のみ
* exportインターフェイスが利用できます。
* false … 通常の保存方法です。
*/
define( "_use_save_data_by_rsa" , _rsa_save(false) );
/******************************************************************
*
*メール送信設定
*
*******************************************************************/
/**
* ユーザ(管理者)宛メール送信(To)
* フォームの送信内容をメールするときはメールアドレス 複数箇所に送信したい場合はカンマ区切りで列挙
* ここにメールアドレスが記述されていれば自動的にメール送信機能がOnになります
*/
define( "_user_mail_to" , "" );
/**
* ユーザ(管理者)宛メール送信(Cc)
* フォームの送信内容をCcメールするときはメールアドレス 複数箇所に送信したい場合はカンマ区切りで列挙
*/
define( "_user_mail_cc" , "" );
/**
* ユーザ(管理者)宛メール送信(Bcc)
* フォームの送信内容をBccメールするときはメールアドレス 複数箇所に送信したい場合はカンマ区切りで列挙
*/
define( "_user_mail_bcc" , "" );
/**
* ユーザ(管理者)宛メールのFromのアドレス (固定のメールアドレス)
* メールのFrom行を変更したい場合記述
* MTAによってはここがNULLの場合はメールが送られないことがあるので、なるべく記述すること
*/
define( "_user_mail_from" , "" );
/**
* ユーザ(管理者)宛メールのFromのアドレスのname (特定のメールアドレス)
* HTML中のnameが「fio[EMAIL]」の場合は「EMAIL」を記述する。
* フォーム中のメールアドレスが入る箇所のnameを指定します
* ここに存在するnameが記述されていれば自動的に_user_mail_fromを上書きします
*/
define( "_user_mail_from_name" , "" );
/**
* ユーザ(管理者)宛メールの表題
*
*/
define( "_user_mail_subject" , "" );
/**
* カスタマ(お客様)宛メールの送信時のname
* HTML中のnameが「fio[EMAIL]」の場合は「EMAIL」を記述する。
* カスタマ宛に受付確認メールを返送する場合は必ず設定してください。
* フォーム中のメールアドレスが入る箇所のnameを指定します
* ここに存在するnameが記述されていれば自動的にカスタマ宛てメール送信機能がOnになります
* また、ここに設定したnameは必ずメールアドレスチェックと必須チェックをしてください。
*/
define( "_customer_mail_name" , "mail" );
/**
* カスタマ(お客様)宛メールの送信時のFrom行
* MTAによってはここがNULLの場合はメールが送られないことがあるので、なるべく記述すること
*/
define( "_customer_mail_from" , "support" );
/**
* カスタマ(お客様)宛メールの送信時のFrom行に書かれる名前
*/
define( "_customer_mail_from_name" , "" );
/**
* カスタマ(お客様)宛メールの表題
*
*/
define( "_customer_mail_subject" , "【my style house】お問い合わせいただきありがとうございました " );
/**
* ユーザ宛のメール本文
*/
define( "_mail_body_user" , <<<_eom_
_eom_
);
/**
* カスタマ宛のメール本文
*/
define( "_mail_body_customer" , <<<_eom_
この度はお問い合わせいただき誠にありがとうございました。
下記の通り受け付けております。
内容確認後、物件管理会社よりご連絡させていただきますので
今しばらくお待ちください。
────────────────────────────
▼送信内容
────────────────────────────
[お問い合わせ物件名]##value:building##
[お名前]##value:name-1##
[フリガナ]##value:name-2##
[年齢・性別]##value:age## ##value:sex##
[職業]##value:job##
[メールアドレス]##value:mail##
[電話番号]##value:tel-1##-##value:tel-2##-##value:tel-3##
[入居予定時期]##value:schedule##
[お問い合わせ内容]##value:inquiry##
尚、このメールにお心当たりのないお客様はお手数ですが下記までご連絡お願いいたします。
このメールは自動送信でお送りしています。
------------------------------------------------------
女性のためのシェアライフ
my style house
support@stylehouse.biz
URL: http://www.stylehouse.biz
facebook : http://www.facebook.com/mystylehouse.share
_eom_
);
/******************************************************************
*
* フォーム設定周り
*
*******************************************************************/
$GLOBALS['fio_init']['building']['label'] = 'お問合せ物件名';
$GLOBALS['fio_init']['building']['validate'] = array( 'v_not_null' );
$GLOBALS['fio_init']['name-1']['label'] = 'お名前';
$GLOBALS['fio_init']['name-1']['validate'] = array( 'v_not_null' );
$GLOBALS['fio_init']['name-2']['label'] = 'フリガナ';
$GLOBALS['fio_init']['name-2']['validate'] = array( 'v_not_null' , 'v_only_kana' );
$GLOBALS['fio_init']['age']['label'] = '年齢';
$GLOBALS['fio_init']['age']['validate'] = array( 'v_only_numeric' , 'v_only_hankaku' , 'v_not_null' );
$GLOBALS['fio_init']['sex']['label'] = '性別';
$GLOBALS['fio_init']['sex']['validate'] = array( 'v_not_null' );
$GLOBALS['fio_init']['job']['label'] = '職業';
$GLOBALS['fio_init']['job']['validate'] = array( 'v_not_null' );
$GLOBALS['fio_init']['mail']['label'] = 'メールアドレス';
$GLOBALS['fio_init']['mail']['validate'] = array( 'v_email' , 'v_not_null' );
$GLOBALS['fio_init']['tel-1']['label'] = '市外局番';
$GLOBALS['fio_init']['tel-1']['validate'] = array( 'v_only_numeric_or_null' , 'v_only_hankaku_or_null' );
$GLOBALS['fio_init']['tel-2']['label'] = '市内局番';
$GLOBALS['fio_init']['tel-2']['validate'] = array( 'v_only_numeric_or_null' , 'v_only_hankaku_or_null' );
$GLOBALS['fio_init']['tel-3']['label'] = '加入番号';
$GLOBALS['fio_init']['tel-3']['validate'] = array( 'v_only_numeric_or_null' , 'v_only_hankaku_or_null' );
$GLOBALS['fio_init']['schedule']['label'] = '入居予定時期';
$GLOBALS['fio_init']['inquiry']['label'] = 'お問い合わせ内容';
$GLOBALS['fio_init']['inquiry']['validate'] = array( 'v_not_null' );
/******************************************************************
*
* フォームHTML設定
*
*******************************************************************/
/**
* フォーム画面
*/
define( "_html_form" , <<<_html_
特定の物件に関するご質問や入居に関するご質問は、こちらのフォームからお問合せ頂くと各運営事業者から直接ご返事がきます。
個人情報保護についてはプライバシーポリシーをご覧ください。※は必須項目です。
_html_
);
/**
* 確認画面
*/
define( "_html_form_confirm" , <<<_html_
ご入力内容のご確認
下記に入力内容を表示します。間違いない場合は、「送信」をクリックしてください。間違いがあった場合は「もどる」をクリックし、修正を行ってください。
_html_
);
/**
* 完了画面
*/
define( "_html_complite" , <<<_html_
_html_
);
/**
* HTMLの共通ヘッダ
*/
define( "_html_header" , <<<_html_
{$GLOBALS['fio_title']}
_html_
);
/**
* HTMLの共通フッタ
*/
define( "_html_footer" , <<<_html_
_html_
);
define( "_html_admin" , <<<_html_
_html_
);
/**
* HTMLの個別ヘッダ・フッタ
*
* 次のものが使用可能です、defineすると共通ヘッダの後ろもしくは共通フッタの手前に自動的に挿入されます。
* _html_header_form フォームのページの専用挿入ヘッダ
* _html_footer_form フォームのページの専用挿入フッタ
* _html_header_confirm 確認画面の専用挿入ヘッダ
* _html_footer_confirm 確認画面の専用挿入フッタ
* _html_header_complete 完了画面の専用挿入ヘッダ
* _html_footer_complete 完了画面の専用挿入フッタ
* _html_header_error エラー画面の専用挿入ヘッダ
* _html_footer_error エラー画面の専用挿入フッタ
*
*/
/******************************************************************
*
* エラー関連設定
*
*******************************************************************/
/**
* エラーコンテンツテンプレート
*/
define( '_error_block_template' , '' );
define( '_error_line_template' , '%s' );
define( '_error_separator' , ':' );
/**
* エラー文字列設定
*/
$error['v_email']='正しいメールアドレスを入力してください';
$error['v_email_or_null']='正しいメールアドレスを入力してください';
$error['v_not_null']='この項目は必須項目です';
$error['v_only_numeric']='この項目は数字のみ許可されています';
$error['v_only_numeric_or_null']='この項目は数字のみ許可されています';
$error['v_only_alphabet']='この項目は半角英字のみ許可されています';
$error['v_only_alphabet_or_null']='この項目は半角英字のみ許可されています';
$error['v_only_hankaku']='この項目は半角文字のみ許可されています';
$error['v_only_hankaku_or_null']='この項目は半角文字のみ許可されています';
$error['v_only_hira']='この項目は全角ひらがなのみ許可されています';
$error['v_only_hira_or_null']='この項目は全角ひらがなのみ許可されています';
$error['v_only_kana']='この項目は全角カタカナのみ許可されています';
$error['v_only_kana_or_null']='この項目は全角カタカナのみ許可されています';
$error['v_only_hankana']='この項目は半角カタカナのみ許可されています';
$error['v_only_hankana_or_null']='この項目は半角カタカナのみ許可されています';
$error['v_cfm_not_match']='入力した内容が一致しません';
$error['v_rgx_match']='書式が正しくありません';
$error['v_rgx_not_match']='書式が正しくありません';
$error['v_ses_match']='入力した内容が一致しません';
$error['v_ses_not_match']='入力した内容が一致しません';
/******************************************************************
*
* システム内設定
*
*******************************************************************/
/**
* ソースの記述文字コード
* ここコードをUTF-8以外に変更した場合はpcre関数
* (主にエラーチェック)などで一部問題が発生します。
*/
define( "_fio_internal_encoding" , "UTF-8" );
ini_set("mbstring.script_encoding", _fio_internal_encoding );
mb_internal_encoding( _fio_internal_encoding );
mb_regex_encoding( mb_internal_encoding() );
/**
* イントラネットなどでのご利用で、秘密鍵が漏洩しても問題ないような環境で
* ご使用されていて、かつ設置しているwebサーバがSSLで本プログラムを
* 利用できない場合のみtrueにセットしてください。
*
* (!!!!注意!!!!)上記環境以外では秘密鍵とパスフレーズが
* 暗号化されていない経路を通ることで、これらが悪意を持った第三者の手に
* 渡っている状態になっていることと同じです。
* たとえ、それまで安全に保存されているデータでもこのフラグを変更して
* 利用した瞬間にすべてのデータが全く暗号化していない状態と同じ
* セキュリティ強度に下がってしまうことを是非ご理解ください。
*
* ですので通常は「!!絶対!!」に変更しないで下さい。
*/
define( "_force_ssl" , false );
/******************************************************************
*
* Main routine
*
*******************************************************************/
//main
init_var();
init_func();
if( file_exists( _fio_ext_file ) ){
require_once _fio_ext_file;
define( "_use_fio_extension" , true );
}else{
define( "_use_fio_extension" , false );
}
if( _session_name ){
session_name( _session_name );
session_start();
}
if( _use_token ){
if( !session_id() ){
session_start();
}
if( isset( $_SESSION['token'] ) && isset( $_POST['token'] ) && $_SESSION['token'] != $_POST['token'] ){
system_die( "不正なトークンの利用です" , "このページではリロードはできません。" );
}
$_SESSION['token'] = md5( uniqid( rand() , true ) );
}
//書き込みチェック
if( _use_data_save && !file_exists( _install_ok ) ){
if( !is_dir( _save_path ) ){
if( !setup_save_dir( _save_path ) ){
system_die( "ファイルエラー" , " 入力データの保存先の準備に失敗しました。" . _save_path ." を作る権限がありません" );
}
}
if( is_dir( _save_path ) && !is_writable( _save_path ) ){
system_die( "ファイルエラー" , "入力データの保存先の準備に失敗しました。" . _save_path ." の中にファイルを書き込むことが出来ません。" );
}
if( !file_exists( _install_test ) && !file_exists( _install_ok ) ){
if( !setup_install_test() ){
system_die( "ファイルエラー" , "インストールテストの準備に失敗しました。" . _install_test ." を作る権限がありません" );
}else{
permission_test();
}
}elseif( !file_exists( _install_ok ) && isset( $_POST['install_ok'] ) ){
if( !install_complete() ){
system_die( "ファイルエラー" , "インストール完了設定の準備に失敗しました。" . _install_ok ." を作る権限がありません" );
}
}elseif( !file_exists( _install_ok ) ){
permission_test();
}
}
//確認画面使用するかチェック
if( !_use_confirm && $_GET['seq'] == 'confirm' ){
$_GET['seq'] = 'regist';
}
//フォームへの入力値の自動変換
if( _use_auto_conv ){
if( isset( $_POST['fio'] ) && is_array( $_POST['fio']) ){
$_POST['fio'] = mb_convert_kana_array( $_POST['fio'] , _use_auto_conv , _fio_internal_encoding );
}
}
//ページ表示状態による条件分岐
switch( $_GET['seq'] ){
case "fio_ssl_dl":
if( is_ssl() && _use_save_data_by_rsa ){
show_admin_tool();
}else{
show_form();
}
break;
case "fio_ssl_dl_exec":
if( is_ssl() && _use_save_data_by_rsa ){
admin_download();
}else{
show_form();
}
break;
case "regist":
$result = validate_form();
if( $result['error'] ){
show_form( $result['error_list'] );
}elseif( isset( $_POST['back'] ) && $_POST['back'] ){
show_form();
}else{
if( _user_mail_to ){
send_user_mail();
}
if( _customer_mail_name ){
send_customer_mail();
}
if( _use_data_save ){
save_data( $GLOBALS['fio_init'] , $_POST['fio'] );
}
show_complete();
}
break;
case "confirm":
$result = validate_form();
if( $result['error'] ){
show_form( $result['error_list'] );
}else{
show_confirm();
}
break;
case "return":
header( "Location: " . _return_uri );
exit();
break;
case "index":
default:
show_form();
break;
}
exit;
/******************************************************************
*
* Functions
*
*******************************************************************/
/**
* 変数初期化
*
*/
function init_var(){
if( !isset( $_GET['seq'] ) ){
$_GET['seq']="index";
}
return true;
}
function init_func(){
if( !function_exists( 'file_get_contents' ) ){
function file_get_contents( $filename , $incpath = false , $resource_context = null ){
if( false === $fh = fopen( $filename , 'rb' , $incpath ) ){
trigger_error( 'file_get_contents() failed to open stream: No such file or directory' , E_USER_WARNING );
return false;
}
clearstatcache();
if ( $fsize = @filesize( $filename ) ) {
$data = fread( $fh , $fsize );
} else {
$data = '';
while( !feof( $fh ) ){
$data .= fread( $fh , 8192 );
}
}
fclose( $fh );
return $data;
}
}
}
/**
* echo代替の出力コマンド
*
* @param string $strings 出力文字列
* @param string $charset 出力時の文字コード
* @param string $internal_encoding このファイルの文字コード
*/
function _echo( $strings , $charset = _fio_charset , $internal_encoding = _fio_internal_encoding ){
echo _m( $strings , $charset , $internal_encoding );
}
function _m( $strings , $charset = _fio_charset , $internal_encoding = _fio_internal_encoding ){
return mb_convert_encoding( $strings , $charset , $internal_encoding );
}
function _h( $strings , $quote_style = ENT_COMPAT , $charset = _fio_internal_encoding ){
return htmlspecialchars( $strings , $quote_style , $charset );
}
/**
* デフォルトフォームの表示
* @param string $error_list エラーリスト
* @return boolean
*/
function show_form( $error_list = "" ){
_echo( _html_header );
if( defined( "_html_header_form" ) ){ _echo( _html_header_form ); }
if( is_array( $error_list) ){
_echo( make_error_list( $error_list) );
}
_echo( make_form_html( _html_form ) );
if( defined( "_html_footer_form" ) ){ _echo( _html_footer_form ); }
_echo( _html_footer );
return true;
}
/**
* 確認ページの表示
*
* @return boolean
*/
function show_confirm(){
_echo( _html_header );
if( defined( "_html_header_confirm" ) ){ _echo( _html_header_confirm ); }
_echo( make_form_html( _html_form_confirm ) );
if( defined( "_html_footer_confirm" ) ){ _echo( _html_footer_confirm ); }
_echo( _html_footer );
return true;
}
/**
* 完了ページの表示
*
* @return boolean
*/
function show_complete(){
_echo( _html_header );
if( defined( "_html_header_complete" ) ){ _echo( _html_header_complete ); }
_echo( make_form_html( _html_complite ) );
if( defined( "_html_footer_complete" ) ){ _echo( _html_footer_complete ); }
_echo( _html_footer );
return true;
}
function show_admin_tool(){
_echo( _html_header );
_echo( _html_admin );
_echo( _html_footer );
exit();
}
/**
* エラーページの表示
*/
function system_die( $die_status = "Unkown Error" , $message = "System error occured!" ){
_echo( _html_header );
if( defined( "_html_header_error" ) ){ _echo( _html_header_error ); }
_echo( '' . $die_status . '
' );
_echo( '' . $message . '
' );
_echo( '' );
if( defined( "_html_footer_error" ) ){ _echo( _html_footer_error ); }
_echo( _html_footer );
exit();
}
/**
* フォームのhtmlを出力する
*
* @param string $contents 出力するHTMLテンプレート
* @return string
*/
function make_form_html( $contents ){
$html = replace_kwd( $contents );
return $html;
}
/**
* エラーリストの生成
*
* @param array $error_list
* @return string
*/
function make_error_list( $error_list ){
$return = "";
foreach( $error_list as $key => $value ){
$return .= sprintf( _error_line_template , $value );
}
if( $return ){
$return = sprintf( _error_block_template , $return );
}
return $return;
}
function send_user_mail(){
if( v_email( $_POST['fio'][_user_mail_from_name] ) ){
$from = $_POST['fio'][_user_mail_from_name];
}else{
$from = _user_mail_from;
}
$subject = replace_kwd( _user_mail_subject );
$body = replace_kwd( _mail_body_user );
return send_mail( _user_mail_to , $subject , $body , $from , "" , _user_mail_cc , _user_mail_bcc );
}
function send_customer_mail(){
if( v_email( $_POST['fio'][_customer_mail_name] ) ){
$subject = replace_kwd( _customer_mail_subject );
$body = replace_kwd( _mail_body_customer );
return send_mail( $_POST['fio'][_customer_mail_name] , $subject , $body , _customer_mail_from , _customer_mail_from_name );
}else{
return false;
}
}
/**
* 入力内容のチェック
*
* @return array
*/
function validate_form(){
global $error;
$result = "";
if( is_array( $GLOBALS['fio_init'] ) ){
foreach( $GLOBALS['fio_init'] as $key => $value ){
if( !isset( $_POST['fio'][$key] ) ){
$_POST['fio'][$key] = "";
}
if( isset( $GLOBALS['fio_init'][$key]['validate'] ) ){
if( is_array( $GLOBALS['fio_init'][$key]['validate'] ) ){
foreach( $GLOBALS['fio_init'][$key]['validate'] as $kk => $valid_func ){
if( is_array( $_POST['fio'][$key] ) ){ /* チェックボックスなど */
foreach( $_POST['fio'][$key] as $pk => $pv ){
if( !$valid_func( $pv ) ){
$result['error_list'][]= $GLOBALS['fio_init'][$key]['label'] . _error_separator . $error[$valid_func] . '(' . $pv . ')';
}
}
}else{ /* それ以外 */
$v_cmd_hd = substr( $valid_func , 0 , 6 );
switch( $v_cmd_hd ){
case "v_cfm_":
if( isset( $_POST['fio'][$key."_confirm"] ) ){
if( !$valid_func( $_POST['fio'][$key] , $_POST['fio'][$key.'_confirm'] ) ){
$result['error_list'][]= $GLOBALS['fio_init'][$key]['label'] . _error_separator . $error[$valid_func];
}
}else{
system_die( "設定エラー" , "{$key}_confirmが存在しません" );
}
break;
case "v_rgx_":
list( $regex_func , $regex , $error_mes ) = explode( "\t" , $valid_func );
if( !$regex_func( $_POST['fio'][$key] , $regex ) ){
$result['error_list'][]= $GLOBALS['fio_init'][$key]['label'] . _error_separator .
( $error_mes != "" ? $error_mes : $error[$regex_func] );
}
break;
case "v_ses_":
list( $sess_func , $ses_var , $ignore_case , $error_mes ) = explode( "\t" , $valid_func );
if( !$sess_func( $_POST['fio'][$key] , $ses_var , $ignore_case ) ){
$result['error_list'][]= $GLOBALS['fio_init'][$key]['label'] . _error_separator .
( $error[$valid_func] != "" ? $error_mes : $error[$sess_func] );
}
break;
default:
if( !$valid_func( $_POST['fio'][$key] ) ){
$result['error_list'][]= $GLOBALS['fio_init'][$key]['label'] . _error_separator . $error[$valid_func];
}
break;
}
}
}
}
}
}
}
if( isset( $result['error_list'] ) && is_array( $result['error_list'] ) ){
$result['error']=true;
}else{
$result['error']=false;
}
return $result;
}
/******************************************************************
*
* 入力値のチェック
*
*******************************************************************/
/**
* メールアドレスかどうかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_email( $value , $allow_null = false ){
if( preg_match( '/^([*+!.$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/iu' , $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* メールアドレスあるいはヌルかどうかチェック
*
* @param string $value
* @return boolean
*/
function v_email_or_null( $value ){
return v_email( $value , true );
}
/**
* ヌルかどうかチェック
*
* @param string $value
* @return boolean
*/
function v_not_null( $value ){
if( $value != "" ){
return true;
}else{
return false;
}
}
/**
* アルファベット(A-Za-z)かどうかチェック
*
* @param string $value
* @param boolean $allow_null
* @return booleran
*/
function v_only_alphabet($value , $allow_null = false ){
if( preg_match("/^[A-Za-z]+$/" , $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* アルファベットあるいはヌルかどうかチェック
*
* @param string $value
* @return boolean
*/
function v_only_alphabet_or_null( $value ){
return v_only_alphabet( $value , true );
}
/**
* 数値かどうかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_only_numeric( $value , $allow_null = false ){
if( is_numeric( $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* 数値あるいはヌルかどうかチェック
*
* @param string $value
* @return boolean
*/
function v_only_numeric_or_null( $value ){
return v_only_numeric( $value , true );
}
/**
* 半角文字のみで構成されているかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_only_hankaku( $value , $allow_null = false ){
$len = strlen( $value );
$mblen = mb_strlen( $value , mb_internal_encoding() );
if( $len == $mblen && $value ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* 半角文字のみあるいはヌルで構成されているかチェック
*
* @param string $value
* @return boolean
*/
function v_only_hankaku_or_null( $value ){
return v_only_hankaku( $value , true );
}
/**
* 全角平仮名のみで構成されているかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_only_hira( $value , $allow_null = false ){
if( preg_match( "/^[ぁ-ん]+$/u" , $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* 全角平仮名のみあるいはヌルで構成されているかチェック
*
* @param string $value
* @return boolean
*/
function v_only_hira_or_null( $value ){
return v_only_hira( $value , true );
}
/**
* 全角カタカナのみで構成されているかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_only_kana( $value , $allow_null = false ){
if( preg_match( "/^[ァ-ヶー]+$/u" , $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* 全角カタカナのみあるいはヌルで構成されているかチェック
*
* @param string $value
* @return boolean
*/
function v_only_kana_or_null( $value ){
return v_only_kana( $value , true );
}
/**
* 半角カタカナのみで構成されているかチェック
*
* @param string $value
* @param boolean $allow_null
* @return boolean
*/
function v_only_hankana( $value , $allow_null = false ){
if( preg_match( "/^[ヲ-゚]+$/u" , $value ) ){
return true;
}else{
if( $allow_null && $value == "" ){
return true;
}else{
return false;
}
}
}
/**
* 半角カタカナのみあるいはヌルで構成されているかチェック
*
* @param string $value
* @return boolean
*/
function v_only_hankana_or_null( $value ){
return v_only_hankana( $value , true );
}
/**
* 2つの入力値が一緒がどうかチェック
*
* @param string $value
* @param string $confirm
* @return boolean
*/
function v_cfm_not_match( $value , $confirm = '' ){
if( $value === $confirm ){
return true;
}else{
return false;
}
}
/**
* 正規表現によるチェック
*
* @param string $value
* @param string $regex
* @return boolean
*/
function v_rgx_match( $value , $regex ){
if( preg_match( $regex, $value ) ){
return true;
}else{
return false;
}
}
/**
* 正規表現によるチェック(マッチしたらエラー)
*
* @param string $value
* @param string $regex
* @return boolean
*/
function v_rgx_not_match( $value , $regex ){
if( preg_match( $regex, $value ) ){
return false;
}else{
return true;
}
}
/**
* セッション変数の特定の値とマッチするかのチェック
*
* @param string $value
* @param string $session_var
* @return boolean
*/
function v_ses_match( $value , $session_var , $case_ignore ){
if( $case_ignore == '1' ){
$value = strtolower( $value );
$check = strtolower( $_SESSION[$session_var] );
}else{
$check = $_SESSION[$session_var];
}
if( $check == $value ){
return true;
}else{
return false;
}
}
/**
* セッション変数の特定の値とマッチするかのチェック(マッチしたらエラー)
*
* @param string $value
* @param string $session_var
* @return boolean
*/
function v_ses_not_match( $value , $session_var , $case_ignore ){
if( $case_ignore == '1' ){
$value = strtolower( $value );
$check = strtolower( $$session_var );
}else{
$check = $$session_var;
}
if( $check == $value ){
return false;
}else{
return true;
}
}
/**
* データの保存
*
* @return boolean
*/
function save_data( $init , $data ){
$status = file_exists( _save_file );
$label = make_label( $init );
$line = make_line( $label , $data , $status );
return file_write( _save_file , $line );
}
/**
* 保存データ用のラベルを生成する
*
* @param array $init 初期設定データ
* @return array ラベルを格納した配列
*/
function make_label( $init ){
if( is_array( $init ) ){
foreach( $init as $key => $value ){
$label[$key] = $init[$key]['label'];
}
}
return $label;
}
/**
* 保存データを生成
*
* @param array $label ラベルの配列
* @param array $data データの配列( $_POST['fio'] )
* @param array $status ファイルの状態 false = 新規ファイル
* @return string
*/
function make_line( $label , $data , $status ){
switch( _save_type ){
case "CSV":
$separator = ",";
$item_fmt = '"%s"' . $separator;
$replace_to = "";
break;
case "TSV":
$separator = "\t";
$item_fmt = '%s' . $separator;
$replace_to = " ";
break;
}
$line_label = "";
//新規ファイルの場合はラベルを作る
if( !$status ){
switch( _save_consecutive_number ){
case "consecutive":
$line_label .= sprintf( $item_fmt , "Consecutive number" );
break;
case "file":
$line_label .= sprintf( $item_fmt , "Consecutive number(FILE)" );
break;
case "both":
$line_label .= sprintf( $item_fmt , "Consecutive number" );
$line_label .= sprintf( $item_fmt , "Consecutive number(FILE)" );
break;
}
foreach( $label as $key => $value ){
if( $replace_to ){
$value = str_replace( $separator , $replace_to , $value );
}
$line_label .= sprintf( $item_fmt , $value );
}
if( _save_timestamp ){
$line_label .= sprintf( $item_fmt , "TimeStamp" );
}
if( _save_host ){
$line_label .= sprintf( $item_fmt , "Host(IP)" );
}
if( substr( $line_label , -1 ) == $separator ){
$line_label = substr( $line_label , 0 , -1 );
}
$line_label .= _nl;
$line_label = _m( $line_label , _save_charset );
}
$line = "";
if( is_array( $label) ){
switch( _save_consecutive_number ){
case "consecutive":
$line .= sprintf( $item_fmt , counter_up( _save_counter_all ) );
break;
case "file":
$line .= sprintf( $item_fmt , counter_up( _save_counter_file ) );
break;
case "both":
$line .= sprintf( $item_fmt , counter_up( _save_counter_all ) );
$line .= sprintf( $item_fmt , counter_up( _save_counter_file ) );
break;
}
foreach( $label as $key => $value ){
$wdata = '';
if( is_array( $data[$key] ) ){
foreach( $data[$key] as $key => $value ){
$wdata .= $value . ',';
}
if( $wdata != '' ){
$wdata = substr( $wdata , 0 , -1 );
}
}else{
$wdata = $data[$key];
}
if( $replace_to ){
$wdata = str_replace( $separator , $replace_to , $wdata );
}
$line .= sprintf( $item_fmt , $wdata );
}
if( _save_timestamp ){
$line .= sprintf( $item_fmt , date( _save_timestamp ) );
}
if( _save_host ){
switch( strtolower( _save_host ) ){
case "host":
$host = gethostbyaddr( $_SERVER['REMOTE_ADDR'] );
break;
case "ip":
default:
$host = $_SERVER['REMOTE_ADDR'];
}
$line .= sprintf( $item_fmt , $host );
}
if( substr( $line , -1 ) == $separator ){
$line = substr( $line , 0 , -1 );
}
$line .= _nl;
$line = _m( $line , _save_charset );
if( _use_save_data_by_rsa ){
$line = rsa_encrypt( $line );
}
}
return $line_label . $line;
}
/**
* 保存先ディレクトリの初期化(mkdir)
*
* @param string $dir
* @return boolean
*/
function setup_save_dir( $dir ){
if( mkdir( $dir ) ){
return file_write( _htaccess , "order deny,allow\ndeny from all\n" );
}
return false;
}
function setup_install_test(){
$html = _m( _html_header );
$html .= _m( '!!!警告!!!
' );
$html .= _m( 'このページにブラウザからアクセスできる場合は、データがWeb経由で漏洩してしまう可能性が極めて高いことを意味します
' );
$html .= _m( _html_footer );
if( is_dir( _save_path ) && is_writable( _save_path ) && is_executable( _save_path ) ){
return file_write( _install_test , $html );
}else{
return false;
}
}
function install_complete(){
@unlink( _install_test );
return file_write( _install_ok , "" );
}
function permission_test(){
_echo( _html_header );
_echo( '保存先の権限のテスト
' );
_echo( '保存先がWeb経由で漏洩してしまうことがないかどうかのテストを行います。
' );
_echo( 'データの保存先:'. _save_path . '
' );
_echo( 'ドキュメントルート:'. $_SERVER['DOCUMENT_ROOT'] . '
' );
$dr_check = check_document_root();
_echo( '判断結果:' . $dr_check['result'] . '
' );
_echo( '' . $dr_check['description'] . '
' );
_echo( _html_footer );
exit;
}
function check_document_root(){
$test = false;
$cmp = substr( _save_path , 0 , strlen( $_SERVER['DOCUMENT_ROOT'] ) );
if( $cmp == $_SERVER['DOCUMENT_ROOT'] ){ $test = true; }
if( $test ){
$link = substr( _save_path , strlen( $_SERVER['DOCUMENT_ROOT'] ) );
$return['result'] = 'ドキュメントルート配下に保存先が存在します。';
$return['description'] = 'ドキュメントルートより下のディレクトリに保存先ディレクトリが設定されています。
';
$return['description'] .= '本システムは安全のため保存先ディレクトリに自動的に.htaccessファイルを作って外部からブラウザ経由で保存されたデータに';
$return['description'] .= 'アクセスできないように設定しますが、現在貴方がお使いのWebサーバの設定によっては.htaccessの設定が動作しない場合があります。
';
$return['description'] .= '実際にアクセス拒否されているかどうか、次のURLにアクセスして確認してください。
';
$return['description'] .= 'リンク先が403Forbidden などのエラーが出た場合は、保存データは外部から、見えない(つまり安全な)状態になっています。
';
$return['description'] .= '';
}else{
$return['result'] = '保存先はドキュメントルートよりも上位のディレクトリにあります';
$return['description'] = 'ドキュメントルートより上のディレクトリに保存先が設定されているのでブラウザ経由のアクセスからはデータが守られている可能性が高いです。
';
$return['description'] .= '実際にデータ保存されている場所に外部からアクセス出来ないことを十分確認のうえご利用ください。
';
$return['description'] .= 'なお、本ソフトウェアはこのような場合でも念のため保存先ディレクトリに自動的に.htaccessファイルを作ります。
';
}
$return['description'] .= '
';
$return['description'] .= '(注意)現在貴方が本ソフトウェアをインストールしようとしているサーバが共用サーバなどで、';
$return['description'] .= '貴方もしくは貴方の所属する団体と関係のない第三者がFTP/TELNET/SSHなどの手段でこのサーバにログインできる可能性がある場合は';
$return['description'] .= '保存されたデータは、外部からのアクセスが出来ない状態であるからといって、必ずしも安全ではありません。
';
$return['description'] .= '
';
$return['description'] .= '本テストは外部アクセスからによるデータの漏洩を防げるということをお約束するための物ではありませんので、ご利用に際しては';
$return['description'] .= 'ご利用者様の責任において十分なデータ防護の処置を講じた上、本ソフトウェアをお使いください。';
$return['description'] .= '';
return $return;
}
function file_write( $file , $contents , $mode = "a" ){
$fp = fopen( $file , $mode );
if ( !$fp ) {
return false;
}else{
fputs( $fp , $contents );
fclose( $fp );
return true;
}
return false;
}
/**
* ##差込コマンドの置換
*
* @param string $contents
* @return string
*/
function replace_kwd( $contents ){
//POSTされた値を返す
foreach( $GLOBALS['fio_init'] as $key => $value ){
$REGEX_SET['r_Ins_Token'] = "/##token##/u";
$REGEX_SET['r_FormLabel'] = "/##label:({$key})(|\|(.*?))##/u";
$REGEX_SET['r_FormValue'] = "/##value:({$key})(|\|(.*?))##/u";
$REGEX_SET['r_ChekStats'] = "/##chkstats:({$key})\|(.*?)\|(|@)##/u";
$REGEX_SET['r_CBoxStats'] = "/##cboxstats:({$key})\|(.*?)\|(|@)##/u";
$REGEX_SET['r_SlctStats'] = "/##selstats:({$key})\|(.*?)\|(|@)##/u";
$REGEX_SET['r_HdChkVals'] = "/##hchkvalues:({$key})##/u";
$REGEX_SET['r_ChkedVals'] = "/##cchkvalues:({$key})##/u";
foreach( $REGEX_SET as $func => $regex ){
$contents = preg_replace_callback( $regex , $func , $contents );
}
}
//残った##コマンドを消す
$contents = preg_replace( "/##(.*?)##/" , "" , $contents );
return $contents;
}
/**
* トークンタグの挿入
*
* @return string トークンタグ
*/
function r_Ins_Token(){
if( _use_token ){
return '';
}else{
return '';
}
}
function r_FormLabel( $matches ){
if( isset( $GLOBALS['fio_init'][$matches[1]]['label'] ) ){
return $GLOBALS['fio_init'][$matches[1]]['label'];
}
}
/**
* ##valueコマンド
*
* @param array $matches
* @return string
*/
function r_FormValue( $matches ){
if( $_GET['seq'] == 'index' ){
if( isset( $matches[3] ) ){
return _h( $matches[3] );
}else{
return "";
}
}else{
if( isset( $_POST['fio'][$matches[1]] ) && !is_array( $_POST['fio'][$matches[1]] ) ){
return _h( $_POST['fio'][$matches[1]] );
}else{
return "";
}
}
}
/**
* ##chkstatsコマンド
*
* @param array $matches
* @return string
*/
function r_ChekStats( $matches ){
if( $_GET['seq'] == 'index' && $matches[3] == "@" ){
return " checked";
}
if( isset( $_POST['fio'][$matches[1]] ) ){
if( $_POST['fio'][$matches[1]] == mb_convert_kana( $matches[2] , _use_auto_conv , _fio_charset ) ){
return " checked";
}
}
}
/**
* ##cboxstatsコマンド
*
* @param array $matches
* @return string
*/
function r_CBoxStats( $matches ){
if( $_GET['seq'] == 'index' && $matches[3] == "@" ){
return " checked";
}
if( isset( $_POST['fio'][$matches[1]] ) && is_array( $_POST['fio'][$matches[1]] ) ){
foreach( $_POST['fio'][$matches[1]] as $key => $value ){
if( $value == mb_convert_kana( $matches[2] , _use_auto_conv , _fio_charset ) ){
return " checked";
}
}
}
}
/**
* ##selstatsコマンド
*
* @param array $matches
* @return string
*/
function r_SlctStats( $matches ){
if( $_GET['seq'] == 'index' && $matches[3] == "@" ){
return " selected";
}
if( isset( $_POST['fio'][$matches[1]] ) ){
if( $_POST['fio'][$matches[1]] == $matches[2]){
return " selected";
}
}
}
/**
* ##hchkvaluesコマンド
*
* @param array $matches
* @return string
*/
function r_HdChkVals( $matches ){
if( $_GET['seq'] == 'index' ){
return "";
}
$ret = '';
if( isset( $_POST['fio'][$matches[1]] ) && is_array( $_POST['fio'][$matches[1]] ) ){
foreach( $_POST['fio'][$matches[1]] as $key => $value ){
$ret .= '' . "\n";
}
return $ret;
}
return "";
}
/**
* ##hchkvaluesコマンド
*
* @param array $matches
* @return string
*/
function r_ChkedVals( $matches ){
if( $_GET['seq'] == 'index' ){
return "";
}
$ret = '';
if( isset( $_POST['fio'][$matches[1]] ) && is_array( $_POST['fio'][$matches[1]] ) ){
foreach( $_POST['fio'][$matches[1]] as $key => $value ){
$ret .= $value . ',';
}
if( $ret ){
return substr( $ret , 0 , -1 ) . "\n" ;
}
}
return "";
}
function mb_convert_kana_array( $array , $option , $encoding = NULL ){
if( is_array( $array ) ){
foreach( $array as $key => $value ){
if( is_array( $value ) ){
$array[$key] = mb_convert_kana_array( $array[$key] , $option , $encoding );
} else {
$array[$key] = mb_convert_kana( $value , $option , $encoding );
}
}
} else {
$array = mb_convert_kana( $array , $option , $encoding );
}
return $array;
}
/**
* 日本語のメール送信
*
* @param string $to 送信先
* @param string $subject サブジェクト
* @param string $content 本文
* @param string $from 送信元
* @param string $from_name 送信元の名前
* @param string $header ヘッダデータ
* @param string $enc 送信前データの文字コード
* @return boolean
*/
function send_mail( $to , $subject , $content , $from , $from_name = "" , $cc = "" , $bcc = "" , $header = "" , $enc = _fio_charset ){
$subject = _m( trim( $subject ) , "JIS" , $enc );
$subject = str_replace( "\n" , "\r\n " , wordwrap( $subject , 75 ) );
$subject = '=?iso-2022-jp?B?' . base64_encode( $subject ) . '?=';
$content = str_replace( "\r\n", "\n", $content); //DBデータ内のCRLF->LF
$content = _m( $content , "JIS" , $enc );
if( $from_name ){
$from_name = _m( trim( $from_name ) , "JIS" , $enc );
$from_name = str_replace( "\n" , "\r\n " , wordwrap( $from_name , 75 ) );
$from_full = '=?iso-2022-jp?B?' . base64_encode( $from_name ) . '?=<' . $from . '>';
}else{
$from_full = $from;
}
$ext = 'From: ' . $from_full . "\r\nReply-To: " . $from_full . "\r\n";
if( isset( $cc ) && $cc != "" ){
$ext .= "Cc: {$cc}\r\n";
}
if( isset( $bcc ) && $bcc != "" ){
$ext .= "Bcc: {$bcc}\r\n";
}
if( isset( $header) && $header != "" ){
$ext .= $header;
}
$ext .=
"Mime-Version: 1.0\r\n".
"Content-Type: text/plain; charset=ISO-2022-JP\r\n".
"Content-Transfer-Encoding: 7bit\r\n".
"Date: " . date( "r" );
$param = '-f' . $from;
return mail( $to , $subject , $content , $ext , $param );
}
/**
* RSA形式で保存可能かどうか判断する
*
* @param boolean $flag ユーザによる選択
* @return boolean
*/
function _rsa_save( $flag ){
if( $flag && trim( _public_key ) != "" && function_exists( "openssl_pkey_get_public" ) ){
return true;
}else{
return false;
}
}
function rsa_encrypt( $line ){
$public_key = openssl_pkey_get_public( _public_key );
// 暗号化処理
openssl_seal( $line , $encrypted_data , $env_key , array( $public_key ) );
$return = base64_encode( $encrypted_data ) . "\t" . base64_encode( $env_key[0] ) . "\n";
// 鍵リソースの解放
openssl_free_key( $public_key );
return $return;
}
function prepare_pkey(){
if( isset( $_FILES['private']['size'] ) && isset( $_POST['passphrase'] ) && ( $_FILES['private']['size'] ) ){
$GLOBALS['private_key'] = file_get_contents( $_FILES['private']['tmp_name'] );
if( pkey_test() ){
return true;
}else{
return false;
}
}else{
return false;
}
}
function get_pkey(){
// 秘密鍵を読み込む
if( $_POST['passphrase'] != "" ){
return openssl_pkey_get_private( $GLOBALS['private_key'] , $_POST['passphrase'] );
}else{
return openssl_pkey_get_private( $GLOBALS['private_key'] );
}
}
function rsa_decrypt( $line ){
list( $encrypted_data , $env_key ) = explode( "\t" , $line );
// 復号処理
$private_key = get_pkey();
if( !$private_key ){
system_die( "システムエラー" , openssl_error_string() );
}
if( !openssl_open( base64_decode( $encrypted_data ) , $decrypted_data , base64_decode( $env_key ) , $private_key ) ){
system_die( "システムエラー" , openssl_error_string() );
}
// 鍵リソースの解放
openssl_free_key( $private_key );
return $decrypted_data;
}
function pkey_test(){
$public_key = openssl_pkey_get_public( _public_key );
openssl_seal( "sarahsystems" , $encrypted_data , $env_key , array( $public_key ) );
openssl_open( $encrypted_data , $decrypted_data , $env_key[0] , get_pkey() );
openssl_free_key( $public_key );
if( $decrypted_data === "sarahsystems" ){
return true;
}else{
return false;
}
}
/**
* 現在のページがHTTPSかどうか判断する
*
* @return boolean
*/
function is_ssl(){
if( _force_ssl ){
return true;
}
if( isset( $_SERVER['https'] ) && $_SERVER['https'] == 1){ /* ApacheでSSLアクセス */
return true;
} elseif( isset( $_SERVER['https'] ) && $_SERVER['https'] == 'on' ){ /* IISでSSLアクセス */
return true;
} elseif( isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ){ /* それ以外 */
return true;
} else {
return false; /* https非対応あるいはhttpでのアクセス */
}
}
function admin_download(){
if( isset( $_POST['filename'] ) ){
$filename = basename( $_POST['filename'] );
$file = _save_path . "/" . $filename;
if( !prepare_pkey() ){
system_die( "暗号エラー" , "秘密鍵が正しくありません" );
}
if( is_file( $file ) ){
send_header( $filename );
export( $file );
}else{
system_die( "ファイルエラー" , "{$file}が見つかりません" );
}
}else{
return false;
}
}
function export( $file ){
$handle = @fopen( $file , "r" );
if( $handle ) {
$ct = 0;
while( !feof( $handle ) ){
$line = fgets( $handle , 1048576 );
if( $line!="" ){
if( !$ct ){
echo $line;
}else{
echo rsa_decrypt( $line );
}
$ct++;
}
ob_flush();
flush();
}
fclose( $handle );
}else{
system_die( "ファイルエラー" , "{$file}のファイルオープンに失敗しました" );
}
}
function counter_up( $file ){
if( _save_consecutive_number ){
$handle = @fopen( $file , "r+" );
if( $handle ) {
flock( $handle , LOCK_EX );
$count = fgets( $handle , 32 );
$count++;
fseek( $handle , 0 );
fputs( $handle , $count );
flock( $handle , LOCK_UN );
fclose( $handle );
return $count;
}else{
system_die( "カウンタファイルエラー" , "{$file}のファイルオープンに失敗しました" );
}
}
}
function send_header( $filename ){
header('Cache-Control: private');
header('Pragma: private');
header('Content-Disposition: attachment; filename="' . $filename .'"');
header('Content-Type: application/download; name="' . $filename .'"');
ob_flush();
flush();
}
function ext_define_seve_setting(){
/**
* データ保存先
* 保存先パスを設定してください
*/
define( "_save_dir_name" , "fio_data" );
define( "_system_path" , dirname( $_SERVER["DOCUMENT_ROOT"] . $GLOBALS['fio_script_name'] ) );
define( "_fio_ext_file" , _system_path . "/fio_extensions.php" );
define( "_save_path" , _system_path . "/" . _save_dir_name );
define( "_htaccess" , _save_path . "/.htaccess" );
define( "_install_test_file" , "index_test.html" );
define( "_install_ok_file" , "index.html" );
define( "_install_test" , _save_path . '/' . _install_test_file );
define( "_install_ok" , _save_path . '/' . _install_ok_file );
/**
* 保存ファイル名
*
*/
define( "_save_basename" , "save_data" );
define( "_save_counter_name" , "count" );
define( "_save_counter_name_all" , "count_all" );
define( "_save_counter_ext" , ".cnt" );
define( "_save_ext" , "." . strtolower( _save_type ) );
define( "_save_single" , _save_path . "/" . _save_basename . _save_ext );
define( "_save_counter_all" , _save_path . "/" . _save_counter_name_all . _save_counter_ext );
define( "_save_by_date_fmt" , _save_path . "/" . _save_basename . "_%s" . _save_ext );
define( "_save_counter_by_date_fmt" , _save_path . "/" . _save_counter_name . "_%s" . _save_counter_ext );
define( "_nl_win" , "\r\n" );
define( "_nl_mac" , "\r" );
define( "_nl_unix" , "\n" );
return true;
}
function _save_counter_by_date( $format ){
return sprintf( _save_counter_by_date_fmt , date( $format ) );
}
function _save_by_date( $format ){
return sprintf( _save_by_date_fmt , date( $format ) );
}
?>