';
// pdf
if (strcmp($ext, '.pdf') == 0) {
$str .= _HtagAhrefWithUrl($GLOBALS['IMAGE_PDF'], $file) . ' [' .
number_format(filesize($file) / 1024) . 'KB]';
// フラッシュ
} elseif (strcmp($ext, '.swf') == 0) {
$str .=
'
' .
'' .
' |
';
// リアルビデオ
} elseif (strcmp($ext, '.rm') == 0) {
$metafile = _InfoCreateRealMetaFileNamePath($file);
$str .=
'
';
// その他の画像
} else {
$width_p = $GLOBALS['IMAGE_MAX_WIDTH'] / $width;
$height_p = $GLOBALS['IMAGE_MAX_HEIGHT'] / $height;
$min_p = (($width_p < $height_p) ? $width_p : $height_p);
if ($min_p < 1.0) {
$width = (int)($width * $min_p);
$height = (int)($height * $min_p);
$rate = (int)($min_p * 100);
$img = _HtagImage($file, $width, $height, '添付ファイル', 1);
$str .= '
';
$str .= _HtagAhrefWithUrl($img, $file);
$str .= ' |
';
$str .= '[' . $rate . '%に縮小してあります]';
$str .= ' |
';
} else {
$str .= _HtagImage($file, $width, $height, '添付ファイル', 0);
}
}
$str .= '
';
return($str);
}
function _InfoCreateRealMetaFileNamePath($file) {
$metafile = substr($file, 0, strrpos($file, '.')) . '.rpm';
if (! is_file($metafile)) {
$fp = fopen($metafile, 'w');
fputs($fp, $GLOBALS['SITE_URL'] . $file . LF);
fclose($fp);
}
return($metafile);
}
function _AdvGoogleInfo() {
$option = array(
'width' => '468',
'height' => '60',
'channel' => $GLOBALS['ADV_GOOGLE_CHANNEL_INFO'],
'color_border' => $GLOBALS['C_YELLOW'],
'color_bg' => $GLOBALS['C_YELLOW'],
'color_link' => $GLOBALS['C_ORANGE'],
);
return(_AdvGoogle($option));
}
function _EnquateCreateVoteLog($vote, $comment) {
// 改行は全て削除する
$comment = str_replace(array("\r", "\n"), '', $comment);
if (isset($GLOBALS['S']['gid'])) {
$child = 0;
} else {
$child = _EnquateCreateVoteLogChild();
}
$family = sizeof($GLOBALS['S']['family']) + 1;
return(
implode(',', $vote) . $GLOBALS['LOG_DELIMITOR'] .
$comment . $GLOBALS['LOG_DELIMITOR'] .
$GLOBALS['S']['type'] . $GLOBALS['LOG_DELIMITOR'] .
$child . $GLOBALS['LOG_DELIMITOR'] .
$GLOBALS['S']['birthy'] . $GLOBALS['LOG_DELIMITOR'] .
$GLOBALS['S']['address1'] . $GLOBALS['LOG_DELIMITOR'] .
$family . $GLOBALS['LOG_DELIMITOR']
); // 最後に改行は入れない
}
function _EnquateCreateVoteLogChild() {
$child = array();
$family_keys = array_keys($GLOBALS['S']['family']);
$family_keys_max = sizeof($family_keys);
for ($i = 0; $i < $family_keys_max; ++$i) {
$array = $GLOBALS['S']['family'][$family_keys[$i]];
if ($array['type'] <= 2) {
$birthday = mktime(0, 0, 0, $array['birthm'], $array['birthd'], $array['birthy']);
$child[] = sprintf("%.2f", (D_NOW - $birthday) / 31536000);
}
}
return(implode(',', $child));
}
?>