TeamJapan/ja:include/agentdetect start.inc

From Camino Wiki
Jump to navigation Jump to search

<?php // All you need to change when a new release comes out is this next line! Wahoo! $latest = '1.0b2'; $latestML = '0.8.4';

// $latest is used for the download links.

$messages = array( 'LatestRelease' => "最新版のCamino $latestをお使いのようですね。 最新版を使っていれば、重要なセキュリティアップデートが施されています。
質問ですか?  コメントですか?  ぜひ<a href=¥"/contact/¥">フィードバック</a>をお寄せください。", 'LatestML' => "Camino $latestMLあるいは国際版のCamino $latestMLをお使いのようですね。 Camino $latestMLの英語版はCaminoプロジェクトによるサポートが終了していますので、英語版をお使いの皆さんは最新版のCamino $latestをダウンロードしてください。 ただし、$latestの国際版はまだ準備ができていないので、国際版のCamino $latestMLのサポートは継続しています。 ", 'OldNightly' => "数週間前のナイトリービルドをお使いのようですね。 バグなどの報告の前には<a href=¥"/download/releases/nightly/¥">最新のナイトリービルドをダウンロード</a>してください。 ナイトリー版が不安定だと感じる場合は、最新安定板である<a href=¥"/download/releases/$latest/¥">Camino $latest</a>(または<a href=¥"/download/releases/$latestML-MultiLang/¥">$latestML国際版</a>)をダウンロードしてみてはいかがでしょうか。", 'MacIE' => "Internet Explorer for Macをお使いのようですね。このブラウザは2001年以来アップデートされていません。 2006年のMacに向けて開発されたブラウザの最新機能をお楽しみください。<a href=¥"/¥">Camino $latest</a>をダウンロードしてみましょう。", 'NewNightly' => "最近のナイトリービルドをお使いのようですね。 Please <a href=¥"https://bugzilla.mozilla.org/enter_bug.cgi?

質問ですか?  コメントですか?  ぜひ<a href=¥"/contact/¥">フィードバック</a>をお寄せください。", 'Default' => "<a href=¥"/¥">Camino $latest</a>が公開されています。 このバージョンへアップデートしてください。 重要なセキュリティ修正など、さまざまな修正が施されています。 <a href=¥"/releases/$latest.php¥">もっと詳しく...</a>" );

$alerts = array( 'alert' => " class=¥"alert¥"", 'no_alert' => "" );

function message($message, $alert, $notify = false) {

   print "<h6";
   print $alert;
   print ">";
   if ($notify)
       print "<img src=¥"/images/notification.png¥" alt=¥"Alert¥" width=¥"32¥" height=¥"32¥" hspace=¥"3¥" align=¥"right¥" />";
   print $message;

print "";

}

function displayAppropriateMessage() { global $messages; global $latest; global $latestPre; global $latestPreBuild; global $latestML;

if (isMacIE()) message($messages['MacIE'], $alerts['alert'], true); elseif (isCamino()) { $release = getCaminoRelease(); $build = getCaminoBuild();

if ($release == $latest) { message($messages['LatestRelease'], $alerts['no_alert'], false); } else if ($release == $latestML) { message($messages['LatestML'], $alerts['alert'], false); } else if ($release == $latestPre && $build == $latestPreBuild) { message($messages['LatestPre'], false); } else { $nightlyBuildAge = getCaminoNightlyBuildAge();

if ($nightlyBuildAge !== null && $nightlyBuildAge < 31) message($messages['NewNightly'], $alerts['no_alert'], false); else message($messages['OldNightly'], $alerts['alert'], true); } } else

     	message($messages['Default'], $alerts['alert'], true);

}

function isCamino() { return preg_match('#^Mozilla/5¥.0.+Camino/.+$#', $_SERVER['HTTP_USER_AGENT']); }

function isMacIE() { return preg_match('#^Mozilla/4.0.+MSIE.+Mac_PowerPC#', $_SERVER['HTTP_USER_AGENT']); }

function getCaminoNightlyBuildAge() { if (preg_match('#^Mozilla/5¥.0.+Gecko/(2¥d{3})(¥d{2})(¥d{2}) Camino/[¥w.+]+$#', $_SERVER['HTTP_USER_AGENT'], $matches)) { $buildDate = mktime(0, 0, 0, $matches[2], $matches[3], $matches[1]); return (time() - $buildDate) / (24 * 3600);

   }
   
   return null;

}

function getCaminoRelease() { if (preg_match('#^Mozilla/5¥.0.+Gecko/¥d+ Camino/(.+)$#', $_SERVER['HTTP_USER_AGENT'], $matches)) return $matches[1];

return null; }

function getCaminoBuild() { if (preg_match('#^Mozilla/5¥.0.+Gecko/(¥d+) Camino/.+$#', $_SERVER['HTTP_USER_AGENT'], $matches)) return $matches[1];

return null; }