header( "Content-Type: text/html; Charset={$GLOBALS['conf_client_charset']}" ); header( "Expires: Wed, 31 May 2000 14:59:58 GMT" ); # ********************************************************** # ÆâÉô¥Ç¡¼¥¿¤Ï UTF-8 ¤ÎÆüËܸì # ********************************************************** mb_language( "ja" ); mb_internal_encoding("UTF-8"); # ********************************************************** # $_GET ¥Ç¡¼¥¿¤ÏÊÑ´¹¤·¤Ê¤¤ # ********************************************************** foreach( $_GET as $Key => $Value ) { $_POST[$Key] = $_GET[$Key]; } # ********************************************************** # $_GET ¥Ç¡¼¥¿¤òÁ´¤Æ $_POST ¤ËžÁ÷¤·¤Æ \' ¤È \" ¤òÊÑ´¹ # ********************************************************** foreach( $_POST as $Key => $Value ) { $_POST[$Key] = str_replace("\\\\", "\\", $Value ); $_POST[$Key] = str_replace("\\'", "'", $_POST[$Key] ); $_POST[$Key] = str_replace("\\\"", "\"", $_POST[$Key] ); } $base_param = "ret={$_POST['ret']}"; $base_param .= "&func={$_POST['func']}"; $base_param .= "&ai={$_POST['ai']}"; $base_param .= "&max={$_POST['max']}"; $base_param .= "&debug={$_POST['debug']}"; $base_param .= "&code={$_POST['code']}"; # ********************************************************** # ´Ä¶ # ********************************************************** define( 'COMMON_AUTHOR', 'LIGHTBOX' ); $COMMON_VERSION = '7.0630'; $PHP_VERSION = phpversion(); $HOME_URL = ""; // Ìá¤ë¾ì½ê $CLIENT_PATH = ""; // ³°Éô¥¹¥¿¥¤¥ë¥·¡¼¥ÈÅù¤Î¾ì½ê(¥»¥Ã¥È¤¹¤ë¾ì¹çºÇ¸å¤Ë '/') $CLIENT_FONT_SIZE = "12px"; // ¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¥ó¥È¥µ¥¤¥º # ********************************************************** # ¹¹¿·¥Ç¡¼¥¿¥»¥Ã¥È # ********************************************************** function SetData( $Value, $Type ) { $ret; if ( trim( $Value ) == "" ) { $ret = "NULL"; } else { if ( $Type == 1 ) { $ret = str_replace( "'", "''", $Value ); $ret = Ss( $ret ); } else { $ret = $Value + 0; } } return $ret; } # ********************************************************** # ¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë°ì³çÆɤ߹þ¤ß # ********************************************************** function TxtGetAll( $Path ) { $txt_array = @file( $Path ); if ( $txt_array === FALSE ) { return FALSE; } $len = count( $txt_array ); for( $i = $len - 1; $i >= 0; $i-- ) { if ( substr( $txt_array[$i], 0, 1 ) == ';' ) { array_splice( $txt_array, $i, 1 ); } if ( substr( $txt_array[$i], 0, 2 ) == '--' ) { array_splice( $txt_array, $i, 1 ); } } $txt = implode( "", $txt_array ); return $txt; } function TxtPutAll( $Path, $text, $mode="a" ) { $ret; $handle = fopen( $Path, $mode ); fwrite( $handle, $text ); fclose( $handle ); } # ********************************************************** # ʸ»úÎóÆâ¤Î PHP ÊÑ¿ô¤ò¼¨¤¹Ê¸»úÎó¤Î¥Ñ¡¼¥¹ # 1) ApplyValue( "ʸ»úÎó" ); # 2) ApplyValue( "¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹", TRUE ); # ********************************************************** function ApplyValue( $Value, $flg=FALSE ) { if ( $flg ) { $Value = TxtGetAll( $Value ); } $Value = str_replace('"', '\\"', $Value ); eval("\$Value = \"$Value\";"); return $Value; } # ********************************************************** # ¥Ç¥£¥ê¥¯¥È¥ê¥ê¥¹¥È¼èÆÀ ( Ìá¤êÃÍ : ÇÛÎó ) # ********************************************************** function GetDirList( $Path ) { $ret = array(); if ( $dh = opendir( "$Path" ) ) { while ( ($file = readdir($dh) ) !== false ) { if ( filetype( $Path . "/" . $file ) == 'dir' ) { if ( $file != "." && $file != ".." ) { $ret[] = $file; } } } closedir( $dh ); } return $ret; } # ********************************************************** # ¥À¥Ö¥ë¥¯¥©¡¼¥Èɽ¼¨ÍѽèÍý # ********************************************************** function RestoreValue( ) { foreach( $_POST as $Key => $Value ) { $_POST[$Key] = str_replace("\"", """, $_POST[$Key] ); } } # ********************************************************** # ¥¯¥Ã¥¡¼¥Ç¡¼¥¿¤ÎÉüµ¢ # ********************************************************** function RestoreCookie( ) { foreach( $_COOKIE as $Key => $Value ) { if ( substr( $Key, 0, 2 ) == 'In' ) { if ( !isset( $_POST[$Key] ) ) { $_POST[$Key] = str_replace("\\\\", "\\", $_COOKIE[$Key] ); $_POST[$Key] = str_replace("\\'", "'", $_POST[$Key] ); $_POST[$Key] = str_replace("\\\"", "\"", $_POST[$Key] ); } } } } # ********************************************************** # ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î¥»¥Ã¥È # ********************************************************** function SetError( $Message ) { $GLOBALS['ErrMessage'] = $Message; } # ********************************************************** # °ú·Ñ¤®ÍÑËä¤á¹þ¤ß¥Ç¡¼¥¿¤ÎºîÀ® # ********************************************************** function CreateInData( ) { global $InData; $InData = ""; foreach( $_POST as $Key => $Value ) { if ( substr( $Key, 0, 2 ) == "In" ) { if ( substr( $Key, 0, 3 ) != "In2" ) { $InData .= "\n"; } } else { if ( $Key == 'ret' || $Key == 'func' || $Key == 'ai' || $Key == 'debug' ) { $InData .= "\n"; } } } if ( $_POST['focus'] == 'yes' ) { ?> } } # ********************************************************** # ¥ª¥×¥·¥ç¥óʸ»úÎó¤ÎºîÀ® # ********************************************************** function CreateOption( &$SQL, $FieldName, $Query ) { $Column = $SQL->QueryEx( $Query ); $Ret = ""; while ( $Column ) { $Ret .= "\n"; $Column = $SQL->QueryEx( ); } return $Ret; } # ********************************************************** # ¥ê¥À¥¤¥ì¥¯¥È # ********************************************************** function Redirect( $Target ) { header( "Location: $Target" ); } # ********************************************************** # DB Ê̶´¤ß¹þ¤ß´Ø¿ô # 1:MySQL, 2:SQLServer # ********************************************************** function DBEnclose( $strValue, $Type ) { $strRet = ""; switch( $Type ) { case 1: $strRet = Enclose( $strValue, "`", 0 ); break; case 2: $strRet = Enclose( "[", "]", 2, $strValue ); break; case 3: case 5: case 6: # $strRet = Enclose( $strValue, "\"", 0 ); $strRet = $strValue; break; case 4: $strRet = Enclose( "[", "]", 2, $strValue ); break; } return $strRet; } # ********************************************************** # DB Ê̶´¤ß¹þ¤ßºï½ü´Ø¿ô # 1:MySQL, 2:SQLServer # ********************************************************** function RemoveDBEnclose( $strValue, $Type ) { $strRet = ''; if ( $GLOBALS['conf_client_charset'] != "" ) { mb_regex_encoding($GLOBALS['conf_client_charset']); } switch( $Type ) { case 1: $strRet = str_replace( "`", "", $strValue ); break; case 2: case 4: $strRet = mb_ereg_replace("[\[\]]", "", $strValue ); break; case 3: case 5: case 6: $strRet = str_replace( "\"", "", $strValue ); break; break; } return $strRet; } # ********************************************************** # ¶´¤ß¹þ¤ß´Ø¿ô # ********************************************************** function Enclose( $strValue, $Chr, $Type, $Option="" ) { $strRet = ""; switch( $Type ) { # ñ½ã¶´¤ß¹þ¤ß case 0: $strRet = $Chr . $strValue . $Chr; break; # HTML¶´¤ß¹þ¤ß case 1: $strRet = "<" . $Chr . " " . $Option . ">"; $strRet .= $strValue; $strRet .= "" . $Chr . ">"; break; # º¸±¦¶´¤ß¹þ¤ß case 2: $strRet = $strValue . $Option . $Chr; break; } return $strRet; } # ********************************************************** # ' ¶´¤ß¹þ¤ß´Ø¿ô # ********************************************************** function Ss( $strValue ) { return Enclose( $strValue, "'", 0 ); } # ********************************************************** # " ¶´¤ß¹þ¤ß´Ø¿ô # ********************************************************** function Dd( $strValue ) { return Enclose( $strValue, "\"", 0 ); } # ********************************************************** # ²þ¹ÔÉÕɽ¼¨´Ø¿ô # ********************************************************** function OutCr( $strValue ) { print $strValue . "\n"; } # ********************************************************** # ¥Ç¥Ð¥Ã¥°ÍѾðÊóɽ¼¨´Ø¿ô # ********************************************************** function DispHash( &$Hash, $strTitle="" ) { $Option = "bgcolor=white"; OutCr( "
" ); print_r( $Array ); OutCr( "" ); } # ********************************************************** # ¥Ç¥Ð¥Ã¥°ÍÑ¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨ (3) # ********************************************************** function DispDump( &$Var ) { var_dump( $Var ); } # ********************************************************** # DTPicker ¤Î value °ÀÍѤÎÃͤμèÆÀ # 9999/99/99 ????? ¤Þ¤¿¤Ï 9999-99-99 ????? # ¤È¤¤¤¦ÆþÎÏʸ»úÎó¤ò½èÍý¤¹¤ë # ¤½¤ì°Ê³°¤Îʸ»úÎó¤¬ÅϤµ¤ì¤ë¤ÈÅöÆü¤Îʸ»úÎó¤ò»ÈÍѤ¹¤ë # (»þ´Ö¤ÏÀÚ¤ê¼Î¤Æ¤ë) # ********************************************************** function GetDtpValue( $strDate ) { $Base = gregoriantojd(12,30,1899); $Target = gregoriantojd(Date("n"),Date("j"),Date("Y")); $strDelim = "\0"; if ( FALSE !== strpos( $strDate, "/" ) ) { $strDelim = "/"; } if ( FALSE !== strpos( $strDate, "-" ) ) { $strDelim = "-"; } $DatePart = explode( $strDelim, $strDate ); if ( is_array( $DatePart ) ) { $Cnt = count( $DatePart ); if ( $Cnt >= 3 ) { if ( $DatePart[0] < 50 ) { $DatePart[0] += 2000; } if ( $DatePart[0] < 100 ) { $DatePart[0] += 1900; } $DatePart2 = explode( " ", $DatePart[2] ); $Target = gregoriantojd( $DatePart[1], $DatePart2[0], $DatePart[0] ); } } return( $Target - $Base ); } # ********************************************************** # DTPicker ¤¬ POST ¤·¤¿ ·î/Æü/ǯ ¤ò ǯ/·î/Æü ¤ËÊÑ´¹¤¹¤ë # (»þ´Ö¤ÏÀÚ¤ê¼Î¤Æ¤ë) # ********************************************************** function GetDtpPostValue( $strDate ) { $strDelim = ""; if ( FALSE !== strpos( $strDate, "/" ) ) { $strDelim = "/"; } if ( FALSE !== strpos( $strDate, "-" ) ) { $strDelim = "-"; } $DatePart = explode( $strDelim, $strDate ); $DatePart2 = explode( " ", $DatePart[2] ); if ( $DatePart2[0] < 50 ) { $DatePart2[0] += 2000; } if ( $DatePart2[0] < 100 ) { $DatePart2[0] += 1900; } return $DatePart2[0] . "/" . $DatePart[0] . "/" . $DatePart[1]; } ?>