<![CDATA[ Encryption 1.0.2 を使ってみました - My Forums]]> https://forums.modx.com/thread/?thread=56374 <![CDATA[Encryption 1.0.2 &#12434;&#20351;&#12387;&#12390;&#12415;&#12414;&#12375;&#12383;&#12288;&#20849;&#26377;SSL&#65288;coreserver &#12398;&#22580;&#21512;&#65289;]]> https://forums.modx.com/thread/56374/encryption-1-0-2#dis-post-330820 (A)Encryption スニペットより以下の4箇所を変更します。

// CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::

// secure location of modx installation - no trailing slash
$secureserver = "https://ss1.coressl.jp/xxx.s78.coreserver.jp"; //(1) 最後に / を入れてはいけない。 共有SSLのアドレス+ホスト名

// unsecure location of modx installation - no trailing slash
$unsecureserver = "http://xxx.s78.coreserver.jp/modx"; //(2) 最後に / を入れてはいけない。 modx のルートフォルダまで指定

// END OF CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::

               ・
               ・
               ・
// if SSL off and we are about to access a secure page then redirect
if( !isset($_SERVER[’HTTP_VIA’]) && $encryption) { //(3)
$modx->sendRedirect($secureserver.$url);
}

// if SSL is on and we are about to acccess an unsecure page then redirect
else if ( isset($_SERVER[’HTTP_VIA’]) && !$encryption) { //(4)
$modx->sendRedirect($unsecureserver.$url);
}

return "";
?>

(B) config.inc.php を4ヶ所変更します
 coreserver では環境変数 SERVER_HTTPS が取得できないので HTTP_VIA に変更。
 https:// の後に共有SSLサーバーのアドレスを指定します。

 $base_url の行は好みに応じて追加してください。これは Wayfinder などのメニューリンクに影響してきます。

// assign site_url
$site_url= (isset ($_SERVER[’HTTP_VIA’])) ? ’https://ss1.coressl.jp/’ : ’http://’; //(1)
$site_url .= $_SERVER[’HTTP_HOST’];
// (2)サーバーポートが判断できないので不要、コメントアウトする。残しておいても無害
// if ($_SERVER[’SERVER_PORT’] != 80)
$site_url= str_replace(’:’ . $_SERVER[’SERVER_PORT’], ’’, $site_url);
// remove port from HTTP_HOST
// (3) SERVER_PORT の代わりに HTTP_VIA から ポート番号を取得できるようだが面倒なのでで削除またはコメントアウト
// $site_url .= ($_SERVER[’SERVER_PORT’] == 80 || (isset ($_SERVER[’HTTPS’]) && strtolower($_SERVER[’HTTPS’]) == ’on’) || $_SERVER[’SERVER_PORT’] == $https_port) ? ’’ : ’:’ . $_SERVER[’SERVER_PORT’];
$site_url .= $base_url;
$base_url = ’http://’.$_SERVER[’HTTP_HOST’].$base_url; //(4)

(C)テンプレート変数の作成方法、その他は専用SSL の手順と同じです。]]>
dainiti Jan 28, 2009, 08:38 PM https://forums.modx.com/thread/56374/encryption-1-0-2#dis-post-330820
<![CDATA[Encryption 1.0.2 &#12434;&#20351;&#12387;&#12390;&#12415;&#12414;&#12375;&#12383;]]> https://forums.modx.com/thread/56374/encryption-1-0-2#dis-post-330819 modx 0.9.6.3
Encryption 1.0.2
専用SSL
Joe’s レンタルサーバー

まずはこちらから Encryption_1.0.2.txt をダウンロードします。 http://www.modxcms.com/Encryption-1229.html

このスニペットは専用SSL および共有SSL で利用できます。実行時の注意点として暗号化を利用するページは「キャッシュを生成」のチェックははずしておきます。

専用SSL の場合は案外あっさりと設定できました。共有SSL の coreserver の場合はいまだに現在格闘中です。あとで泣きついた時にはよろしくお願いします。
Encryption を使った場合でも base_url の問題は別に解決する必要があります。また専用SSL を使った場合には eForm の画像認証へのリンクが https:// になっているようで問題ないようです。

Installation

1. Copy the text file into a new snippet called "Encryption".
 ダウンロードが完了したらテキスト内容をスニペットに貼り付け Encryption という名前で保存します。

2. Edit the $secureserver parameter to match the location of your site when it is encrypted. For example https://www.hostingco.com/~foo.
 SSLでアクセスするサーバーのアドレスを指定します。
 最後の / は不要です。
 $secureserver = "https://www.example.com" と入力。

3. Edit the $unsecureserver parameter to match the location of your site when it is not encrypted. For example http://www.foo.com.
 http:// でアクセスするサーバーのアドレスを modx のルートディレクトリまで含めて指定します。
 最後の / は不要です。
 $unsecureserver = "http://www.example.com/modx

Using a Template Variable

1. Create a template variable called "encryption" that is a checkbox. The "input option values" should be "On" (capital O) or 1. The default value should be "Off" or 0.
 テンプレート変数を作成します。

 変数名:encryption
 入力タイプ:Check Box
 入力時のオプション値:「ページを暗号化する場合にはチェックしてください」とかなんとか
 既定値:0

2. Add the template variable to templates.
 暗号化を利用したいテンプレートを選択しチェックして、テンプレート変数の設定を保存します。

3. At the top of each template add the call to the snippet. For example:
 使用したいテンプレートの先頭にスニペットの呼び出しを記入します。
[[Encryption]]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


4. Edit the documents to be encrypted and check the encryption checkbox.
 暗号化したいドキュメントを編集し、暗号化のチェックボックスをチェックしてください。

Friendly URLs
 htaccess の設定変更は特に必要ありません。あってもなくても動作に違いはないようです。

次回、共有SSL が設定できればあらためて報告いたします。]]>
dainiti Jan 28, 2009, 08:08 AM https://forums.modx.com/thread/56374/encryption-1-0-2#dis-post-330819