//_InfoShortenDirName, function _InfoShortenDirName($dir) { if (strlen($dir) > 3) { return(substr($dir, 0, strlen($dir) - 3)); } else { // トップ・カテゴリ return(''); } } function _InfoCreateFilelistFilePath($infono) { $dir = _InfoCreateRealPathFromNo($infono); return($dir . '/' . 'filelist' . $GLOBALS['LOG_EXT']); } function _InfoCreateRealPathFromNo($infono) { $file = D_DATA_DIR_INFO; while (strlen($infono) > 0) { $sub = substr($infono, 0, 3); $file .= '/' . $sub; $infono = substr($infono, 3); } if (isset($sub) && ! is_numeric($sub{0})) { $file .= $GLOBALS['LOG_EXT']; } return($file); } function _StringSP($str) { if (is_array($str)) { $lines = $str; } else { $lines = explode(LF, $str); } $lines_max = sizeof($lines); $str = ''; $list_started = false; $bullet_len = strlen('・'); for ($i = 0; $i < $lines_max; ++$i) { $line = $lines[$i]; $nobr = false; // 空行は無視 if ($line == '') { continue; // コメント } elseif (strncmp($line, '//', 2) == 0) { continue; // 番号なしリスト } elseif (strncmp($line, '・', $bullet_len) == 0) { $line = substr($line, $bullet_len); if (! $list_started) { $str .= ''; } $str .= '
  • '; $nobr = true; // 番号付きリスト } elseif (strncmp($line, '*', $bullet_len) == 0) { $line = substr($line, $bullet_len); if (! $list_started) { $str .= '
      '; $list_started = '
    '; } $str .= '
  • '; $nobr = true; // 見出し } elseif (strncmp($line, '■', $bullet_len) == 0) { if ($list_started) { $str .= $list_started; $list_started = false; } $str .= ''; $str .= substr($lines[$i], $bullet_len); $str .= ''; $str .= _HtagHr(); $line = ''; // 管理者一覧 } elseif (strncmp($line, '#', $bullet_len) == 0) { $uid = rtrim(substr($line, $bullet_len)); include(_UserCreateUserFilePathFromId($uid)); $str .= ''; $str .= _UserCreateWhoLink($uinfo['name'], $uid, 'black'); $str .= '
    '; $str .= _StringNP($uinfo['selfi']); $str .= '
    '; $line = ''; // それ以外 } elseif ($list_started) { $str .= $list_started; $list_started = false; } $str .= _StringReplace($line); if (! $nobr) { $str .= '

    '; } } return($str); } function _UserCreateUserFilePathFromId($id) { $file = _UserCreateResolveFilePath($id); if (is_file($file)) { include($file); if (isset($user_id_array[$id])) { return(_UserCreateFileNamePath($user_id_array[$id])); } else { return(''); } } else { return(''); } } function _StringReplace($str) { // 言語変換 $str = _StringLanguageReplace($str); if (empty($GLOBALS['STRING_PREG_PATTERN'])) { $cq = $GLOBALS['C_RED']; // 検索文字列の強調 $cr = $GLOBALS['C_GREEN_DARK']; // 返信の引用 // 正規表現による置換 $GLOBALS['STRING_PREG_PATTERN'] = array( // 返信の引用 '/((^>)|(
    >)\s*)([^<]*)/', // 記事へのポインタ '/(NO|No|no)([\.\s]*)(\d+)/', // MAIL URL // "/(([\w\.]+))(@)([\w\.]+)\b\~/i", // HTTP URL "/((http(s?):\/\/)|(www\.))([\w\.\/\&\=\?\-\~\;\%]+)/", // FTP URL // "/((ftp(7?):\/\/)|(ftp\.))([\w\.\/\&\=\?\-\~]+)/", ); $GLOBALS['STRING_PREG_REPLACE'] = array( '$1$4', (isset($GLOBALS['MOBILE']) ? _MobileHtagAhref('No.$3', 'b', array('an' => '$3')) : _HtagAhref('No.$3', 'bbs', 'article', array('no' => '$3'))), // _HtagAhrefWithUrl('$0', 'mailto:$0'), (isset($GLOBALS['MOBILE']) ? 'http$3://$4$5' : _HtagAhrefOutsideUrl('http$3://$4$5', 'http$3://$4$5')), // _HtagAhrefOutsideUrl('ftp$3://$4$5', 'ftp$3://$4$5'), ); // // MyPage // if ($GLOBALS['S']['uid']) { // $GLOBALS['STRING_REPLACE_PATTERN'][] = 'MyPage'; // $GLOBALS['STRING_REPLACE_REPLACE'][] = _HtagAhref('MyPage', 'user', 'who', array('uid' => $GLOBALS['S']['uid'])); // } // スマイリー if (isset($GLOBALS['MOBILE'])) { _MobileSetSmileyHtag(); } else { _ImageSetSmileyHtag(); } $keys = array_keys($GLOBALS['IMAGE_SMILEY']); $ksize = sizeof($keys); for ($i = 0; $i < $ksize; ++$i) { $GLOBALS['STRING_REPLACE_PATTERN'][] = $keys[$i]; $GLOBALS['STRING_REPLACE_REPLACE'][] = $GLOBALS['IMAGE_SMILEY'][$keys[$i]]; } // 検索文字列(余計なものまで変換されてしまうが...) if (isset($_REQUEST['query']) && empty($GLOBALS['MOBILE'])) { $queries = explode(' ', urldecode($_REQUEST['query'])); $array_size = sizeof($queries); for ($i = 0; $i < $array_size; ++$i) { $GLOBALS['STRING_REPLACE_PATTERN'][] = $queries[$i]; $GLOBALS['STRING_REPLACE_REPLACE'][] = '' . $queries[$i] . ''; } } // 情報源 … サーバーへの負荷状況によって使用するかどうかを決める if (empty($GLOBALS['S']['op_nokeyword']) && empty($GLOBALS['MOBILE'])) { // $file = _InfoCreateKeywordFilePath(); // if (is_file($file)) { // include($file); $keys = array( // デフォルトキーワードから、さらに絞り込む '夜泣き' => '001001001d11', '疳の虫' => '001001001d12', '微熱' => '001001005d04', '脱水症状' => '001001005d06', '喘息' => '001001005d08', 'ぜんそく' => '001001005d08', '骨盤' => '001001005d17', '悪寒' => '001001005d02', '足湯' => '001001005d01', '脚湯' => '001001005d01', '経過' => '001001006d01', 'プラセボ' => '001001006d04', 'プラシーボ' => '001001006d04', '気功' => '001001006d07', '整体' => '001001006d06', '体質' => '001001006d09', ); $kkeys = array_keys($keys); $kksize = sizeof($kkeys); for ($i = 0; $i < $kksize; ++$i) { $GLOBALS['STRING_REPLACE_PATTERN'][] = $kkeys[$i]; $GLOBALS['STRING_REPLACE_REPLACE'][] = _HtagAhref('' . $kkeys[$i] . '', 'info', 'view', array('infono' => $keys[$kkeys[$i]])); } $keys = array( // 病気 'インフルエンザ' => '004002', 'BCG' => '004003', 'DPT' => '004004', '三種混合' => '004004', 'ジフテリア' => '004004', '破傷風' => '004005', '百日咳' => '004006', 'ポリオ' => '004007', '麻疹' => '004008', 'はしか' => '004008', 'ハシカ' => '004008', '風疹' => '004009', 'おたふく風邪' => '004010', '水疱瘡' => '004011', '水ぼうそう' => '004011', 'みずぼうそう' => '004011', '日本脳炎' => '004012', '突発性発疹' => '004017', '感染性胃腸炎' => '004030', '嘔吐下痢症' => '004030', '手足口病' => '004018', 'プール熱' => '004019', 'ヘルパンギーナ' => '004020', '溶連菌' => '004021', 'りんご病' => '004022', 'マイコプラズマ' => '004024', '髄膜炎' => '004025', '水いぼ' => '004027', 'みずいぼ' => '004027', 'とびひ' => '004028', 'ホメオパシー' => '001002', 'フラワーエッセンス' => '001003', ); $kkeys = array_keys($keys); $kksize = sizeof($kkeys); for ($i = 0; $i < $kksize; ++$i) { $GLOBALS['STRING_REPLACE_PATTERN'][] = $kkeys[$i]; $GLOBALS['STRING_REPLACE_REPLACE'][] = _HtagAhref('' . $kkeys[$i] . '', 'info', 'dview', array('open' => $keys[$kkeys[$i]])); } // } } // 前橋レポート $GLOBALS['STRING_REPLACE_PATTERN'][] = '前橋レポート'; $GLOBALS['STRING_REPLACE_REPLACE'][] = _HtagAhref('前橋レポート', 'maebashi', ''); } $str = preg_replace($GLOBALS['STRING_PREG_PATTERN'], $GLOBALS['STRING_PREG_REPLACE'], $str); $str = str_replace($GLOBALS['STRING_REPLACE_PATTERN'], $GLOBALS['STRING_REPLACE_REPLACE'], $str); if ($GLOBALS['HOST'] != 'sakura' && empty($GLOBALS['MOBILE']) && empty($GLOBALS['MATU_ON_THE_JOB'])) { $str = '' . $str . ''; } return($str); } function _ImageSetSmileyHtag() { if (empty($GLOBALS['IMAGE_SMILEY'])) { $smiley = _ImageGetSmileyList(); $keys = array_keys($smiley); $ksize = sizeof($keys); for ($i = 0; $i < $ksize; ++$i) { $GLOBALS['IMAGE_SMILEY'][$keys[$i]] = _HtagImage($smiley[$keys[$i]], 12, 12, $keys[$i], 0); } } } function _MobileSetSmileyHtag() { // http://www.sound-uz.jp/php/tips/mobile.html if (empty($GLOBALS['IMAGE_SMILEY'])) { if ($GLOBALS['MOBILE'] == 'i-mode') { $GLOBALS['IMAGE_SMILEY'] = array( '(笑)' => '', // 'image/smiley/happy.gif', '(^o^)' => '捻', // 'image/smiley/grinning.gif', '(^_^)' => '璉', // 'image/smiley/yukky.gif', '(^_-)' => '裂', // 'image/smiley/winking.gif', '(^-^)' => '鍊', // 'image/smiley/goofy.gif', '(^.^)' => '秊', // 'image/smiley/nyah.gif', '(爆)' => '念', // 'image/smiley/devilish.gif', '(^^)' => '秊', // 'image/smiley/straight.gif', ':-P' => '', // 'image/smiley/talking.gif', '(*o*)' => '囹', // 'image/smiley/startled.gif', '(泣)' => '蓮', // 'image/smiley/koed.gif', '(TT)' => '聯', // 'image/smiley/sad.gif', '(怒)' => '說', // 'image/smiley/angry.gif', ); } elseif ($GLOBALS['MOBILE'] == 'j-sky') { $GLOBALS['IMAGE_SMILEY'] = array( '(笑)' => "\x1B\$GB\x0F", '(^o^)' => "\x1B\$Gw\x0F", '(^_^)' => "\x1B\$Gv\x0F", '(^_-)' => "\x1B\$E&\x0F", '(^-^)' => "\x1B\$Gv\x0F", '(^.^)' => "\x1B\$Gv\x0F", '(爆)' => "\x1B\$E7\x0F", '(^^)' => "\x1B\$G1\x0F", ':-P' => "\x1B\$E%\x0F", '(*o*)' => "\x1B\$GA\x0F", '(泣)' => "\x1B\$E(\x0F", '(TT)' => "\x1B\$Gx\x0F", '(怒)' => "\x1B\$Gy\x0F", ); } elseif ($GLOBALS['MOBILE'] == 'ezweb') { $GLOBALS['IMAGE_SMILEY'] = array( '(笑)' => '', '(^o^)' => '', '(^_^)' => '', '(^_-)' => '', '(^-^)' => '', '(^.^)' => '', '(爆)' => '', '(^^)' => '', ':-P' => '', '(*o*)' => '', '(泣)' => '', '(TT)' => '', '(怒)' => '', ); } else { $GLOBALS['IMAGE_SMILEY'] = array(); } } } function _HtagHr() { return('
    '); } function _InfoCategoryCreateLine($infono, $relation = '') { $str = 'カテゴリ:'; $str .= _InfoCategoryCreateLinePart('トップ', ''); $GLOBALS['Ht'] = '情報源'; if ($infono) { include(_InfoCreateDirListFilePath()); if (empty($all_dirs[$infono])) { _Error('指定されたカテゴリは見つかりませんでした。'); } $dir_str = explode('>', $all_dirs[$infono]['name']); $max = strlen($infono); $p = 3; $i = 0; while ($p <= $max) { $GLOBALS['Ht'] .= '>' . _StringNP($dir_str[$i]); $tmpno = substr($infono, 0, $p); $name = '' . _StringNP($dir_str[$i]) . ''; $str .= '>'; $str .= _InfoCategoryCreateLinePart($name, $tmpno); $p += 3; ++$i; } // 関連情報 if ($relation) { $relation_str = _RelationCreateTable('i' . $infono); if ($relation_str) { // ほんのちょっとスペースを空けるため $str .= '

    '; // テーブルを作成(左側にスペースを作る) $str .= ''; $str .= ''; $str .= '
        '; $str .= $relation_str; $str .= '
    '; } } } return($str); } function _InfoCategoryCreateLinePart($name, $infono) { $name = '' . $name . ''; return(_HtagAhref($name, $_REQUEST['D'], 'dview', array('open' => $infono))); } function _RelationCreateTable($this) { $array = _RelationSearch($this); $keys = array_keys($array); $ksize = sizeof($keys); if ($ksize == 0) { return(''); } // リンクに置き換える for ($i = 0; $i < $ksize; ++$i) { $type = $keys[$i]{0}; $no = substr($keys[$i], 1); $name = $array[$keys[$i]]; $array[$keys[$i]] = _RelationCreateLink($type, $no, $name); } $table = ''; $table .= '
    '; $table .= ''; $table .= ''; $table .= ''; $table .= ''; $table .= '
    '; $table .= ''; $table .= ' 関連情報 '; $table .= ''; $table .= ' '; $table .= implode(',', array_values($array)); $table .= ' 
    '; $table .= '
    '; return($table); } function _RelationSearch($this) { $r = array( '予防接種全般' => array( 'b515101' => '病気全般', 'b51515149' => '予防接種全般(副作用)', 'i004013' => '予防接種全般', 'i004014' => '病気全般', ), '薬' => array( 'b51515351' => 'くすり', 'i004001' => 'くすり', 'i001001' => 'こんなときのノウハウ', 'i001002' => 'ホメオパシー', 'i001003' => 'フラワーエッセンス', ), 'インフルエンザ' => array( 'm000' => '前橋レポート', 'b51515101' => 'インフルエンザ', 'i004002' => 'インフルエンザ', 'n11' => 'インフルエンザ', 'e001' => 'インフルエンザ', 'e101' => 'タミフル', ), '結核・BCG' => array( 'b51515102' => '結核・BCG', 'i004003' => '結核・BCG', 'e002' => 'BCG', ), '二種・三種混合' => array( 'b51515103' => '二種・三種混合', 'i004004' => '二種・三種混合', 'e003' => '三種混合', 'e004' => '二種混合', ), '破傷風' => array( 'b51515103' => '二種・三種混合', 'b51515104' => '破傷風', 'i004004' => '二種・三種混合', 'i004005' => '破傷風', 'e005' => '破傷風', ), '百日咳' => array( 'b51515103' => '二種・三種混合', 'b51515105' => '百日咳', 'i004004' => '二種・三種混合', 'i004006' => '百日咳', 'n24' => '百日咳', 'e003' => '三種混合', ), 'ポリオ' => array( 'b51515106' => 'ポリオ', 'i004007' => 'ポリオ', 'e006' => 'ポリオ', ), '麻疹(はしか)' => array( 'b51515107' => '麻疹', 'b51515121' => '麻疹・風疹混合', 'i004008' => '麻疹', // 'n20' => '麻疹', 'e007' => '麻疹', ), '風疹' => array( 'b51515108' => '風疹', 'b51515121' => '麻疹・風疹混合', 'i004009' => '風疹', // 'n22' => '風疹', 'e008' => '風疹', ), 'おたふく風邪' => array( 'b51515109' => 'おたふく風邪', 'i004010' => 'おたふく風邪', 'n23' => 'おたふく風邪', 'e010' => 'おたふく風邪', ), '水疱瘡(水ぼうそう)' => array( 'b51515110' => '水ぼうそう', 'i004011' => '水ぼうそう', 'n21' => '水ぼうそう', 'e009' => '水ぼうそう', ), '日本脳炎' => array( 'b51515111' => '日本脳炎', 'i004012' => '日本脳炎', // 'n25' => '日本脳炎', 'e011' => '日本脳炎', ), '風邪' => array( 'b51515113' => '風邪', 'i004016' => '風邪', 'n10' => '風邪', ), '突発性発疹' => array( 'i004017' => '突発性発疹', 'n12' => '突発性発疹', ), '感染性胃腸炎(嘔吐下痢症)' => array( 'b51515204' => '嘔吐', 'b51515203' => '下痢', 'i004030' => '嘔吐下痢症', 'n13' => '嘔吐下痢症', ), '手足口病' => array( 'i004018' => '手足口病', 'n14' => '手足口病', ), '咽頭結膜熱(プール熱)' => array( 'i004019' => 'プール熱', 'n15' => 'プール熱', ), 'ヘルパンギーナ' => array( 'i004020' => 'ヘルパンギーナ', 'n16' => 'ヘルパンギーナ', ), '溶連菌感染症' => array( 'b51515116' => '溶連菌感染症', 'i004021' => '溶連菌感染症', 'n26' => '溶連菌感染症', ), '伝染性紅斑(りんご病)' => array( 'i004022' => 'りんご病', 'n27' => 'りんご病', ), '伝染性単核症' => array( 'i004023' => '伝染性単核症', // 'n28' => '伝染性単核症', ), 'クループ' => array( 'b51515117' => 'クループ', 'i004031' => 'クループ', 'n33' => 'クループ', ), 'マイコプラズマ肺炎' => array( 'b51515202' => '咳', 'i004024' => 'マイコプラズマ肺炎', 'n40' => 'マイコプラズマ肺炎', // 'n41' => 'ウイルス性肺炎', 'n42' => '細菌性肺炎', ), 'かぶれ' => array( 'i004026' => 'かぶれ', // 'n72' => 'かぶれ', ), '水いぼ(伝染性軟属腫)' => array( 'b51515115' => '水いぼ', 'i004027' => '水いぼ', 'n73' => '水いぼ', ), 'とびひ(伝染性膿痂疹)' => array( 'b51515114' => 'とびひ', 'i004028' => 'とびひ', 'n74' => 'とびひ', ), '虫さされ(小児ストロフルス)' => array( 'i004029' => '虫さされ', 'n75' => '虫さされ', ), // 'アトピー' => array( // 'b51515223' => 'アトピー', // 'i004032' => 'アトピー', // ), // '花粉症' => array( // 'b51515226' => '花粉症', // 'i004033' => '花粉症', // ), ); $keys = array_keys($r); $ksize = sizeof($keys); $found = array(); for ($i = 0; $i < $ksize; ++$i) { if (isset($r[$keys[$i]][$this])) { $found = array_merge($found, $r[$keys[$i]]); } } unset($found[$this]); // 自分自身は除外する ksort($found); return($found); } function _RelationCreateLink($type, $no, $name) { $link = ''; switch ($type) { case 'b' : $link = _RelationCreateLinkBbs($no, $name); break; case 'n' : $link = _RelationCreateLinkNurse($no, $name); break; case 'i' : $link = _RelationCreateLinkInfo($no, $name); break; case 'e' : $link = _RelationCreateLinkEffect($no, $name); break; case 'm' : $link = _HtagAhref('' . $name . '', 'maebashi', ''); break; } // if ($link) { // $link = '' . $link . ''; // } return($link); } function _RelationCreateLinkInfo($infono, $name) { // $name = $GLOBALS['IMAGE_FILE_INFO'] . $name; if (isset($GLOBALS['RELATION_CATEGORY_INFO'])) { $prefix = ''; } else { $prefix = '情報源-'; $GLOBALS['RELATION_CATEGORY_INFO'] = 1; } return($prefix . _HtagAhref($name, 'info', 'dview', array('open' => $infono))); } function _RelationCreateLinkEffect($no, $name) { // $name = $GLOBALS['IMAGE_FILE_INFO'] . $name; if (isset($GLOBALS['RELATION_CATEGORY_EFFECT'])) { $prefix = ''; } else { $prefix = '副作用-'; $GLOBALS['RELATION_CATEGORY_EFFECT'] = 1; } return($prefix . _HtagAhref($name, 'effect', 'view', array('no' => $no))); } function _RelationCreateLinkBbs($bbsno, $name) { // $name = $GLOBALS['IMAGE_FILE_BBS'] . $name; if (isset($GLOBALS['RELATION_CATEGORY_BBS'])) { $prefix = ''; } else { $prefix = '掲示板-'; $GLOBALS['RELATION_CATEGORY_BBS'] = 1; } return($prefix . _HtagAhref($name, 'bbs', 'dview', array('bbsno' => $bbsno))); } function _RelationCreateLinkNurse($type, $name) { // $name = $GLOBALS['IMAGE_FILE_NURSE'] . $name; if (isset($GLOBALS['RELATION_CATEGORY_NURSE'])) { $prefix = ''; } else { $prefix = '看病記録-'; $GLOBALS['RELATION_CATEGORY_NURSE'] = 1; } return($prefix . _HtagAhref($name, 'nurse', 'type', array('no' => $type))); } function _InfoCreateDirListFilePath() { return(D_DATA_DIR_INFO . '/dirlist' . $GLOBALS['LOG_EXT']); } function _AmazonCreateInfo($asin) { // $url = 'http://www.amazon.co.jp/exec/obidos/ASIN/' . $asin . '/' . $GLOBALS['AMAZON_ASSOCIATE_ID']; // $url = 'http://www.amazon.co.jp/exec/obidos/redirect?path=ASIN/' . $asin . '&link_code=as2&camp=247&tag=' . $GLOBALS['AMAZON_ASSOCIATE_ID'] . '&creative=1211'; if ($GLOBALS['ROBOT']) { $url = _AmazonCreateLink($asin); } else { $url = _AmazonCreateLink($asin); // $url = _HtagCreateUrl('index', 'amazon', array('asin' => $asin)); } $array = _AmazonGetDatabase($asin); $str = ''; if (sizeof($array) > 0) { $str .= '
    '; $str .= ''; $str .= ''; $str .= ''; $str .= '
    '; $str .= 'amazon.co.jp のデータベースから…'; $str .= _HtagHr(); $str .= ''; $str .= _HtagAhrefOutsideUrl($GLOBALS['IMAGE_AMAZON'], $url); $str .= '
    '; $str .= '
    '; $str .= ''; $str .= ''; $str .= '
    '; if (isset($array['IMAGEURLMEDIUM'])) { $str .= _HtagAhrefOutsideUrl('Amazonサイトへ', $url); } $str .= ''; $str .= ''; $str .= _AmazonCreateInfoBasicLine('書名', $array['PRODUCTNAME']); $str .= _AmazonCreateInfoBasicLine('著者', $array['AUTHOR']); $str .= _AmazonCreateInfoBasicLine('出版社', $array['MANUFACTURER']); if (isset($array['RELEASEDATE'])) { $str .= _AmazonCreateInfoBasicLine('発売日', $array['RELEASEDATE']); } $str .= _AmazonCreateInfoBasicLine('形式', $array['MEDIA']); $str .= _AmazonCreateInfoBasicLine('価格', $array['LISTPRICE']); $str .= _AmazonCreateInfoBasicLine('ISBN', $array['ISBN']); if (isset($array['RATING'])) { $rating = (int)$array['RATING']; if ($rating) { $rating_mark = ''; while ($rating) { $rating_mark .= $GLOBALS['IMAGE_HEART_SYMP_2']; --$rating; } $str .= _AmazonCreateInfoBasicLine('おすすめ度', $rating_mark); } } if (isset($array['AVAILABILITY'])) { $str .= _AmazonCreateInfoBasicLine('注文すれば', $array['AVAILABILITY'] . '(' . _HtagAhrefOutsideUrl('購入する', $url) . ')'); } $str .= '
    '; $str .= '
    '; $str .= '

    '; $customer_max = (isset($array['CUSTOMER_REVIEW']) ? sizeof($array['CUSTOMER_REVIEW']) : 0); for ($i = 0; $i < $customer_max; ++$i) { $customer_rating_mark = ''; while ($array['CUSTOMER_RATING'][$i]) { $customer_rating_mark .= $GLOBALS['IMAGE_HEART_SYMP_2']; --$array['CUSTOMER_RATING'][$i]; } $str .= $customer_rating_mark; $str .= ' '; $str .= $array['CUSTOMER_SUMMARY'][$i]; $str .= '
    '; $str .= $array['CUSTOMER_REVIEW'][$i]; $str .= '

    '; } // } else { // $GLOBALS['Bc'] .= '見つかりませんでした'; } return($str); } function _AmazonCreateInfoBasicLine($title, $str) { if ($str != '') { return('' . $title . '' . $str . ''); } else { return(''); } } function _AmazonCreateLink($asin) { return('http://www.amazon.co.jp/exec/obidos/redirect?path=ASIN/' . $asin . '&link_code=as2&camp=247&tag=' . $GLOBALS['AMAZON_ASSOCIATE_ID'] . '&creative=1211'); } function _AmazonGetDatabase($asin) { $url = _AmazonAddSignature('http://ecs.amazonaws.jp/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=' . $GLOBALS['AMAZON_ACCESS_KEY_ID'] . '&Operation=ItemLookup&Version=2007-01-15&AssociateTag=' . $GLOBALS['AMAZON_ASSOCIATE_ID'] . '&ItemId=' . $asin . '&ResponseGroup=Large'); // $url = 'http://xml.amazon.co.jp/onca/xml3?t=webservices-20&dev-t=' . $GLOBALS['AMAZON_DEVELOPMENT_ID'] . '&type=heavy&f=xml&AsinSearch=' . $asin . '&locale=jp'; // ECS 3.0(旧) $amazon_result = file_get_contents($url); if (! $amazon_result) { return(array()); } $tags = simplexml_load_string($amazon_result); // var_dump($tags); exit; if ($tags->Items->Request->IsValid == 'True') { $array = _AmazonGetDatabaseParseDetail($tags->Items->Item); if (empty($array['IMAGEURLMEDIUM'])) { $url = _AmazonAddSignature('http://ecs.amazonaws.jp/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=' . $GLOBALS['AMAZON_ACCESS_KEY_ID'] . '&Operation=ItemLookup&Version=2007-01-15&AssociateTag=' . $GLOBALS['AMAZON_ASSOCIATE_ID'] . '&ItemId=' . $asin . '&ResponseGroup=Images'); $amazon_result = file_get_contents($url); if ($amazon_result) { $tags = simplexml_load_string($amazon_result); $array = array_merge($array, _AmazonGetDatabaseParseDetail($tags->Items->Item)); } } return($array); } else { return(array()); } } function _AmazonAddSignature($url){ // "Your Secret Access Key" $secret_key = $GLOBALS['AMAZON_SECRET_ACCESS_KEY']; $ret_char = "\n"; // リクエストURLを分解する $url_array = parse_url($url); // クエリ部分を分解する parse_str($url_array["query"], $param_array); // タイムスタンプを加える $param_array["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z"); // 昇順ソート ksort($param_array); // RFC 3986にエンコード $str = "GET".$ret_char.$url_array["host"].$ret_char.$url_array["path"].$ret_char; $str_param = ""; while( list($key, $value) = each($param_array) ){ $str_param = $str_param.strtr($key, "_", ".")."=".rawurlencode($value)."&"; } $str = $str.substr($str_param, 0, strlen($str_param)-1); $signature = base64_encode( hash_hmac("sha256", $str, $secret_key, true) ); $url_sig = "http://".$url_array["host"].$url_array["path"]."?". $str_param."Signature=".rawurlencode($signature); return $url_sig; } function _AmazonGetDatabaseParseDetail($tags) { $result = array( // 'CUSTOMER_REVIEW' => array(), // 'CUSTOMER_SUMMARY' => array(), // 'CUSTOMER_RATING' => array(), ); if (isset($tags->ItemAttributes->Author)) { if (is_array($tags->ItemAttributes->Author)) { $result['AUTHOR'] = _AmazonGetDatabaseEncoding(implode(',', $tags->ItemAttributes->Author)); } else { $result['AUTHOR'] = _AmazonGetDatabaseEncoding($tags->ItemAttributes->Author); } } if (isset($tags->ItemAttributes->Title)) { $result['PRODUCTNAME'] = _AmazonGetDatabaseEncoding($tags->ItemAttributes->Title); } if (isset($tags->ItemAttributes->Manufacturer)) { $result['MANUFACTURER'] = _AmazonGetDatabaseEncoding($tags->ItemAttributes->Manufacturer); } if (isset($tags->ItemAttributes->PublicationDate)) { $result['RELEASEDATE'] = str_replace('-', '/', _AmazonGetDatabaseEncoding($tags->ItemAttributes->PublicationDate)); } if (isset($tags->ItemAttributes->ListPrice->FormattedPrice)) { $result['LISTPRICE'] = _AmazonGetDatabaseEncoding($tags->ItemAttributes->ListPrice->FormattedPrice); if (isset($tags->OfferSummary->LowestUsedPrice->FormattedPrice)) { $result['LISTPRICE'] .= ' (ユーズド:' . _AmazonGetDatabaseEncoding($tags->OfferSummary->LowestUsedPrice->FormattedPrice) . ' より)'; } } if (isset($tags->Offers->Offer->OfferListing->Availability)) { $result['AVAILABILITY'] = _AmazonGetDatabaseEncoding($tags->Offers->Offer->OfferListing->Availability); } if (isset($tags->ItemAttributes->Binding)) { $result['MEDIA'] = _AmazonGetDatabaseEncoding($tags->ItemAttributes->Binding); if (isset($tags->ItemAttributes->NumberOfPages)) { $result['MEDIA'] .= ' ' . $tags->ItemAttributes->NumberOfPages . 'ページ'; } } if (isset($tags->CustomerReviews->AverageRating)) { $result['RATING'] = $tags->CustomerReviews->AverageRating; } if (isset($tags->ItemAttributes->ISBN)) { $result['ISBN'] = $tags->ItemAttributes->ISBN; } if (isset($tags->CustomerReviews->TotalReviews)) { $size = $tags->CustomerReviews->TotalReviews; if ($size > 0) { for ($i = 0; $i < $size; ++$i) { // var_dump($tags->CustomerReviews->Review[$i]); exit; if (isset($tags->CustomerReviews->Review[$i]->Content)) { $result['CUSTOMER_REVIEW'][] = _AmazonGetDatabaseEncoding($tags->CustomerReviews->Review[$i]->Content); $result['CUSTOMER_SUMMARY'][] = _AmazonGetDatabaseEncoding($tags->CustomerReviews->Review[$i]->Summary); $result['CUSTOMER_RATING'][] = _AmazonGetDatabaseEncoding($tags->CustomerReviews->Review[$i]->Rating); } } } } if (isset($tags->ImageSets->ImageSet->MediumImage->URL)) { $result['IMAGEURLMEDIUM'] = _AmazonGetDatabaseEncoding($tags->ImageSets->ImageSet->MediumImage->URL); } // var_dump($result); return($result); } function _AmazonGetDatabaseEncoding($str) { return(mb_convert_encoding($str, 'EUC-JP', 'UTF-8')); } function _AttachedFileCreateHtmlLink($file, $position, $width = '', $height = '') { switch ($position) { case 1 : $align = 'left'; break; case 2 : $align = 'center'; break; case 3 : $align = 'right'; break; } $ext = substr($file, strrpos($file, '.')); $str = '
    '; // 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)); } ?>