OSDN Git Service

携帯関係のウィジェット、テンプレートを削除。
[magic3/magic3.git] / include / manager / envManager.php
1 <?php
2 /**
3  * 環境取得用マネージャー
4  *
5  * PHP versions 5
6  *
7  * LICENSE: This source file is licensed under the terms of the GNU General Public License.
8  *
9  * @package    Magic3 Framework
10  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11  * @copyright  Copyright 2006-2018 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id$
14  * @link       http://www.magic3.org
15  */
16 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/version.php');   // システムバージョンクラス
17 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/userInfo.php');          // ユーザ情報クラス
18 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/core.php');
19
20 class EnvManager extends Core
21 {
22         public  $sysVersion;            // システムバージョンオブジェクト
23         private $currentTemplateId;     // 現在のテンプレートID(ディレクトリ名)
24         private $currentSubTemplateId;  // 現在のサブテンプレートID
25         private $currentTemplateType;   // 現在のテンプレートのタイプ
26         private $currentTemplateGenerator;              // テンプレート作成アプリケーション
27         private $currentTemplateVersion;                // テンプレートバージョン
28         private $currentTemplateCleanType;      // 現在のテンプレートのクリーンタイプ
29         private $currentTemplateUseBootstrap;   // 現在のテンプレートでBootstrapライブラリを使用するかどうか
30         private $currentTemplateInfoRow;                // 現在のテンプレートの情報
31         private $currentRenderType;             // 現在のビュー作成タイプ
32         private $currentWidgetObj;              // 現在実行中のウィジェットオブジェクト
33         private $currentWidgetId;       // 現在作成中のウィジェットId
34         private $currentWidgetConfigId; // 現在作成中のウィジェットの定義ID
35         private $currentIWidgetConfigId;        // 現在作成中のインナーウィジェットの定義ID
36         private $currentIWidgetId;      // 現在作成中のインナーウィジェットId
37         private $currentPageId;         // 現在のページId
38         private $currentPageSubId;      // 現在のページサブId
39         private $currentPageDefSerial;  // 現在処理を行っているページ定義のレコードのシリアル番号
40         private $currentPageDefRec;             // 現在処理中のウィジェットのページ定義レコード
41         private $defaultPageSubId;      // デフォルトのページサブId
42         private $currentPageDeviceType;         // 現在のページの端末タイプ
43         private $currentWidgetHeadTitle;                // 現在作成中のウィジェットのヘッドタイトル文字列
44         private $currentWidgetPrefix;   // 現在作成中のウィジェットのプレフィックス文字列
45         private $currentWidgetTitle;    // 現在作成中のウィジェットのタイトル文字列
46         private $currentWidgetStyle;    // 現在作成中のウィジェットのスタイル文字列
47         private $currentWidgetJoomlaParam;      // 現在作成中のウィジェットのJoomla用パラメータ
48         private $currentWidgetParams = array();         // 現在作成中のウィジェットのその他パラメータ
49         private $isCurrentWidgetShared; // 現在作成中のウィジェットが共通ウィジェットかどうか
50         private $currentDomainRootUrl;  // マルチドメイン運用時の現在のルートURL
51         private $protocolRelativeRootUrl;       // プロトコル省略型のルートURL
52         private $defaultLanguage;       // デフォルト言語(システムで固定)
53         private $currentLanguage;       // 現在の言語(ユーザによって可変)
54         private $defaultLocale;         // デフォルトのロケール
55         private $currentLocale;         // 現在のロケール(ユーザによって可変)
56         private $multiLanguage;         // 多言語対応かどうか
57         private $adminDefaultTheme;     // 管理画面のデフォルトテーマ
58         private $accessPath;            // アクセスポイントパス
59         private $accessDir;                     // アクセスポイントディレクトリ(空文字列=PC用、s=スマートフォン用、m=携帯用)
60         private $db;                            // DBオブジェクト
61         private $canUseDbSession;       // DBセッションが使用できるかどうか
62         private $canUseDb;                      // DBが使用可能状態にあるかどうか
63         private $canUseCookie;          // クッキーが使用可能かどうか
64         private $canChangeLang;         // 言語変更可能かどうか
65         private $useSsl;                        // SSL機能を使用するかどうか
66         private $useSslAdmin;           // 管理画面にSSL機能を使用するかどうか
67         private $sslUrl;                        // SSL用URL
68         private $siteName;                      // サイト名称
69         private $siteOwner;                     // サイト所有者
70         private $siteCopyRight;         // サイトコピーライト
71         private $siteEmail;                     // サイトEメール
72         private $widgetLog;                     // ウィジェット実行ログを残すかどうか
73         private $multiDomain;           // マルチドメイン運用かどうか
74         private $isPcSite;                      // PC用URLアクセスかどうか
75         private $isMobileSite;          // 携帯用URLアクセスかどうか
76         private $isSmartphoneSite;      // スマートフォン用URLへのアクセスかどうか
77         private $isSubWidget;           // サブウィジェットの起動かどうか
78         private $isServerConnector;     // サーバ接続かどうか
79         private $workDir;                       // 作業用ディレクトリ
80         private $userAgent = array();   // アクセス端末の情報
81         private $menuAttr = array();            // メニューの表示属性
82         private $joomlaDocument;                // Joomla!ドキュメント
83         private $joomlaMenuContent;             // Joomla!v1.5用メニューコンテンツ
84         private $joomlaMenuData;                // Joomla!v2.5用メニュー階層データ
85         private $joomlaPageNavData;             // Joomla!v2.5用ページ前後遷移データ
86         private $joomlaPaginationData;  // Joomla!v2.5用ページ番号遷移データ
87         private $joomlaViewData;                // Joomla!ビュー作成用データ
88         private $wpHeadScriptsData;             // WordPressヘッダ部出力データ(Javascript)
89         private $wpComponentPath;               // WordPressコンポーネント生成ファイルパス
90         private $wpWidgetClass;                 // WordPressウィジェットクラス名
91         private $remoteContent = array();                       // リモート表示コンテンツ
92         private $defaultLacaleArray;    // デフォルトのロケール取得用
93         private $selectedMenuItems = array();                           // 現在選択中のメニュー項目
94         const DEFAULT_LOCALE = 'ja_JP';                 // デフォルトロケール
95         const DEFAULT_CSV_DELIM_CODE = 'csv_delim_code';                // デフォルトのCSV区切り文字コード
96         const DEFAULT_CSV_NL_CODE = 'csv_nl_code';              // デフォルトのCSV改行コード
97         const DEFAULT_CSV_FILE_SUFFIX = 'csv_file_suffix';              // デフォルトのCSVファイル拡張子
98         const MULTI_LANGUAGE = 'multi_language';                // 多言語対応かどうか
99         const DEFAULT_THEME_CSS_FILE = 'jquery-ui.custom.css';          // テーマファイル
100         const CONFIG_ID_WORK_DIR = 'work_dir';                  // 作業用ディレクトリ
101         const DEFAULT_PAGE_ID = 'index';                                        // デフォルトのページID
102         const DEFAULT_REGIST_PAGE_ID = 'regist';                // デフォルトの登録機能用ページID
103         const DEFAULT_MOBILE_PAGE_ID = 'm_index';                                       // 携帯用デフォルトのページID
104         const DEFAULT_SMARTPHONE_PAGE_ID = 's_index';                           // スマートフォン用デフォルトのページID
105         const DEFAULT_ADMIN_PAGE_ID = 'admin_index';            // デフォルトの管理機能用ページID
106         const USER_AGENT_TYPE_PC = 'pc';                                        // アクセス端末の種類(PC)
107         const USER_AGENT_TYPE_MOBILE = 'mobile';                        // アクセス端末の種類(携帯)
108         const CF_CSV_DOWNLOAD_ENCODING = 'csv_download_encoding';                       // CSVダウンロードエンコーディング
109         const CF_CSV_UPLOAD_ENCODING = 'csv_upload_encoding';                   // CSVアップロードエンコーディング
110         const CF_USE_SSL = 'use_ssl';           // SSL機能を使用するかどうか
111         const CF_USE_SSL_ADMIN = 'use_ssl_admin';               // 管理画面にSSL機能を使用するかどうか
112         const CF_SSL_URL = 'ssl_root_url';                              // SSL用のルートURL
113         const CF_DEFAULT_LANG = 'default_lang';                 // デフォルト言語
114         const CF_MULTI_DOMAIN = 'multi_domain';                 // マルチドメイン運用かどうか
115         const CF_SITE_SMARTPHONE_URL = 'site_smartphone_url';           // スマートフォン用サイトURL
116         const CF_REALTIME_SERVER_PORT = 'realtime_server_port';         // リアルタイムサーバ用ポート番号
117         const CF_MULTI_DEVICE_ADMIN = 'multi_device_admin';                     // マルチデバイス最適化管理画面
118         const DEFAULT_SITE_NAME = 'サイト名未設定';              // 管理画面用のデフォルトサイト名
119         const DETECT_DEVICE_SCRIPT = '/Mobile-Detect-2.8.26/Mobile_Detect.php';         // デバイス判定用スクリプト
120         
121         /**
122          * コンストラクタ
123          */
124         function __construct()
125         {
126                 // 親クラスを呼び出す
127                 parent::__construct();
128                 
129                 // パラメータエラーチェック
130                 if (strEndsWith(M3_SYSTEM_ROOT_URL, '/')){
131                         $errMsg = '設定の不正: M3_SYSTEM_ROOT_URLの値の最後の「/」を削除してください。ファイル=include/siteDef.php';
132                         $this->gLog->error(__METHOD__, $errMsg);
133                 }
134                         
135                 // データ初期化
136                 $this->accessPath = '';         // アクセスポイントパス
137                 $this->accessDir = '';          // アクセスポイントディレクトリ
138                 $this->defaultLacaleArray = array('ja'          => 'ja_JP',
139                                                                                         'en'    => 'en_US');    // デフォルトのロケール取得用
140                 $this->currentWidgetId = '';    // 現在作成中のウィジェットId
141
142                 // デフォルトの作業用ディレクトリ取得
143                 if (function_exists('sys_get_temp_dir')){               // PHP 5.2.1以上
144                         $this->workDir = sys_get_temp_dir();
145                 } else {
146                 $this->workDir = getenv('TMP');
147                         if (empty($this->workDir)) $this->workDir = getenv('TEMP');
148                         if (empty($this->workDir)) $this->workDir = getenv('TMPDIR');
149                         if (empty($this->workDir)){
150                                 $temp = tempnam(__FILE__, '');
151                                 if (file_exists($temp)){
152                                         unlink($temp);
153                                         $this->workDir = dirname($temp);
154                                 }
155                         }
156                 }
157                 $this->workDir = rtrim($this->workDir, DIRECTORY_SEPARATOR);            // 最後の「/」「\」を除く
158                 if (!file_exists($this->workDir)) $this->workDir = M3_SYSTEM_WORK_DIR_PATH;// 作業用ディレクトリデフォルト値
159                 
160                 // システムバージョンオブジェクト作成
161                 $this->sysVersion = new m3Version();
162                 
163                 // システムDBオブジェクト取得
164                 $this->db = $this->gInstance->getSytemDbObject();
165                 
166                 // ######## DBの接続チェック ########
167                 if (defined('M3_STATE_IN_INSTALL')){            // システムがインストールモードで起動のとき
168                         $this->canUseDb = false;                        // DBは使用できない
169                 } else {
170                         // システム名称、バージョンを取得
171                         $status = $this->db->getDisplayErrMessage();    // 出力状態を取得
172                         $this->db->displayErrMessage(false);            // 画面へのエラー出力を抑止
173                         //$value = $this->db->getSystemConfig(M3_TB_FIELD_SYSTEM_NAME);
174                         $ret = $this->gSystem->_loadSystemConfig();
175                         $this->db->displayErrMessage($status);          // 抑止解除
176                         // 値が取得できたときは、セッションDBテーブルも作成されているとする
177                         /*if ($value == ''){
178                                 $this->canUseDbSession = false;
179                                 $this->canUseDb = false;                        // DBは使用できない
180                         } else {
181                                 $this->canUseDbSession = true;
182                                 $this->canUseDb = true;                 // DBは使用可能
183                                 
184                                 // システム関係のパラメータを取得
185                                 $this->loadSystemParams();
186                         }*/
187                         if ($ret){
188                                 $this->canUseDbSession = true;
189                                 $this->canUseDb = true;                 // DBは使用可能
190                                 
191                                 // システム関係のパラメータを取得
192                                 $this->loadSystemParams(false);         // DBから再取得しない
193                         } else {
194                                 $this->canUseDbSession = false;
195                                 $this->canUseDb = false;                        // DBは使用できない
196                         }
197                 }
198                 // 日本語処理関係
199                 if (extension_loaded('mbstring')){      // mbstring使用可能
200                         if (version_compare(PHP_VERSION, '5.6.0') < 0){
201                                 ini_set('mbstring.http_input',                  'pass');
202                                 ini_set('mbstring.http_output',                 'pass');
203                         }
204                         ini_set('mbstring.encoding_translation',        'Off');         // ここでは設定を変更できない?
205                         ini_set('mbstring.substitute_character',                'none');        // 無効な文字の代替出力
206                         ini_set('mbstring.func_overload',               '0');
207                         
208                         if (function_exists('mb_language')) mb_language("Japanese");
209                         if (function_exists('mb_internal_encoding')) mb_internal_encoding("UTF-8");
210                 }
211                 // 現在のルートURL初期化。外部アクセスのときはこのURLを使用。
212                 $this->currentDomainRootUrl = M3_SYSTEM_ROOT_URL;
213                 
214                 // プロトコル省略型のルートURL
215                 $this->protocolRelativeRootUrl = preg_replace('(^https?:)', '', M3_SYSTEM_ROOT_URL);
216         }
217         /**
218          * システム関係のパラメータを再取得
219          *
220          * @param bool $reloadFromDb            DBから再取得するかどうか
221          * @return                                                      なし
222          */
223         public function loadSystemParams($reloadFromDb = true)
224         {
225                 if ($reloadFromDb) $this->gSystem->_loadSystemConfig();
226                 
227                 // デフォルト値取得
228                 $this->defaultLanguage = $this->gSystem->getSystemConfig(self::CF_DEFAULT_LANG);// デフォルト言語
229                 $this->defaultLocale = $this->defaultLacaleArray[$this->defaultLanguage];               // デフォルトのロケール
230                 if (empty($this->defaultLocale)) $this->defaultLocale = self::DEFAULT_LOCALE;
231                 $this->currentLanguage = $this->defaultLanguage;
232                 $this->currentLocale = $this->defaultLocale;                    // 現在のロケール
233                 $this->canChangeLang = $this->gSystem->canChangeLang();// 言語変更可能かどうか
234                 $this->multiLanguage = $this->gSystem->getSystemConfig(self::MULTI_LANGUAGE);           // 多言語対応かどうか
235                 $this->multiDomain      = $this->gSystem->getSystemConfig(self::CF_MULTI_DOMAIN);               // マルチドメイン運用かどうか
236                 
237                 $this->adminDefaultTheme = $this->gSystem->adminDefaultTheme(); // 管理画面のデフォルトテーマ
238                 $this->useSsl = $this->gSystem->getSystemConfig(self::CF_USE_SSL);              // SSL機能を使用するかどうか
239                 $this->useSslAdmin = $this->gSystem->getSystemConfig(self::CF_USE_SSL_ADMIN);           // 管理画面にSSL機能を使用するかどうか
240                 $this->sslUrl = $this->gSystem->getSystemConfig(self::CF_SSL_URL);                      // SSL用URL
241                 $value = $this->gSystem->getSystemConfig(self::CONFIG_ID_WORK_DIR);// 作業用ディレクトリ
242                 if (!empty($value)) $this->workDir = $value;
243         }
244         /**
245          * マルチドメイン用設定初期化
246          *
247          * @return                                                      なし
248          */
249         public function initMultiDomain()
250         {
251                 // マルチドメイン運用の場合はルートURLを設定
252                 if ($this->multiDomain){
253                         $url = '';
254                         if ($this->isSmartphoneSite){
255                                 $url = $this->gSystem->getSystemConfig(self::CF_SITE_SMARTPHONE_URL);   // スマートフォン用サイトURL
256                         }
257                         if (!empty($url)) $this->currentDomainRootUrl = $url;
258                 }
259         }
260         /**
261          * デバッグ出力を行うかどうか
262          */
263         public function getSystemDebugOut()
264         {
265                 return M3_SYSTEM_DEBUG_OUT;
266         }
267
268         // ##################### システム全体のパス環境 #####################
269         /**
270          * システムルートディレクトリへのパスを取得
271          *
272          * @return string                       パス
273          */
274         public function getSystemRootPath()
275         {
276                 return M3_SYSTEM_ROOT_PATH;
277         }
278         /**
279          * 管理用ディレクトリへのパスを取得
280          *
281          * @return string                       パス
282          */
283         public function getAdminPath()
284         {
285                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . M3_DIR_NAME_ADMIN;
286         }
287         /**
288          * includeディレクトリへのパスを取得
289          *
290          * @return string                       パス
291          */
292         public function getIncludePath()
293         {
294                 return M3_SYSTEM_INCLUDE_PATH;
295         }
296         /**
297          * インナーウィジェット用ディレクトリへのパスを取得
298          */
299 /*      public function getIWidgetsPath()
300         {
301                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'iwidgets';
302         }*/
303         /**
304          * addonsディレクトリへのパスを取得
305          *
306          * @return string                       パス
307          */
308         public function getAddonsPath()
309         {
310                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'addons';
311         }
312         /**
313          * cronjobsディレクトリへのパスを取得
314          *
315          * @return string                       パス
316          */
317         public function getCronjobsPath()
318         {
319                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'cronjobs';
320         }
321         /**
322          * コンテナクラス用ディレクトリへのパスを取得
323          *
324          * @return string                       パス
325          */
326         public function getContainerPath()
327         {
328                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'container';
329         }
330         /**
331          * DBクラス用ディレクトリへのパスを取得
332          *
333          * @return string                       パス
334          */
335         public function getDbPath()
336         {
337                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'db';
338         }
339         /**
340          * ライブラリ用ディレクトリへのパスを取得
341          *
342          * @return string                       パス
343          */
344         public function getLibPath()
345         {
346                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'lib';
347         }
348         /**
349          * SQL格納用ディレクトリへのパスを取得
350          *
351          * @return string                       パス
352          */
353         public function getSqlPath()
354         {
355                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'sql';
356         }
357         /**
358          * テーブル作成用SQL格納用ディレクトリへのパスを取得
359          *
360          * @return string                       パス
361          */
362         public function getTablesPath()
363         {
364                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'tables';
365         }
366         /**
367          * Coreディレクトリへのパスを取得
368          *
369          * @return string                       パス
370          */
371         public function getCorePath()
372         {
373                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'core';
374         }
375         /**
376          * Commonディレクトリへのパスを取得
377          *
378          * @return string                       パス
379          */
380         public function getCommonPath()
381         {
382                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'common';
383         }
384         /**
385          * dataディレクトリへのパスを取得
386          *
387          * @return string                       パス
388          */
389         public function getDataPath()
390         {
391                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'data';
392         }
393         /**
394          * Joomla用ライブラリルートディレクトリへのパスを取得
395          *
396          * @return string                       パス
397          */
398         public function getJoomlaRootPath()
399         {
400                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'mos';
401         }
402         /**
403          * Wordpress用ライブラリルートディレクトリへのパスを取得
404          *
405          * @return string                       パス
406          */
407         public function getWordpressRootPath()
408         {
409                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'wp';
410         }
411         /**
412          * スクリプトファイルディレクトリへのパスを取得
413          *
414          * @return string                       パス
415          */
416         public function getScriptsPath()
417         {
418                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'scripts';
419         }
420         /**
421          * テンプレート用ディレクトリへのパスを取得
422          *
423          * @return string                       パス
424          */
425         public function getTemplatesPath()
426         {
427                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'templates';
428         }
429         /**
430          * リソース用ディレクトリへのパスを取得
431          *
432          * @return string                       パス
433          */
434         public function getResourcePath()
435         {
436                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'resource';
437         }
438         /**
439          * ユーザの種別に対応したリソース用ディレクトリへのパスを取得(外部アプリケーション用)
440          *
441          * @return string               パス
442          */
443         public function getResourcePathForUser()
444         {
445                 $path = $this->getResourcePath();
446                 
447                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
448                 if ($this->isResourceLimitedUser()){
449                         $path .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
450                 }
451                 return $path;
452         }
453         /**
454          * 非公開リソースディレクトリへのパスを取得
455          *
456          * @return string                       パス
457          */
458         public function getPrivateResourcePath()
459         {
460                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'etc';
461         }
462         /**
463          * widgetsディレクトリへのパスを取得
464          *
465          * 例) /var/www/html/magic3/widgets
466          *
467          * @return string                       パス
468          */
469         public function getWidgetsPath()
470         {
471                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'widgets';
472         }
473         /**
474          * ウィジェットのdbディレクトリへのパスを取得
475          *
476          * 例) /var/www/html/magic3/widgets/xxxxx/include/db
477          *
478          * @param string $widgetId                      ウィジェットID
479          * @return string                                       パス
480          */
481         public function getWidgetDbPath($widgetId)
482         {
483                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
484         }
485         /**
486          * ウィジェットのcontainerディレクトリへのパスを取得
487          *
488          * 例) /var/www/html/magic3/widgets/xxxxx/include/container
489          *
490          * @param string $widgetId                      ウィジェットID
491          * @return string                                       パス
492          */
493         public function getWidgetContainerPath($widgetId)
494         {
495                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
496         }
497         /**
498          * ウィジェットのincludeディレクトリへのパスを取得
499          *
500          * 例) /var/www/html/magic3/widgets/xxxxx/include
501          *
502          * @param string $widgetId                      ウィジェットID
503          * @return string                                       パス
504          */
505         public function getWidgetIncludePath($widgetId)
506         {
507                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include';
508         }
509         /**
510          * システムのルートURLを取得
511          */
512         public function getRootUrl()
513         {
514                 //return M3_SYSTEM_ROOT_URL;
515                 return $this->currentDomainRootUrl;
516         }
517         /**
518          * システムのルートURLがSSLのURLかどうか
519          *
520          * @return bool                 true=SSLのURL、false=SSLのURLではない
521          */
522         public function isRootUrlSsl()
523         {
524                 if (strncasecmp($this->currentDomainRootUrl, 'https://', 8) == 0){
525                         return true;
526                 } else {
527                         return false;
528                 }
529         }
530         /**
531          * SSL用のルートURLを取得
532          */
533         public function getSslRootUrl()
534         {
535                 // 設定値が空のときはシステムルートURLから生成
536                 if (empty($this->sslUrl)){
537                         $url = str_replace('http://', 'https://', M3_SYSTEM_ROOT_URL);
538                 } else {
539                         $url = $this->sslUrl;
540                 }
541                 return $url;
542         }
543         /**
544          * 現在のページのシステムのルートURLを取得
545          */
546         public function getRootUrlByCurrentPage()
547         {
548                 //$url = M3_SYSTEM_ROOT_URL;
549                 $url = $this->currentDomainRootUrl;
550                 if ($this->isAdminDirAccess()){         // 管理画面へのアクセスのとき
551                         // 管理画面のSSL状態を参照
552                         //if ($this->useSslAdmin) $url = str_replace('http://', 'https://', $url);
553                         if ($this->useSslAdmin) $url = $this->getSslRootUrl();
554                 } else {
555                         $url = $this->getRootUrlByPage($this->getCurrentPageId(), $this->getCurrentPageSubId());
556                 }
557                 return $url;
558         }
559         /**
560          * 指定のページのシステムのルートURLを取得
561          *
562          * @param string $pageId                ページID
563          * @param string $pageSubId             ページサブID
564          * @return string                               URL
565          */
566         public function getRootUrlByPage($pageId, $pageSubId)
567         {
568                 global $gPageManager;
569                 
570                 //$url = M3_SYSTEM_ROOT_URL;
571                 $url = $this->currentDomainRootUrl;
572                 $isSslPage = $gPageManager->isSslPage($pageId, $pageSubId);
573                 if ($isSslPage) $url = $this->getSslRootUrl();
574                 return $url;
575         }
576         /**
577          * リアルタイムサーバ用のURLを取得
578          *
579          * @return string                               URL
580          */
581         public function getRealtimeServerUrl()
582         {
583                 static $serverUrl;
584                 
585                 if (!isset($serverUrl)){
586                         // リアルタイムサーバ用ポート番号を取得
587                         $portNo = $this->gSystem->getSystemConfig(self::CF_REALTIME_SERVER_PORT);
588                         $rootUrl = $this->getRootUrlByCurrentPage();
589                         
590                         $parsedUrl = parse_url($rootUrl);
591                         $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
592                         if (!empty($portNo)) $url .= ':' . $portNo;
593                         $serverUrl = $url;
594                 }
595                 return $serverUrl;
596         }
597         /**
598          * 現在のページにSSLが必要かどうかを取得
599          */
600         public function isSslByCurrentPage()
601         {
602                 global $gPageManager;
603                 
604                 $isSslPage = false;
605                 if ($this->isAdminDirAccess()){         // 管理画面へのアクセスのとき
606                         // 管理画面のSSL状態を参照
607                         if ($this->useSslAdmin) $isSslPage = true;
608                 } else {
609                         $isSslPage = $gPageManager->isSslPage($this->getCurrentPageId(), $this->getCurrentPageSubId());
610                 }
611                 return $isSslPage;
612         }
613         /**
614          * widgetsディレクトリへのURLを取得
615          *
616          * 例) http://www.magic3.org/magic3/widgets
617          */
618         public function getWidgetsUrl()
619         {
620                 //return M3_SYSTEM_ROOT_URL . '/widgets';
621                 return $this->currentDomainRootUrl . '/widgets';
622         }
623         /**
624          * widgetsディレクトリへのSSL用URLを取得
625          *
626          * 例) https://www.magic3.org/magic3/widgets
627          */
628         public function getSslWidgetsUrl()
629         {
630                 return $this->getSslRootUrl() . '/widgets';
631         }
632         /**
633          * リソース用ディレクトリへのURLを取得
634          */
635         public function getResourceUrl()
636         {
637                 //return M3_SYSTEM_ROOT_URL . '/resource';
638                 return $this->currentDomainRootUrl . '/resource';
639         }
640         /**
641          * ユーザの種別に対応したリソース用ディレクトリへのURLを取得(外部アプリケーション用)
642          *
643          * @return string               URL
644          */
645         public function getResourceUrlForUser()
646         {
647                 $url = $this->getResourceUrl();
648                 
649                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
650                 if ($this->isResourceLimitedUser()){
651                         $url .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
652                 }
653                 return $url;
654         }
655         /**
656          * リソース用ディレクトリへのSSL用URLを取得
657          */
658         public function getSslResourceUrl()
659         {
660                 return $this->getSslRootUrl() . '/resource';
661         }
662         /**
663          * 画像用ディレクトリへのパスを取得
664          */
665         public function getImagesUrl()
666         {
667                 //return M3_SYSTEM_ROOT_URL . '/images';
668                 return $this->currentDomainRootUrl . '/images';
669         }
670         /**
671          * 絵文字画像用ディレクトリへのパスを取得
672          */
673         public function getEmojiImagesUrl()
674         {
675                 //return M3_SYSTEM_ROOT_URL . '/images/system/emoji';
676                 return $this->currentDomainRootUrl . '/images/system/emoji';
677         }
678         /**
679          * scriptsディレクトリ(共通スクリプトディレクトリ)へのURLを取得
680          *
681          * 例) http://www.magic3.org/magic3/scripts
682          */
683         public function getScriptsUrl()
684         {
685                 //return M3_SYSTEM_ROOT_URL . '/scripts';
686                 return $this->currentDomainRootUrl . '/scripts';
687         }
688         /**
689          * scriptsディレクトリ(共通スクリプトディレクトリ)へのSSL用URLを取得
690          *
691          * 例) http://www.magic3.org/magic3/scripts
692          */
693         public function getSslScriptsUrl()
694         {
695                 return $this->getSslRootUrl() . '/scripts';
696         }
697         /**
698          * scriptsディレクトリへのURLを取得
699          *
700          * 例) //www.magic3.org/magic3/scripts
701          */
702         public function getProtocolRelativeScriptsUrl()
703         {
704                 return $this->protocolRelativeRootUrl . '/scripts';
705         }
706         /**
707          * templatesディレクトリ(テンプレートディレクトリ)へのURLを取得
708          *
709          * 例) http://www.magic3.org/magic3/templates
710          */
711         public function getTemplatesUrl()
712         {
713                 //return M3_SYSTEM_ROOT_URL . '/templates';
714                 return $this->currentDomainRootUrl . '/templates';
715         }
716         /**
717          * templatesディレクトリ(テンプレートディレクトリ)へのSSL用URLを取得
718          *
719          * 例) http://www.magic3.org/magic3/templates
720          */
721         public function getSslTemplatesUrl()
722         {
723                 return $this->getSslRootUrl() . '/templates';
724         }
725         /**
726          * themesディレクトリ(jQueryUIテーマディレクトリ)へのURLを取得
727          *
728          * 例) http://www.magic3.org/magic3/ui/themes
729          */
730         public function getThemesUrl()
731         {
732                 //return M3_SYSTEM_ROOT_URL . '/ui/themes';
733                 return $this->currentDomainRootUrl . '/ui/themes';
734         }
735         /**
736          * 管理用ディレクトリへのURLパスを取得
737          *
738          * @param bool $removeAdminDir          「admin」ディレクトリ名を削除するかどうか
739          * @return string                                       管理用ディレクトリへのURLパス
740          */
741         public function getAdminUrl($removeAdminDir = false)
742         {
743                 static $url;
744                 
745                 if (!isset($url)){
746                         $url = M3_SYSTEM_ROOT_URL;
747                         if ($this->useSslAdmin) $url = $this->getSslRootUrl();
748                 }
749                 $destUrl = $url;
750                 if (!$removeAdminDir) $destUrl .= '/' . M3_DIR_NAME_ADMIN;
751                 return $destUrl;
752         }
753         /**
754          * システムのデフォルトindexのURLを取得
755          *
756          * @return string                                       デフォルトURL
757          */
758         public function getDefaultUrl()
759         {
760                 //return M3_SYSTEM_ROOT_URL . '/' . M3_FILENAME_INDEX;
761                 return $this->currentDomainRootUrl . '/' . M3_FILENAME_INDEX;
762         }
763         /**
764          * システムのPC用デフォルトindexのURLを取得
765          *
766          * @return string                                       デフォルトURL
767          */
768         public function getDefaultPcUrl()
769         {
770                 return M3_SYSTEM_ROOT_URL . '/' . M3_FILENAME_INDEX;
771         }
772         /**
773          * システムの携帯用デフォルトindexのURLを取得
774          *
775          * @param bool $withMobileParam         携帯用のパラメータを付加するかどうか
776          * @param bool $withFilename            ファイル名を付加するかどうか
777          * @return string                                       携帯用デフォルトURL
778          */
779         public function getDefaultMobileUrl($withMobileParam = false, $withFilename = true)
780         {
781                 $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_MOBILE;
782                 if ($withFilename) $url .= '/' . M3_FILENAME_INDEX;
783                 return $url;
784         }
785         /**
786          * システムのスマートフォン用デフォルトindexのURLを取得
787          *
788          * @param bool $withFilename            ファイル名を付加するかどうか
789          * @return string                                       スマートフォン用デフォルトURL
790          */
791         public function getDefaultSmartphoneUrl($withFilename = true)
792         {
793                 static $smartphoneUrl;
794                 
795                 if ($this->multiDomain){                        // マルチドメイン運用の場合
796                         if (!isset($smartphoneUrl)) $smartphoneUrl = $url = $this->gSystem->getSystemConfig(self::CF_SITE_SMARTPHONE_URL);      // スマートフォン用サイトURL
797                         
798                         if (empty($smartphoneUrl)){
799                                 $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_SMARTPHONE;
800                         } else {
801                                 $url = $smartphoneUrl;
802                         }
803                 } else {
804                         $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_SMARTPHONE;
805                 }
806                 if ($withFilename) $url .= '/' . M3_FILENAME_INDEX;
807                 return $url;
808         }
809         /**
810          * システムのデフォルトの管理用indexのURLを取得
811          */
812         public function getDefaultAdminUrl()
813         {
814                 return $this->getAdminUrl() . '/' . M3_FILENAME_INDEX;
815         }
816         /**
817          * 管理画面用jQueryUIテーマのCSSのURLを取得
818          *
819          * @return string               CSSのURL
820          */
821         public function getAdminDefaultThemeUrl()
822         {
823                 $themeFile = $this->getThemesUrl() . '/'. $this->adminDefaultTheme . '/'. self::DEFAULT_THEME_CSS_FILE; // 管理画面用jQueryUIテーマ
824                 return $themeFile;
825         }
826         /**
827          * 作業用ディレクトリへのパスを取得
828          *
829          * @return string               作業ディレクトリ
830          */
831         public function getWorkDirPath()
832         {
833                 return $this->workDir;
834         }
835         /**
836          * 一般ユーザ用の作業用ディレクトリへのパスを取得
837          *
838          * @return string               作業ディレクトリ
839          */
840         public function getUserWorkDirPath()
841         {
842                 return $this->workDir . DIRECTORY_SEPARATOR . 'users';
843         }
844         /**
845          * セッション単位の一時ディレクトリを取得
846          *
847          * @param bool  $createDir      ディレクトリが存在しない場合、作成するかどうか
848          * @return string               一時ディレクトリ
849          */
850         function getTempDirBySession($createDir = false)
851         {
852                 $dir = $this->workDir . DIRECTORY_SEPARATOR . session_id();
853                 if (!file_exists($dir) && $createDir) mkdir($dir, M3_SYSTEM_DIR_PERMISSION, true/*再帰的*/);
854                 return $dir;
855         }
856         /**
857          * 一般ユーザ用のセッション単位の一時ディレクトリを取得
858          *
859          * @param bool  $createDir      ディレクトリが存在しない場合、作成するかどうか
860          * @return string               一時ディレクトリ
861          */
862         function getUserTempDirBySession($createDir = false)
863         {
864                 $dir = $this->getUserWorkDirPath() . DIRECTORY_SEPARATOR . session_id();
865                 if (!file_exists($dir) && $createDir) mkdir($dir, M3_SYSTEM_DIR_PERMISSION, true/*再帰的*/);
866                 return $dir;
867         }
868         /**
869          * 一時ディレクトリを取得
870          *
871          * 一時ディレクトリを作成してパスを取得
872          *
873          * @return string               ディレクトリパス(失敗のときは空を返す)
874          */
875         public function getTempDir()
876         {
877                 $path = $this->workDir . '/' . M3_SYSTEM_WORK_DIRNAME_HEAD . uniqid();
878                         
879                 if (!file_exists($path)){// ディレクトリがないとき
880                         if (!mkdir($path, M3_SYSTEM_DIR_PERMISSION)){
881                                 $path = $this->workDir . '/' . M3_SYSTEM_WORK_DIRNAME_HEAD . uniqid(rand());
882                                 if (!mkdir($path, M3_SYSTEM_DIR_PERMISSION)) return '';
883                         }
884                 }
885                 return $path;
886         }
887         // ##################### パス処理 #####################
888         /**
889          * サーバのURLを取得
890          *
891          * 例) http://www.magic3.org, http://www.magic3.org:8080
892          */
893         public function getServerUrl()
894         {
895                 // クライアントからの情報を元にURLを取得
896                 if (isset($_SERVER['HTTPS'])){          // SSL通信の場合
897                         $url = 'https://' . $_SERVER['HTTP_HOST'];
898                 } else {
899                         $url = 'http://' . $_SERVER['HTTP_HOST'];
900                 }
901                 return $url;
902         }
903         /**
904          * 現在実行中のスクリプトファイルのURLを取得
905          *
906          * 例) http://www.magic3.org/magic3/index.php
907          */
908         public function getCurrentScriptUrl()
909         {
910                 //return $_SERVER["SCRIPT_URI"];                // SCRIPT_URIはサーバによってはundefinedになる
911                 return $this->getServerUrl() . $_SERVER["PHP_SELF"];
912         }
913         /**
914          * クライアントから要求されたURI(パラメータ付き)を取得
915          *
916          * 例) http://www.magic3.org/magic3/index.php?aaa=bbb
917          */
918         public function getCurrentRequestUri()
919         {
920                 return $this->getServerUrl() . $_SERVER["REQUEST_URI"];
921         }
922         /**
923          * 現在実行中のスクリプトファイルのパスを取得
924          *
925          * 例) /var/www/html/magic3/index.php
926          */
927         public function getCurrentScriptPath()
928         {
929                 return realpath($_SERVER["SCRIPT_FILENAME"]);
930         }       
931         /**
932          * ドキュメントルートを取得
933          *
934          * 例) /var/www/html
935          */
936         public function getDocumentRoot()
937         {
938                 // バーチャルサーバの場合にも対応
939                 //return $_SERVER["DOCUMENT_ROOT"];
940                 $name = $_SERVER["SCRIPT_NAME"];
941                 $filename = $_SERVER["SCRIPT_FILENAME"];
942                 $dir = substr($filename, 0, strlen($filename) - strlen($name));
943                 return $dir;
944         }
945         /**
946          * ドキュメントルートURLを取得
947          *
948          * 例) http://www.magic3.org, http://www.magic3.org:8080
949          */
950         public function getDocumentRootUrl()
951         {
952                 $rootUrl = parse_url($this->getRootUrl());
953                 $url = 'http://' . $rootUrl['host'];
954                 if (!empty($rootUrl['port'])) $url .= ':' . $rootUrl['port'];
955                 return $url;
956         }
957         /**
958          * システムルートURLを求める
959          *
960          * @return string               システムのルートURL。算出できなかったときは空文字列を返す。
961          */
962         public function calcSystemRootUrl()
963         {       
964                 // 相対パスを得る
965                 $base = explode(DIRECTORY_SEPARATOR, $this->getSystemRootPath());
966                 $target = explode(DIRECTORY_SEPARATOR, $this->getCurrentScriptPath());
967                 
968                 for ($i = 0; $i < count($base); $i++)
969                 {
970                         if ($base[$i] != $target[$i]) break;
971                 }
972                 $relativePath = '';
973                 for ($j = $i; $j < count($target); $j++)
974                 {
975                         $relativePath .= '/' . $target[$j];
976                 }
977                 // システムルートディレクトリ取得
978                 $sytemRootUrl = '';
979                 $pos = strrpos($this->getCurrentScriptUrl(), $relativePath);
980                 if (!($pos === false)){
981                         $sytemRootUrl = substr($this->getCurrentScriptUrl(), 0, $pos);
982                 }
983                 return $sytemRootUrl;
984         }
985         /**
986          * 相対パスを求める
987          *
988          * @param string $basePath              基点となるディレクトリの絶対パス
989          * @param string $targetPath    対象となるディレクトリの絶対パス
990          * @return string                               相対パス
991          */
992         public function calcRelativePath($basePath, $targetPath)
993         {
994                 // 相対パスを得る
995                 $base = explode('/', $basePath);
996                 $target = explode('/', $targetPath);
997                 
998                 for ($i = 0; $i < count($base); $i++)
999                 {
1000                         if ($base[$i] != $target[$i]) break;
1001                 }
1002                 $relativePath = '';
1003                 for ($j = $i; $j < count($target); $j++)
1004                 {
1005                         $relativePath .= '/' . $target[$j];
1006                 }
1007                 return $relativePath;
1008         }
1009         /**
1010          * パーマネントリンク用の現在のページURLを取得
1011          *
1012          * @param bool $hasSubPage              サブページIDを必ず付加するかどうか。必ず付加しない場合はデフォルトページのとき省略
1013          * @return string                               パーマネントリンクURL
1014          */
1015         /*public function getCurrentPermanentPageUrl($hasSubPage=false)
1016         {
1017                 $url = $this->getDefaultUrl();
1018                 if ($hasSubPage || $this->currentPageSubId != $this->defaultPageSubId) $url .= '?sub=' . $this->currentPageSubId;
1019                 return $url;
1020         }*/
1021         /**
1022          * ドキュメントルートからのリソース用ディレクトリへの相対パスを取得(外部アプリケーション用)
1023          *
1024          * @return string               相対パス
1025          */
1026         public function getRelativeResourcePathToDocumentRoot()
1027         {
1028                 // 相対パスを得る
1029                 //if (isset($_SERVER['HTTPS'])){                // SSL通信の場合
1030                 //      $res = parse_url($this->getSslResourceUrl());
1031                 //} else {
1032                         $res = parse_url($this->getResourceUrl());
1033                 //}
1034                 return $res['path'];
1035         }
1036         /**
1037          * ユーザの種別に対応した、ドキュメントルートからのリソース用ディレクトリへの相対パスを取得(外部アプリケーション用)
1038          *
1039          * @return string               相対パス
1040          */
1041         public function getRelativeResourcePathToDocumentRootForUser()
1042         {
1043                 // 相対パスを取得
1044                 $res = parse_url($this->getResourceUrl());
1045                 $path = $res['path'];
1046                 
1047                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
1048                 //if ($this->isCurrentUserLogined() && !$this->isSystemManageUser()){
1049                 if ($this->isResourceLimitedUser()){
1050                         $path .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
1051                 }
1052                 return $path;
1053         }
1054         /**
1055          * アプリケーションルートから指定ディレクトリへの相対パスを取得
1056          *
1057          * @param string $url   指定URL
1058          * @return string               相対パス
1059          */
1060         public function getRelativePathToSystemRootUrl($url)
1061         {
1062                 // システムのルートURL以下か、SSL用のルートURL以下か判断
1063                 $rootUrl = $this->getRootUrl();
1064                 $relativePath = str_replace($this->getSslRootUrl(), '', $url);
1065                 if (empty($relativePath) || strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){
1066                         $rootUrl = $this->getSslRootUrl();
1067                 }
1068                         
1069                 // URLから相対パスを得る
1070                 $root = parse_url($rootUrl);
1071                 $target = parse_url($url);
1072                 return $this->calcRelativePath($root['path'], $target['path']);
1073         }
1074         /**
1075          * アプリケーションルートから指定ディレクトリへの相対パスを取得
1076          *
1077          * @param string $path  指定パス
1078          * @return string               相対パス
1079          */
1080         public function getRelativePathToSystemRootPath($path)
1081         {
1082                 return $this->calcRelativePath($this->getSystemRootPath(), $path);
1083         }
1084         /**
1085          * URLから絶対パスを取得
1086          *
1087          * @param string $url   指定URL
1088          * @return string               絶対パス
1089          */
1090         public function getAbsolutePath($url)
1091         {
1092                 return $this->getSystemRootPath() . $this->getRelativePathToSystemRootUrl($url);
1093         }
1094         /**
1095          * フルパスからURLを取得
1096          *
1097          * @param string $path  指定パス
1098          * @return string               URL
1099          */
1100         public function getUrlToPath($path)
1101         {
1102                 return $this->getRootUrl() . $this->calcRelativePath($this->getSystemRootPath(), $path);
1103         }
1104         /**
1105          * マクロ変換したパスを取得
1106          *
1107          * @param string $path  変換元パス(絶対パス、相対パス)
1108          * @return string               変換したパス
1109          */
1110         public function getMacroPath($path)
1111         {
1112                 $destPath = $path;
1113                 if (strncmp($destPath, '/', 1) == 0){           // 相対パス表記のとき
1114                         $destPath = M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END . $this->getRelativePathToSystemRootUrl($this->getDocumentRootUrl() . $destPath);
1115                 } else if (strncmp($destPath, 'http', strlen('http')) == 0 || strncmp($destPath, 'https', strlen('https')) == 0){                               // 絶対パス表記のとき
1116                         $destPath = str_replace('https://', 'http://', $destPath);              // 一旦httpに統一
1117                         $rootUrl = str_replace('https://', 'http://', $this->getRootUrl());             // 一旦httpに統一
1118                         $destPath = str_replace($rootUrl, M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $destPath);// マクロ変換
1119                 }
1120                 return $destPath;
1121         }
1122         /**
1123          * SSL用のURLに変換
1124          *
1125          * @param string $url   指定URL
1126          */
1127         public function getSslUrl($url)
1128         {
1129                 // 「?」以降のパラメータはそのまま維持する
1130                 list($tmp, $query) = explode('?', $url);
1131                 
1132                 // URLから相対パスを得て、SSL用URLに連結
1133                 $destUrl = $this->getSslRootUrl() . $this->getRelativePathToSystemRootUrl($url);
1134                 if (!empty($query)) $destUrl .= '?' . $query;
1135                 return $destUrl;
1136         }
1137         /**
1138          * URLを解析
1139          *
1140          * @param string $url                   指定URL
1141          * @param string $pageId                ページIDが返る
1142          * @param string $pageSubId             ページサブIDが返る
1143          * @param array $params                 ページID,ページサブID以外のパラメータが返る
1144          * @return bool                                 true=解析成功、false=解析失敗(Magic3以外のURL)
1145          */
1146 /*      public function parseUrl($url, &$pageId, &$pageSubId, &$params)
1147         {
1148                 // 引数エラーチェック
1149                 if (empty($url)) return false;
1150                 
1151                 $params = array();
1152                 if ($this->isSystemUrlAccess($url)){
1153                         // URLを解析
1154                         $queryArray = array();
1155                         $parsedUrl = parse_url($url);
1156                         if (!empty($parsedUrl['query'])) parse_str($parsedUrl['query'], $queryArray);           // クエリーの解析
1157                         
1158                         // ルートからの相対パスを取得
1159                         $relativePath = $this->getRelativePathToSystemRootUrl($url);
1160                         
1161                         // ページIDを取得
1162                         $path = trim($relativePath, '/');
1163                         $pathArray = explode('/', $path);
1164                         $basename = '';
1165                         for ($i = 0; $i < count($pathArray); $i++){
1166                                 if ($i == 0){
1167                                         $basename .= $pathArray[$i];
1168                                 } else {
1169                                         $basename .= ('_' . $pathArray[$i]);
1170                                 }
1171                         }
1172                         $basename = basename($basename, '.php');
1173                         if (empty($basename)) $basename = $this->getDefaultPageId();
1174                         $pageId = $basename;
1175                         
1176                         // ページサブID取得
1177                         $pageSubId = $this->_getPageSubIdFromUrlQuery($pageId, $parsedUrl['query']);
1178
1179                         // その他のパラメータを取得
1180                         $keys = array_keys($queryArray);
1181                         $keyCount = count($keys);
1182                         for ($i = 0; $i < $keyCount; $i++){
1183                                 $key = $keys[$i];
1184                                 $value = $queryArray[$key];
1185                                 if ($key != M3_REQUEST_PARAM_PAGE_SUB_ID){              // ページIDは追加しない
1186                                         $params[$key] = $value;
1187                                 }
1188                         }
1189                         return true;
1190                 } else {// システムディレクトリ以外のときはエラー
1191                         return false;
1192                 }
1193         }*/
1194         /**
1195          * ページIDとURLのクエリー文字列からサブページIDを取得
1196          *
1197          * @param string $pageId        ページID
1198          * @param string $query         クエリー文字列
1199          * @return string                       サブページID
1200          */
1201 /*      public function _getPageSubIdFromUrlQuery($pageId, $query)
1202         {
1203                 $queryArray = array();
1204                 if (!empty($query)) parse_str($query, $queryArray);             // クエリーの解析
1205                         
1206                 // ページサブID取得
1207                 $pageSubId = $queryArray[M3_REQUEST_PARAM_PAGE_SUB_ID];
1208                 if (empty($pageSubId)){
1209                         // ページサブIDがないときは、パラメータからページ属性を判断する
1210                         // キーが設定されていれば値は空文字列でも属性を持っているとする
1211                         if (isset($queryArray[M3_REQUEST_PARAM_CONTENT_ID]) || isset($queryArray[M3_REQUEST_PARAM_CONTENT_ID_SHORT])){          // コンテンツIDのとき
1212                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_CONTENT, $pageId);// ページサブIDを取得
1213                         } else if (isset($queryArray[M3_REQUEST_PARAM_PRODUCT_ID]) || isset($queryArray[M3_REQUEST_PARAM_PRODUCT_ID_SHORT])){   // 製品IDのとき
1214                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PRODUCT, $pageId);// ページサブIDを取得
1215                         } else if (isset($queryArray[M3_REQUEST_PARAM_BBS_ID]) || isset($queryArray[M3_REQUEST_PARAM_BBS_ID_SHORT])){   // 掲示板投稿記事のとき
1216                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BBS, $pageId);// ページサブIDを取得
1217                         } else if (isset($queryArray[M3_REQUEST_PARAM_BLOG_ENTRY_ID]) || isset($queryArray[M3_REQUEST_PARAM_BLOG_ENTRY_ID_SHORT])){     // ブログ記事のとき
1218                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BLOG, $pageId);// ページサブIDを取得
1219                         }
1220                 }
1221                 if (empty($pageSubId)) $pageSubId = $this->db->getDefaultPageSubId($pageId);    // 最終的に見つからないときはデフォルト値を取得
1222                 return $pageSubId;
1223         }*/
1224         /**
1225          * Magic3システムへのアクセスかどうか(SSL用のURL含む)
1226          *
1227          * @param string $url           指定URL(空のときは現在のスクリプト)
1228          * @return bool                         Magic3システムディレクトリ以下のアクセスのときはtrue。それ以外の場合はfalse。
1229          */
1230         public function isSystemUrlAccess($url = '')
1231         {
1232                 if (empty($url)) $url = $_SERVER["HTTP_REFERER"];
1233                 
1234                 $url = str_replace('https://', 'http://', $url);                // 一旦httpに統一
1235                 $systemUrl = str_replace('https://', 'http://', $this->getRootUrl());           // 一旦httpに統一
1236                 $systemSslUrl = str_replace('https://', 'http://', $this->getSslRootUrl());             // 一旦httpに統一
1237                         
1238                 // パスを解析
1239                 $relativePath = str_replace($systemUrl, '', $url);              // ルートURLからの相対パスを取得
1240                 if (empty($relativePath)){                      // Magic3のルートURLの場合
1241                         return true;
1242                 } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1243                         return true;
1244                 } else {                // ルートURL以外のURLのとき(SSL用のURL以下かどうかチェック)
1245                         $relativePath = str_replace($systemSslUrl, '', $url);           // ルートURLからの相対パスを取得
1246                         if (empty($relativePath)){                      // Magic3のルートURLの場合
1247                                 return true;
1248                         } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1249                                 return true;
1250                         } else {                // ルートURL以外のURLのとき(SSL用のURL以下かどうかチェック)
1251                                 return false;
1252                         }
1253                 }
1254         }
1255         /**
1256          * 管理者用URLへのアクセスかどうか
1257          *
1258          * @param string $url           判断対象のURL(空のときは現在のスクリプト)
1259          * @return bool                         管理者用ディレクトリへのアクセスのときは、true。それ以外の場合はfalse。
1260          */
1261         public function isAdminUrlAccess($url = '')
1262         {
1263                 if (empty($url)) $url = $_SERVER["HTTP_REFERER"];
1264                 
1265                 $url = str_replace('https://', 'http://', $url);                // 一旦httpに統一
1266                 $adminUrl = str_replace('https://', 'http://', $this->getAdminUrl());           // 一旦httpに統一
1267                         
1268                 // パスを解析
1269                 $relativePath = str_replace($adminUrl, '', $url);               // ルートURLからの相対パスを取得
1270                 if (empty($relativePath)){                      // Magic3のルートURLの場合
1271                         return true;
1272                 } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1273                         return true;
1274                 } else {                // ルートURL以外のURLのとき
1275                         return false;
1276                 }
1277         }
1278         /**
1279          * 管理者用URLへのアクセスかどうか
1280          *
1281          * @return bool         管理者用ディレクトリへのアクセスのときはtrue。それ以外の場合はfalse。
1282          */
1283         public function isAdminDirAccess()
1284         {
1285                 static $isAdminDirAccess;
1286                 
1287                 if (!isset($isAdminDirAccess)){
1288                         if (dirname($this->getCurrentScriptPath()) == $this->getAdminPath()){
1289                                 $isAdminDirAccess = true;
1290                         } else {
1291                                 $isAdminDirAccess = false;
1292                         }
1293                 }
1294                 return $isAdminDirAccess;
1295         }
1296         // ##################### カレントのテンプレート関係 #####################
1297         /**
1298          * 現在のテンプレートを設定
1299          *
1300          * @param string $name                          テンプレートID
1301          * @param string $subTemplateId         サブテンプレートID
1302          * @return                                                      なし
1303          */
1304         public function setCurrentTemplateId($name, $subTemplateId = '')
1305         {
1306                 global $gPageManager;
1307                 
1308                 $this->currentTemplateId = $name;
1309
1310                 // テンプレートの属性を取得
1311                 $this->currentSubTemplateId = '';       // 現在のサブテンプレートID
1312                 $this->currentTemplateType = 0;
1313                 $this->currentTemplateGenerator = '';           // テンプレート作成アプリケーション
1314                 $this->currentTemplateVersion = '';             // テンプレートバージョン
1315                 $this->currentTemplateCleanType = 0;
1316                 $this->currentTemplateUseBootstrap = false;     // 現在のテンプレートでBootstrapライブラリを使用するかどうか
1317                 if ($this->canUseDb){           // DB使用可能なとき
1318                         if ($this->db->getTemplate($name, $row)){
1319                                 $this->currentTemplateType = $row['tm_type'];           // テンプレートタイプ
1320                                 $this->currentTemplateGenerator = $row['tm_generator'];         // テンプレート作成アプリケーション
1321                                 $this->currentTemplateVersion = $row['tm_version'];             // テンプレートバージョン
1322                                 $this->currentTemplateCleanType = $row['tm_clean_type'];        // 現在のテンプレートのクリーンタイプ
1323                                 $this->currentTemplateUseBootstrap = $row['tm_use_bootstrap'];  // 現在のテンプレートでBootstrapライブラリを使用するかどうか
1324                                 $this->currentTemplateInfoRow = $row;           // 現在のテンプレートの情報
1325                                 
1326                                 // テンプレートが設定された段階でBootstrapの使用があればページマネージャーに反映する。ウィジェット側で使用状況を参照してビューを作成することがあるため。
1327                                 if ($this->currentTemplateUseBootstrap) $gPageManager->useBootstrap();
1328                                 
1329                                 if (!empty($subTemplateId)) $this->currentSubTemplateId = $subTemplateId;       // 現在のサブテンプレートID
1330                         }
1331                 }
1332         }
1333         /**
1334          * 現在のテンプレートを取得
1335          *
1336          * @return string               テンプレートID
1337          */
1338         public function getCurrentTemplateId()
1339         {
1340                 return $this->currentTemplateId;
1341         }
1342         /**
1343          * 現在のサブテンプレートを取得
1344          *
1345          * @return string               サブテンプレートID
1346          */
1347         public function getCurrentSubTemplateId()
1348         {
1349                 return $this->currentSubTemplateId;
1350         }
1351         /**
1352          * 現在のテンプレートタイプ
1353          *
1354          * @return int          0=デフォルトテンプレート(Joomla!v1.0),1=Joomla!v1.5,2=Joomla!v2.5,10=Bootstrap v3.0
1355          */
1356         public function getCurrentTemplateType()
1357         {
1358                 return $this->currentTemplateType;
1359         }
1360         /**
1361          * テンプレート作成アプリケーション
1362          *
1363          * @return string               テンプレート作成アプリケーション(artisteer,themler)
1364          */
1365         public function getCurrentTemplateGenerator()
1366         {
1367                 return $this->currentTemplateGenerator;
1368         }
1369         /**
1370          * テンプレートバージョン
1371          *
1372          * @return string               バージョン文字列
1373          */
1374         public function getCurrentTemplateVersion()
1375         {
1376                 return $this->currentTemplateVersion;
1377         }
1378         /**
1379          * 現在のテンプレートのクリーンタイプ
1380          *
1381          * @return int          クリーンタイプ
1382          */
1383         public function getCurrentTemplateCleanType()
1384         {
1385                 return $this->currentTemplateCleanType;
1386         }
1387         /**
1388          * 現在のテンプレートでBootstrapライブラリを使用するかどうか
1389          *
1390          * @return bool         true=使用、false=未使用
1391          */
1392         public function getCurrentTemplateUseBootstrap()
1393         {
1394                 return $this->currentTemplateUseBootstrap;
1395         }
1396         /**
1397          * 現在のビュー作成タイプを設定
1398          *
1399          * @param string $renderType    ビュー作成タイプ
1400          * @return                                              なし
1401          */
1402         public function setCurrentRenderType($renderType)
1403         {
1404                 $this->currentRenderType = $renderType;
1405         }
1406         /**
1407          * 現在のビュー作成タイプを取得
1408          *
1409          * @return string                       ビュー作成タイプ
1410          */
1411         public function getCurrentRenderType()
1412         {
1413                 return $this->currentRenderType;
1414         }
1415         /**
1416          * 現在のテンプレートへのパスを取得
1417          *
1418          * 例) /var/www/html/magic3/templates/menu
1419          */
1420         public function getCurrentTemplatePath()
1421         {
1422                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $this->currentTemplateId;
1423         }
1424         /**
1425          * 現在のテンプレートへのURLを取得
1426          *
1427          * 例) http://www.magic3.org/magic3/templates/menu
1428          */
1429         public function getCurrentTemplateUrl()
1430         {
1431                 //return M3_SYSTEM_ROOT_URL . '/templates/' . $this->currentTemplateId;
1432                 return $this->currentDomainRootUrl . '/templates/' . $this->currentTemplateId;
1433         }
1434         /**
1435          * 現在のテンプレートのカスタマイズパラメータを取得
1436          *
1437          * @return string                       カスタマイズデータ(シリアライズ)
1438          */
1439         public function getCurrentTemplateCustomParam()
1440         {
1441                 return $this->currentTemplateInfoRow['tm_custom_params'];               // 現在のテンプレートの情報
1442         }
1443         /**
1444          * 現在のテンプレートのカスタマイズパラメータを更新
1445          *
1446          * @param string $params        カスタマイズデータ(シリアライズ)
1447          * @return bool                         true=成功、false=失敗
1448          */
1449         public function updateCurrentTemplateCustomParam($params)
1450         {
1451                 $updateParam = array();
1452                 $updateParam['tm_custom_params'] = $params;
1453                 $ret = $this->db->updateTemplate($this->currentTemplateId, $updateParam);
1454                 return $ret;
1455         }
1456         // ##################### カレントのウィジェット関係 #####################
1457         /**
1458          * 現在処理中のウィジェットのルートディレクトリへのパスを取得
1459          *
1460          * 例) http://www.magic3.org/magic3/widgets/xxxxx
1461          */
1462         public function getCurrentWidgetRootUrl()
1463         {
1464                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId;
1465                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId;
1466         }
1467         /**
1468          * 現在処理中のウィジェットのSSLルートディレクトリへのパスを取得
1469          *
1470          * 例) https://www.magic3.org/magic3/widgets/xxxxx
1471          */
1472         public function getCurrentWidgetSslRootUrl()
1473         {
1474                 return $this->getSslRootUrl() . '/widgets/' . $this->currentWidgetId;
1475         }
1476         /**
1477          * 現在処理中のウィジェットのルートディレクトリへのパスを取得
1478          */
1479         public function getCurrentWidgetRootPath()
1480         {
1481                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . $this->currentWidgetId;
1482         }
1483         /**
1484          * 現在処理中のウィジェットのincludeディレクトリへのパスを取得
1485          */
1486         public function getCurrentWidgetIncludePath()
1487         {
1488                 return M3_SYSTEM_ROOT_PATH . '/widgets/' . $this->currentWidgetId . '/include';
1489         }
1490         /**
1491          * 現在処理中のウィジェットのdbディレクトリへのパスを取得
1492          *
1493          * 例) /var/www/html/magic3/widgets/xxxxx/include/db
1494          */
1495         public function getCurrentWidgetDbPath()
1496         {
1497                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
1498         }
1499         /**
1500          * 現在処理中のウィジェットのcontainerディレクトリへのパスを取得
1501          *
1502          * 例) /var/www/html/magic3/widgets/xxxxx/include/container
1503          */
1504         public function getCurrentWidgetContainerPath()
1505         {
1506                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
1507         }
1508         /**
1509          * 現在処理中のウィジェットのlibディレクトリへのパスを取得
1510          *
1511          * 例) /var/www/html/magic3/widgets/xxxxx/include/lib
1512          */
1513         public function getCurrentWidgetLibPath()
1514         {
1515                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'lib';
1516         }
1517         /**
1518          * 現在処理中のウィジェットのtemplateディレクトリへのパスを取得
1519          *
1520          * 例) /var/www/html/magic3/widgets/xxxxx/include/template
1521          */
1522         public function getCurrentWidgetTemplatePath()
1523         {
1524                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'template';
1525         }
1526         /**
1527          * 現在処理中のウィジェットのlocaleディレクトリへのパスを取得
1528          *
1529          * 例) /var/www/html/magic3/widgets/xxxxx/include/locale
1530          */
1531         public function getCurrentWidgetLocalePath()
1532         {
1533                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'locale';
1534         }
1535         /**
1536          * 現在処理中のウィジェットのsqlディレクトリへのパスを取得
1537          *
1538          * 例) /var/www/html/magic3/widgets/xxxxx/include/sql
1539          */
1540         public function getCurrentWidgetSqlPath()
1541         {
1542                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'sql';
1543         }
1544         /**
1545          * 現在処理中のウィジェットのscriptsディレクトリへURLを取得
1546          */
1547         public function getCurrentWidgetScriptsUrl()
1548         {
1549                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/scripts';
1550                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/scripts';
1551         }
1552         /**
1553          * 現在処理中のウィジェットのimagesディレクトリへURLを取得
1554          */
1555         public function getCurrentWidgetImagesUrl()
1556         {
1557                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/images';
1558                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/images';
1559         }
1560         /**
1561          * 現在処理中のウィジェットのscriptsディレクトリへURLを取得
1562          */
1563         public function getCurrentWidgetCssUrl()
1564         {
1565                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/css';
1566                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/css';
1567         }
1568         /**
1569          * 現在処理中のインナーウィジェットのルートディレクトリへのパスを取得
1570          *
1571          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy
1572          */
1573         public function getCurrentIWidgetRootPath()
1574         {
1575                 // ウィジェットIDとインナーウィジェットIDを取り出す
1576                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1577
1578                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId;
1579         }
1580         /**
1581          * 現在処理中のインナーウィジェットのdbディレクトリへのパスを取得
1582          *
1583          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy/include/db
1584          */
1585         public function getCurrentIWidgetDbPath()
1586         {
1587                 // ウィジェットIDとインナーウィジェットIDを取り出す
1588                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1589
1590                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
1591         }
1592         /**
1593          * 現在処理中のインナーウィジェットのdbディレクトリへのパスを取得
1594          *
1595          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy/include/container
1596          */
1597         public function getCurrentIWidgetContainerPath()
1598         {
1599                 // ウィジェットIDとインナーウィジェットIDを取り出す
1600                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1601
1602                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
1603         }
1604         /**
1605          * 現在実行中のウィジェットオブジェクトを設定
1606          *
1607          * @param object $obj           ウィジェットオブジェクト
1608          * @return                                      なし
1609          */
1610         public function setCurrentWidgetObj($obj)
1611         {
1612                 $this->currentWidgetObj = $obj;
1613         }
1614         /**
1615          * 現在実行中のウィジェットオブジェクトを取得
1616          *
1617          * @return object               ウィジェットオブジェクト
1618          */
1619         public function getCurrentWidgetObj()
1620         {
1621                 return $this->currentWidgetObj;
1622         }
1623         /**
1624          * 現在処理中のウィジェット
1625          */
1626         public function setCurrentWidgetId($id = '')
1627         {
1628                 $this->currentWidgetId = $id;
1629         }
1630         /**
1631          * 現在処理中のウィジェット
1632          */
1633         public function getCurrentWidgetId()
1634         {
1635                 return $this->currentWidgetId;
1636         }
1637         /**
1638          * 現在処理中のインナーウィジェット
1639          */
1640         public function setCurrentIWidgetId($id = '')
1641         {
1642                 $this->currentIWidgetId = $id;
1643         }
1644         /**
1645          * 現在処理中のインナーウィジェット
1646          */
1647         public function getCurrentIWidgetId()
1648         {
1649                 return $this->currentIWidgetId;
1650         }
1651         /**
1652          * 現在作成中のウィジェットの定義ID
1653          *
1654          * @param int,string $id                定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1655          */
1656         public function setCurrentWidgetConfigId($id)
1657         {
1658                 $this->currentWidgetConfigId = $id;
1659         }
1660         /**
1661          * 現在作成中のウィジェットの定義ID
1662          *
1663          * @return int,string                   定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1664          */
1665         public function getCurrentWidgetConfigId()
1666         {
1667                 return $this->currentWidgetConfigId;
1668         }
1669         /**
1670          * 現在作成中のインナーウィジェットの定義ID
1671          *
1672          * @param in,string $id         定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1673          */
1674         public function setCurrentIWidgetConfigId($id)
1675         {
1676                 $this->currentIWidgetConfigId = $id;
1677         }
1678         /**
1679          * 現在作成中のインナーウィジェットの定義ID
1680          *
1681          * @return int,string                   定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1682          */
1683         public function getCurrentIWidgetConfigId()
1684         {
1685                 return $this->currentIWidgetConfigId;
1686         }
1687         /**
1688          * 現在処理中のウィジェットのプレフィックス文字列
1689          */
1690         public function setCurrentWidgetPrefix($val)
1691         {
1692                 $this->currentWidgetPrefix = $val;
1693         }
1694         /**
1695          * 現在処理中のウィジェットのプレフィックス文字列
1696          */
1697         public function getCurrentWidgetPrefix()
1698         {
1699                 return $this->currentWidgetPrefix;
1700         }
1701         /**
1702          * 現在処理中のウィジェットのヘッドタイトル文字列を設定
1703          *
1704          * @param string $val   タイトル文字列
1705          * @return                              なし
1706          */
1707         public function setCurrentWidgetHeadTitle($val)
1708         {
1709                 $this->currentWidgetHeadTitle = $val;
1710         }
1711         /**
1712          * 現在処理中のウィジェットのヘッドタイトル文字列を取得
1713          *
1714          * @return string       タイトル文字列
1715          */
1716         public function getCurrentWidgetHeadTitle()
1717         {
1718                 return $this->currentWidgetHeadTitle;
1719         }
1720         /**
1721          * 現在処理中のウィジェットのタイトル文字列
1722          *
1723          * @param string $val   タイトル文字列
1724          * @return                              なし
1725          */
1726         public function setCurrentWidgetTitle($val)
1727         {
1728                 $this->currentWidgetTitle = $val;
1729         }
1730         /**
1731          * 現在処理中のウィジェットのタイトル文字列
1732          *
1733          * @return string       タイトル文字列
1734          */
1735         public function getCurrentWidgetTitle()
1736         {
1737                 return $this->currentWidgetTitle;
1738         }
1739         /**
1740          * 現在処理中のウィジェットのパラメータ設定
1741          *
1742          * @param string $key   キー
1743          * @param string $val   値
1744          * @return                              なし
1745          */
1746         public function setCurrentWidgetParams($key, $val)
1747         {
1748                 $this->currentWidgetParams[$key] = $val;
1749         }
1750         /**
1751          * 現在処理中のウィジェットのパラメータから値取得
1752          *
1753          * @param string $key   キー
1754          * @return string               値
1755          */
1756         public function getCurrentWidgetParams($key)
1757         {
1758                 return $this->currentWidgetParams[$key];
1759         }
1760         /**
1761          * 現在処理中のウィジェットのスタイル文字列
1762          *
1763          * @param bool $val     スタイル文字列
1764          * @return                      なし
1765          */
1766         public function setCurrentWidgetStyle($val)
1767         {
1768                 $this->currentWidgetStyle = $val;
1769         }
1770         /**
1771          * 現在処理中のウィジェットのスタイル文字列
1772          *
1773          * @return string       スタイル文字列
1774          */
1775         public function getCurrentWidgetStyle()
1776         {
1777                 return $this->currentWidgetStyle;
1778         }
1779         /**
1780          * 現在作成中のウィジェットのJoomla用パラメータを設定
1781          *
1782          * @param array $val    Joomla用パラメータ
1783          * @return              なし
1784          */
1785         public function setCurrentWidgetJoomlaParam($val)
1786         {
1787                 $this->currentWidgetJoomlaParam = $val;
1788         }
1789         /**
1790          * 現在作成中のウィジェットのJoomla用パラメータを取得
1791          *
1792          * @return array        Joomla用パラメータ
1793          */
1794         public function getCurrentWidgetJoomlaParam()
1795         {
1796                 return $this->currentWidgetJoomlaParam;
1797         }
1798         /**
1799          * 現在作成中のウィジェットが共通ウィジェットかどうかを設定
1800          *
1801          * @param bool          $val    現在のウィジェットの共通ウィジェット状態
1802          */
1803         public function setIsCurrentWidgetShared($val)
1804         {
1805                 $this->isCurrentWidgetShared = $val;
1806         }
1807         /**
1808          * 現在作成中のウィジェットが共通ウィジェットかどうか
1809          */
1810         public function isCurrentWidgetShared()
1811         {
1812                 return $this->isCurrentWidgetShared;
1813         }
1814         /**
1815          * 現在処理を行っているページ定義のレコードのシリアル番号
1816          *
1817          * @param int $serial           シリアル番号
1818          */
1819         public function setCurrentPageDefSerial($serial)
1820         {
1821                 $this->currentPageDefSerial = $serial;
1822         }
1823         /**
1824          * 現在処理を行っているページ定義のレコードのシリアル番号
1825          *
1826          * @return int                  シリアル番号
1827          */
1828         public function getCurrentPageDefSerial()
1829         {
1830                 return $this->currentPageDefSerial;
1831         }
1832         /**
1833          * 現在処理を行っているページ定義レコードを設定
1834          *
1835          * @param array $rec                    ページ定義レコード
1836          * @return                                              なし
1837          */
1838         public function setCurrentPageDefRec($rec = null)
1839         {
1840                 $this->currentPageDefRec = $rec;
1841         }
1842         /**
1843          * 現在処理を行っているページ定義レコードを取得
1844          *
1845          * @return array                        ページ定義レコード
1846          */
1847         public function getCurrentPageDefRec()
1848         {
1849                 return $this->currentPageDefRec;
1850         }
1851         // ##################### ユーザ情報 #####################
1852         /**
1853          * 現在アクセス中のユーザ情報取得
1854          *
1855          * @return UserInfo             ユーザ情報。設定されていない場合はnullを返す。
1856          */
1857         public function getCurrentUserInfo()
1858         {
1859                 global $gInstanceManager;
1860
1861                 return $gInstanceManager->getUserInfo();
1862         }
1863         /**
1864          * 現在アクセス中のユーザID取得
1865          *
1866          * @return int          ユーザID,ユーザが確定できないときは0
1867          */
1868         public function getCurrentUserId()
1869         {
1870                 global $gInstanceManager;
1871
1872                 $userInfo = $gInstanceManager->getUserInfo();
1873                 if (is_null($userInfo)){                // ログインしていない場合
1874                         return 0;
1875                 } else {
1876                         return $userInfo->userId;
1877                 }
1878         }
1879         /**
1880          * 現在アクセス中のユーザのアカウント取得
1881          *
1882          * @return string               ユーザアカウント,ユーザが確定できないときは空文字列
1883          */
1884         public function getCurrentUserAccount()
1885         {
1886                 global $gInstanceManager;
1887
1888                 $userInfo = $gInstanceManager->getUserInfo();
1889                 if (is_null($userInfo)){                // ログインしていない場合
1890                         return '';
1891                 } else {
1892                         return $userInfo->account;
1893                 }
1894         }
1895         /**
1896          * 現在アクセス中のユーザの名前を取得
1897          *
1898          * @return string               ユーザ名,ユーザが確定できないときは空文字列
1899          */
1900         public function getCurrentUserName()
1901         {
1902                 global $gInstanceManager;
1903
1904                 $userInfo = $gInstanceManager->getUserInfo();
1905                 if (is_null($userInfo)){                // ログインしていない場合
1906                         return '';
1907                 } else {
1908                         return $userInfo->name;
1909                 }
1910         }
1911         /**
1912          * 現在アクセス中のユーザのタイプを取得
1913          *
1914          * @return int          ユーザ名,ユーザが確定できないときは0
1915          */
1916         public function getCurrentUserType()
1917         {
1918                 global $gInstanceManager;
1919
1920                 $userInfo = $gInstanceManager->getUserInfo();
1921                 if (is_null($userInfo)){                // ログインしていない場合
1922                         return 0;
1923                 } else {
1924                         return $userInfo->userType;
1925                 }
1926         }
1927         /**
1928          * 現在アクセス中のユーザのEメールを取得
1929          *
1930          * @return string               Eメールが確定できないときは空文字列
1931          */
1932         public function getCurrentUserEmail()
1933         {
1934                 global $gInstanceManager;
1935
1936                 $userInfo = $gInstanceManager->getUserInfo();
1937                 if (is_null($userInfo)){                // ログインしていない場合
1938                         return '';
1939                 } else {
1940                         return $userInfo->email;
1941                 }
1942         }
1943         /**
1944          * 現在のユーザがアクセス可能なウィジェットを取得
1945          *
1946          * @return array                ウィジェット
1947          */
1948 /*      public function getAccessableWidget()
1949         {
1950                 global $gInstanceManager;
1951
1952                 $userInfo = $gInstanceManager->getUserInfo();
1953                 if (is_null($userInfo)){                // ログインしていない場合
1954                         return array();
1955                 } else {
1956                         return $userInfo->adminWidget;
1957                 }
1958         }*/
1959         /**
1960          * 現在のユーザが指定のウィジェットの管理画面が使用可能かを取得
1961          *
1962          * @param string $widgetId      ウィジェットID
1963          * @return bool                         true=使用可能、false=使用不可
1964          */
1965         public function canUseWidgetAdmin($widgetId)
1966         {
1967                 global $gInstanceManager;
1968
1969                 $canUseAdmin = false;
1970                 $userInfo = $gInstanceManager->getUserInfo();
1971                 if (!is_null($userInfo)){               // ログイン中の場合
1972                         if ($userInfo->userType == UserInfo::USER_TYPE_SYS_ADMIN){      // システム管理者の場合
1973                                 $canUseAdmin = true;
1974                         } else if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){ // システム運用者の場合
1975                                 $accessWidget = $userInfo->adminWidget;
1976                                 if (empty($accessWidget)){
1977                                         $canUseAdmin = true;
1978                                 } else {
1979                                         if (in_array($widgetId, $accessWidget)) $canUseAdmin = true;
1980                                 }
1981                         }
1982                 }
1983                 return $canUseAdmin;
1984         }
1985         /**
1986          * 現在のユーザがユーザタイプオプションを持っているかを取得
1987          *
1988          * @param string $option        ユーザタイプオプション
1989          * @return bool                         true=オプションあり、false=オプションなし
1990          */
1991         public function hasUserTypeOption($option)
1992         {
1993                 global $gInstanceManager;
1994
1995                 $hasOption = false;
1996                 $userInfo = $gInstanceManager->getUserInfo();
1997                 if (!is_null($userInfo)){               // ログイン中の場合
1998                         if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){        // システム運用者の場合
1999                                 $pos = strpos($userInfo->userTypeOption, $option);
2000                                 if ($pos !== false) $hasOption = true;
2001                         }
2002                 }
2003                 return $hasOption;
2004         }
2005         /**
2006          * 現在アクセス中のユーザに管理者権限があるかどうかを返す
2007          *
2008          * @return bool         true=ログイン中かつ管理者権限あり、false=未ログインまたはログイン中であるが管理者権限なし
2009          */
2010         public function isSystemAdmin()
2011         {
2012                 $isAdmin = false;
2013                 $userInfo = $this->getCurrentUserInfo();
2014                 if (is_null($userInfo)){                // ログインしていない場合
2015                 } else {
2016                         if ($userInfo->isSystemAdmin()){        // システム管理者の場合
2017                                 $isAdmin = true;
2018                         }
2019                 }
2020                 return $isAdmin;
2021         }
2022         /**
2023          * 現在アクセス中のユーザにシステム運用者かどうかを返す
2024          *
2025          * @param string $optionType    ユーザオプションタイプ
2026          * @return bool                                 true=システム運用者、false=システム運用者ではない
2027          */
2028         public function isSystemManager(&$optionType = NULL)
2029         {
2030                 $isManager = false;
2031                 $userInfo = $this->getCurrentUserInfo();
2032                 if (is_null($userInfo)){                // ログインしていない場合
2033                 } else {
2034                         if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){        // システム運用者の場合
2035                                 $optionType = $userInfo->userOptType;
2036                                 $isManager = true;
2037                         }
2038                 }
2039                 return $isManager;
2040         }
2041         /**
2042          * 現在アクセス中のユーザにシステム運用権限があるかどうかを返す
2043          *
2044          * @return bool         true=システム運用可、false=システム運用不可
2045          */
2046         public function isSystemManageUser()
2047         {
2048                 $canManage = false;
2049                 $userInfo = $this->getCurrentUserInfo();
2050                 if (is_null($userInfo)){                // ログインしていない場合
2051                 } else {
2052                         if ($userInfo->userType >= UserInfo::USER_TYPE_MANAGER){        // システム運用者以上の場合
2053                                 $canManage = true;
2054                         }
2055                 }
2056                 return $canManage;
2057         }
2058         /**
2059          * 現在アクセス中のユーザにコンテンツ編集権限があるかどうかを返す
2060          *
2061          * @return bool         true=コンテンツ編集可、false=コンテンツ編集不可
2062          */
2063         public function isContentEditableUser()
2064         {
2065                 $canManage = false;
2066                 $userInfo = $this->getCurrentUserInfo();
2067                 if (is_null($userInfo)){                // ログインしていない場合
2068                 } else {
2069                         if ($userInfo->userType >= UserInfo::USER_TYPE_AUTHOR){ // 投稿ユーザ以上の場合
2070                                 $canManage = true;
2071                         }
2072                 }
2073                 return $canManage;
2074         }
2075         /**
2076          * 現在アクセス中のユーザがリソース制限必要なユーザかどうかを返す
2077          *
2078          * @return bool         true=制限が必要、false=制限なし
2079          */
2080         public function isResourceLimitedUser()
2081         {
2082                 global $gInstanceManager;
2083
2084                 $resourceLimited = true;                // デフォルトはリソース制限あり
2085                 $userInfo = $gInstanceManager->getUserInfo();
2086 /*              if (!is_null($userInfo)){               // ログイン中の場合
2087                         if ($userInfo->userType == UserInfo::USER_TYPE_SYS_ADMIN){      // システム管理者の場合
2088                                 $resourceLimited = false;
2089                         } else if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER && empty($userInfo->userOptType)){                        // システム運用者でユーザタイプオプションがない場合
2090                                 $resourceLimited = false;
2091                         }
2092                 }*/
2093                 // リソースアクセス制限はページマネージャーのパーソナルモード時と同じにする
2094                 if (!empty($userInfo)) $resourceLimited = $userInfo->isPersonal();
2095                 return $resourceLimited;
2096         }
2097         /**
2098          * 現在アクセス中のユーザがログインしているか確認
2099          *
2100          * @return bool         true=ログイン中、false=未ログイン
2101          */
2102         public function isCurrentUserLogined()
2103         {
2104                 $userInfo = $this->getCurrentUserInfo();
2105                 if (is_null($userInfo)){                // ログインしていない場合
2106                         return false;
2107                 } else {
2108                         return true;
2109                 }
2110         }
2111         /**
2112          * 指定のユーザに管理者権限があるかどうかを返す
2113          *
2114          * @param int $userId   ユーザID
2115          * @return bool                 true=管理者権限あり、false=管理者権限なし
2116          */
2117         public function isSystemAdminUser($userId)
2118         {
2119                 return $this->db->isSystemAdmin($userId);
2120         }
2121         // ##################### アクセスログ #####################
2122         /**
2123          * 現在のアクセスログのシリアル番号を返す
2124          *
2125          * @return int                  アクセスログシリアル番号
2126          */
2127         public function getCurrentAccessLogSerial()
2128         {
2129                 global $gAccessManager;
2130                 return $gAccessManager->getAccessLogSerialNo();
2131         }
2132         /**
2133          * アクセスポイントパスを設定
2134          *
2135          * @param string $path          アクセスポイントパス
2136          * @return なし
2137          */
2138         public function setAccessPath($path)
2139         {
2140                 $this->accessPath = $path;              // アクセスポイントパス
2141                 $pathArray = explode('/', $path);
2142                 if (count($pathArray) >= 2){
2143                         $this->accessDir = $pathArray[0];                       // アクセスポイントディレクトリ
2144                 } else {
2145                         $this->accessDir = '';
2146                 }
2147         }
2148         /**
2149          * アクセスポイントパスを取得
2150          *
2151          * @return string                       アクセスポイントパス
2152          */
2153         public function getAccessPath()
2154         {
2155                 return $this->accessPath;
2156         }
2157         /**
2158          * アクセスポイントディレクトリを取得
2159          *
2160          * @return string                       アクセスポイントディレクトリ
2161          */
2162         public function getAccessDir()
2163         {
2164                 return $this->accessDir;
2165         }
2166         // ##################### ページ制御 #####################
2167         /**
2168          * デフォルトのページID取得
2169          *
2170          * @return string                       デフォルトのページID
2171          */
2172         public function getDefaultPageId()
2173         {
2174                 return self::DEFAULT_PAGE_ID;
2175         }
2176         /**
2177          * デフォルトの登録機能用ページID
2178          *
2179          * @return string                       デフォルトのページID
2180          */
2181         public function getDefaultRegistPageId()
2182         {
2183                 return self::DEFAULT_REGIST_PAGE_ID;
2184         }
2185         /**
2186          * 携帯用デフォルトのページID取得
2187          *
2188          * @return string                       携帯用デフォルトのページID
2189          */
2190         public function getDefaultMobilePageId()
2191         {
2192                 return self::DEFAULT_MOBILE_PAGE_ID;
2193         }
2194         /**
2195          * スマートフォン用デフォルトのページID取得
2196          *
2197          * @return string                       スマートフォン用デフォルトのページID
2198          */
2199         public function getDefaultSmartphonePageId()
2200         {
2201                 return self::DEFAULT_SMARTPHONE_PAGE_ID;
2202         }
2203         /**
2204          * デフォルトの管理機能用ページID取得
2205          *
2206          * @return string                       デフォルトの管理機能用ページID
2207          */
2208         public function getDefaultAdminPageId()
2209         {
2210                 return self::DEFAULT_ADMIN_PAGE_ID;
2211         }
2212         /**
2213          * フロント画面のデフォルトのページID取得
2214          *
2215          * @return array                        ページID(0=PC,1=携帯,2=スマートフォン)
2216          */
2217         public function getAllDefaultPageId()
2218         {
2219                 return array(self::DEFAULT_PAGE_ID, self::DEFAULT_MOBILE_PAGE_ID, self::DEFAULT_SMARTPHONE_PAGE_ID);
2220         }
2221         /**
2222          * フロント画面のデフォルトのアクセスポイント取得
2223          *
2224          * @return array                        アクセスポイント(0=PC,1=携帯,2=スマートフォン)
2225          */
2226         public function getAllDefaultAccessPoint()
2227         {
2228                 return array('', M3_DIR_NAME_MOBILE, M3_DIR_NAME_SMARTPHONE);
2229         }
2230         /**
2231          * 現在のアクセスポイント取得
2232          *
2233          * @return string                       アクセスポイント(空文字列=PC,m=携帯,s=スマートフォン)
2234          */
2235         public function getCurrentAccessPoint()
2236         {
2237                 $accessPoint = '';
2238                 
2239                 switch ($this->currentPageId){
2240                 case self::DEFAULT_PAGE_ID:
2241                 default:
2242                         break;
2243                 case self::DEFAULT_MOBILE_PAGE_ID:
2244                         $accessPoint = M3_DIR_NAME_MOBILE;
2245                         break;
2246                 case self::DEFAULT_SMARTPHONE_PAGE_ID:
2247                         $accessPoint = DEFAULT_SMARTPHONE_PAGE_ID;
2248                         break;
2249                 }
2250                 return $accessPoint;
2251         }
2252         /**
2253          * 現在のページID
2254          */
2255         public function setCurrentPageId($id)
2256         {
2257                 // 現在のページIDが変更のときは、デフォルトのページサブIDを更新
2258                 if ($this->canUseDb && $this->currentPageId != $id){
2259                         $deviceType = 0;                // 端末タイプ取得
2260                         $this->defaultPageSubId = $this->db->getDefaultPageSubId($id, $deviceType);
2261                         $this->currentPageDeviceType = $deviceType;             // 現在のページの端末タイプ
2262                 }
2263                 $this->currentPageId = $id;
2264         }
2265         /**
2266          * 現在のページID
2267          */
2268         public function getCurrentPageId()
2269         {
2270                 return $this->currentPageId;
2271         }
2272         /**
2273          * 現在のページサブID
2274          */
2275         public function setCurrentPageSubId($id)
2276         {
2277                 $this->currentPageSubId = $id;
2278         }
2279         /**
2280          * 現在のページサブID
2281          */
2282         public function getCurrentPageSubId()
2283         {
2284                 return $this->currentPageSubId;
2285         }
2286         /**
2287          * 現在のページのデフォルトのページサブID
2288          *
2289          * @return string               デフォルトのページサブID
2290          */
2291         public function getDefaultPageSubId()
2292         {
2293                 return $this->defaultPageSubId;
2294         }
2295         /**
2296          * 管理画面のデフォルトのページサブID
2297          *
2298          * @return string               デフォルトのページサブID
2299          */
2300         public function getAdminDefaultPageSubId()
2301         {
2302                 return $this->getDefaultPageSubIdByPageId(self::DEFAULT_ADMIN_PAGE_ID);
2303         }
2304         /**
2305          * 指定ページのデフォルトのページサブID
2306          *
2307          * @param string $pageId        ページID
2308          * @return string                       デフォルトのページサブID
2309          */
2310         public function getDefaultPageSubIdByPageId($pageId)
2311         {
2312                 return $this->db->getDefaultPageSubId($pageId);
2313         }
2314         /**
2315          * 現在実行中のウィジェット用のページサブID取得
2316          *
2317          * @return string               ページサブID。共通属性ありの場合、現在のページサブIDがデフォルトページサブIDと同じときは空。
2318          */
2319         public function getCurrentWidgetPageSubId()
2320         {
2321                 if ($this->isCurrentWidgetShared) return '';            // 共通属性ありの場合
2322                 
2323                 if ($this->currentPageSubId == $this->defaultPageSubId) return '';
2324                 
2325                 return $this->currentPageSubId;
2326         }
2327         /**
2328          * コンテンツ種別からデフォルトのページサブID取得
2329          *
2330          * @param string $pageId                ページID
2331          * @param string $contentType   コンテンツ種別    * @return string                               ページサブID
2332          */
2333         public function getPageSubIdByContentType($pageId, $contentType)
2334         {
2335                 $pageSubId = $this->db->getSubPageIdWithContent($contentType, $pageId);// ページサブIDを取得
2336                 return $pageSubId;
2337         }
2338         /**
2339          * 現在のページの端末タイプを取得
2340          *
2341          * @return string               端末タイプ(0=PC、1=携帯、2=スマートフォン)
2342          */
2343         public function getCurrentPageDeviceType()
2344         {
2345                 return $this->currentPageDeviceType;            // 現在のページの端末タイプ
2346         }
2347         /**
2348          * 現在のページID、サブページIDのURLを作成
2349          *
2350          * @param bool          $withPageSubId          ページサブIDを付加するかどうか
2351          * @return string               作成したURL
2352          */
2353         public function createCurrentPageUrl($withPageSubId = true)
2354         {
2355                 $url = $this->createPageUrl();
2356                 if ($withPageSubId) $url .= '?sub=' . $this->getCurrentPageSubId();
2357                 return $url;
2358         }
2359         /**
2360          * 指定ページIDのURLを作成
2361          *
2362          * @param string $pageId        ページID。空のときは現在のページIDから作成
2363          * @param string $isSslPage     SSLが必要なページかどうか
2364          * @return string                       作成したURL
2365          */
2366         public function createPageUrl($pageId='', $isSslPage = false)
2367         {
2368                 if (empty($pageId)) $pageId = $this->getCurrentPageId();
2369                 if (empty($pageId)) $pageId = $this->getDefaultPageId();// 空のときはデフォルトページIDを設定
2370                 
2371                 // ページIDからパスを求める
2372                 $path = '';
2373                 $pathArray = explode('_', $pageId);
2374                 if ($this->multiDomain){                        // マルチドメイン運用の場合
2375                         $path = '/' . $pathArray[count($pathArray) - 1];
2376                 } else {
2377                         for ($i = 0; $i < count($pathArray); $i++){
2378                                 $path .= '/' . $pathArray[$i];
2379                         }
2380                 }
2381                 if ($isSslPage){                        // SSLページのとき
2382                         $url = $this->getSslRootUrl() . $path . '.php';
2383                 } else {
2384                         $url = $this->getRootUrl() . $path . '.php';
2385                 }
2386                 return $url;
2387         }
2388         /**
2389          * 現在のページID、サブページIDのURLを作成(セッションID付き)
2390          *
2391          * @return string               作成したURL
2392          */
2393         /*public function createCurrentPageUrlWithSessionId()
2394         {
2395                 return $this->getCurrentScriptUrl() . '?sub=' . $this->getCurrentPageSubId() . '&' . session_name() . '=' . session_id();
2396         }*/
2397         /**
2398          * 携帯用の現在のページID、サブページIDのURLを作成
2399          *
2400          * 携帯用URLには以下の情報を付加する
2401          * ・セッションID
2402          * ・ドコモ端末の場合はiモードID受信用のパラメータを付加
2403          *
2404          * @param string,array  $addParam               追加パラメータ
2405          * @param bool          $withSessionId  セッションIDを付加するかどうか
2406          * @return string               作成したURL
2407          */
2408         public function createCurrentPageUrlForMobile($addParam = '', $withSessionId = true)
2409         {
2410                 // ページサブID付加
2411                 $param['sub'] = $this->getCurrentPageSubId();
2412
2413                 // 追加パラメータがある場合
2414                 if (!empty($addParam)){
2415                         if (is_array($addParam)){               // 配列の場合
2416                                 $newParam = $addParam;
2417                         } else {                // 文字列の場合
2418                                 $newParam = array();
2419                                 $addParamArray = explode('&', trim($addParam, "?&"));
2420                                 for ($i = 0; $i < count($addParamArray); $i++){
2421                                         list($key, $value) = explode('=', $addParamArray[$i]);
2422                                         $key = trim($key);
2423                                         $value = trim($value);
2424                                         $newParam[$key] = $value;
2425                                 }
2426                         }
2427                         $param = array_merge($param, $newParam);
2428                 }
2429                 //$url = $this->_createUrl($this->getCurrentScriptUrl(), $param);
2430                 $url = createUrl($this->createPageUrl(), $param);
2431                 return $url;
2432         }
2433         /**
2434          * デフォルト言語取得
2435          */
2436         public function getDefaultLanguage()
2437         {
2438                 return $this->defaultLanguage;
2439         }
2440         /**
2441          * デフォルトの言語名をカレントの言語で表したもの
2442          */
2443         public function getDefaultLanguageNameByCurrentLanguage()
2444         {
2445                 return $this->db->getLanguageNameByDispLanguageId($this->defaultLanguage, $this->currentLanguage);
2446         }
2447         /**
2448          * カレント言語取得
2449          */
2450         public function getCurrentLanguage()
2451         {
2452                 return $this->currentLanguage;
2453         }
2454         /**
2455          * カレント言語設定
2456          */
2457         public function setCurrentLanguage($value)
2458         {
2459                 $this->currentLanguage = $value;
2460                 
2461                 // ロケールも変更
2462                 $locale = $this->defaultLacaleArray[$value];
2463                 if (!empty($locale)) $this->currentLocale = $locale;
2464         }
2465         /**
2466          * デフォルトロケール取得
2467          */
2468         public function getDefaultLocale()
2469         {
2470                 return $this->defaultLocale;
2471         }
2472         /**
2473          * カレントロケール取得
2474          */
2475         public function getCurrentLocale()
2476         {
2477                 return $this->currentLocale;
2478         }
2479         /**
2480          * カレントロケール設定
2481          */
2482         public function setCurrentLocale($value)
2483         {
2484                 $this->currentLocale = $value;
2485         }
2486         /**
2487          * カレント言語の変更可否を取得
2488          */
2489         public function getCanChangeLang()
2490         {
2491                 return $this->canChangeLang;
2492         }
2493         /**
2494          * 多言語対応かどうかを取得(廃止予定 => isMultiLanguageSite())
2495          */
2496         public function getMultiLanguage()
2497         {
2498                 return $this->multiLanguage;
2499         }
2500         /**
2501          * 多言語対応サイトかどうかを取得
2502          */
2503         public function isMultiLanguageSite()
2504         {
2505                 return $this->multiLanguage;
2506         }
2507         /**
2508          * マルチドメイン運用かどうかを取得
2509          *
2510          * @param bool          true=マルチドメイン運用、false=シングルドメイン運用
2511          */
2512         public function isMultiDomain()
2513         {
2514                 return $this->multiDomain;              // マルチドメイン運用かどうか
2515         }
2516         /**
2517          * SSL機能を使用するかどうかを取得
2518          */
2519         public function getUseSsl()
2520         {
2521                 return $this->useSsl;
2522         }
2523         /**
2524          * 管理画面にSSL機能を使用するかどうかを取得
2525          */
2526         public function getUseSslAdmin()
2527         {
2528                 return $this->useSslAdmin;
2529         }
2530         /**
2531          * DBセッションが使用できるかどうか
2532          */
2533         public function canUseDbSession()
2534         {
2535                 return $this->canUseDbSession;
2536         }
2537         /**
2538          * DBが使用可能かどうか
2539          */
2540         public function canUseDb()
2541         {
2542                 return $this->canUseDb;
2543         }
2544         /**
2545          * クッキーが使用可能かどうかを設定
2546          *
2547          * @param bool                  true=使用可、false=使用不可
2548          * @return                              なし
2549          */
2550         public function setCanUseCookie($value)
2551         {
2552                 $this->canUseCookie = $value;
2553         }
2554         /**
2555          * クッキーが使用可能かどうか
2556          *
2557          * @return bool                 true=使用可、false=使用不可
2558          */
2559         public function canUseCookie()
2560         {
2561                 return $this->canUseCookie;
2562         }
2563         /**
2564          * Timestamp型データの初期値を取得
2565          *
2566          * @param string Timestmp型初期データ文字列
2567          */
2568         public function getInitValueOfTimestamp()
2569         {
2570                 if ($this->db->getDbType() == M3_DB_TYPE_MYSQL){                // MySQLの場合
2571                         return M3_TIMESTAMP_INIT_VALUE_MYSQL;
2572                 } else if ($this->db->getDbType() == M3_DB_TYPE_PGSQL){
2573                         return M3_TIMESTAMP_INIT_VALUE_PGSQL;
2574                 } else {
2575                         return '';
2576                 }
2577         }
2578         /**
2579          * Date型データの初期値を取得
2580          *
2581          * @param string Date型初期データ文字列
2582          */
2583         public function getInitValueOfDate()
2584         {
2585                 if ($this->db->getDbType() == M3_DB_TYPE_MYSQL){                // MySQLの場合
2586                         return M3_DATE_INIT_VALUE_MYSQL;
2587                 } else if ($this->db->getDbType() == M3_DB_TYPE_PGSQL){
2588                         return M3_DATE_INIT_VALUE_PGSQL;
2589                 } else {
2590                         return '';
2591                 }
2592         }
2593         /**
2594          * サイトの名称を取得
2595          *
2596          * @param bool $reload  データを再取得するかどうか
2597          * @return string               サイト名称
2598          */
2599         public function getSiteName($reload = false)
2600         {
2601                 // DBが使用不可のときはデフォルト名を返す
2602                 if (!$this->canUseDb) return self::DEFAULT_SITE_NAME;
2603                 
2604                 if ($reload || empty($this->siteName)){                 // サイト名称
2605                         $this->siteName = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_NAME);
2606                         if (empty($this->siteName)) $this->siteName = self::DEFAULT_SITE_NAME;
2607                 }
2608                 return $this->siteName;
2609         }
2610         /**
2611          * サイトの所有者を取得
2612          *
2613          * @param bool $reload  データを再取得するかどうか
2614          * @return string               サイト所有者
2615          */
2616         public function getSiteOwner($reload = false)
2617         {
2618                 // DBが使用不可のときは空文字列を返す
2619                 if (!$this->canUseDb) return '';
2620                 
2621                 if ($reload || empty($this->siteOwner)){                        // サイト所有者
2622                         $this->siteOwner = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_OWNER);
2623                 }
2624                 return $this->siteOwner;
2625         }
2626         /**
2627          * サイトコピーライトを取得
2628          *
2629          * @param bool $reload  データを再取得するかどうか
2630          * @return string               サイトコピーライト
2631          */
2632         public function getSiteCopyRight($reload = false)
2633         {
2634                 // DBが使用不可のときは空文字列を返す
2635                 if (!$this->canUseDb) return '';
2636                 
2637                 if ($reload || empty($this->siteCopyRight)){                    // サイトコピーライト
2638                         $this->siteCopyRight = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_COPYRIGHT);
2639                 }
2640                 return $this->siteCopyRight;
2641         }
2642         /**
2643          * サイトEメールを取得
2644          *
2645          * @param bool $reload  データを再取得するかどうか
2646          * @return string               サイトEメール
2647          */
2648         public function getSiteEmail($reload = false)
2649         {
2650                 // DBが使用不可のときは空文字列を返す
2651                 if (!$this->canUseDb) return '';
2652                 
2653                 if ($reload || empty($this->siteEmail)){                        // サイトEメール
2654                         $this->siteEmail = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_EMAIL);
2655                 }
2656                 return $this->siteEmail;
2657         }
2658         /**
2659          * 現在選択中のメニュー項目を設定
2660          *
2661          * @param array $menuItemData   メニュー項目データ(title=タイトル、url=リンク)の配列
2662          * @return                                              なし
2663          */
2664         public function setSelectedMenuItems($menuItemData)
2665         {
2666                 $this->selectedMenuItems = $menuItemData;                               // 現在選択中のメニュー項目
2667         }
2668         /**
2669          * 現在選択中のメニュー項目を取得
2670          *
2671          * @return array                                メニュー項目データ(title=タイトル、url=リンク)
2672          */
2673         public function getSelectedMenuItems()
2674         {
2675                 return $this->selectedMenuItems;                                // 現在選択中のメニュー項目
2676         }
2677         /**
2678          * デフォルトCSV区切り文字コードを取得
2679          *
2680          * @return string               区切り文字
2681          */
2682         public function getDefaultCsvDelimCode()
2683         {
2684                 static $code;
2685                 
2686                 if (!isset($code)){             // 設定されていないとき
2687                         $retValue = $this->gSystem->getSystemConfig(self::DEFAULT_CSV_DELIM_CODE);
2688                         if (empty($retValue)){
2689                                 $code = ',';
2690                         } else {
2691                                 $code = $retValue;
2692                         }
2693                 }
2694                 return $code;
2695         }
2696         /**
2697          * デフォルトCSV改行コードを取得
2698          *
2699          * @return string               改行文字
2700          */
2701         public function getDefaultCsvNLCode()
2702         {
2703                 static $code;
2704                 
2705                 if (!isset($code)){             // 設定されていないとき
2706                         $retValue = $this->gSystem->getSystemConfig(self::DEFAULT_CSV_NL_CODE);
2707                         if (empty($retValue)){
2708                                 $code = '\r\n';
2709                         } else {
2710                                 $code = $retValue;
2711                         }
2712                 }
2713                 return $code;
2714         }
2715         /**
2716          * デフォルトCSVファイル拡張子を取得
2717          *
2718          * @return string               改行文字
2719          */
2720         public function getDefaultCsvFileSuffix()
2721         {
2722                 return $this->gSystem->getSystemConfig(self::DEFAULT_CSV_FILE_SUFFIX);
2723         }
2724         /**
2725          * CSVファイルのダウンロードエンコーディングを取得
2726          *
2727          * @return string               エンコーディング
2728          */
2729         public function getCsvDownloadEncoding()
2730         {
2731                 static $encoding;
2732                 
2733                 if (!isset($encoding)){         // 設定されていないとき
2734                         $retValue = $this->gSystem->getSystemConfig(self::CF_CSV_DOWNLOAD_ENCODING);
2735                         if (empty($retValue)){
2736                                 $encoding = 'SJIS-win';
2737                         } else {
2738                                 $encoding = $retValue;
2739                         }
2740                 }
2741                 return $encoding;
2742         }
2743         /**
2744          * CSVファイルのアップロードロードエンコーディングを取得
2745          *
2746          * @return string               エンコーディング
2747          */
2748         public function getCsvUploadEncoding()
2749         {
2750                 static $encoding;
2751                 
2752                 if (!isset($encoding)){         // 設定されていないとき
2753                         $retValue = $this->gSystem->getSystemConfig(self::CF_CSV_UPLOAD_ENCODING);
2754                         if (empty($retValue)){
2755                                 $encoding = 'SJIS-win';
2756                         } else {
2757                                 $encoding = $retValue;
2758                         }
2759                 }
2760                 return $encoding;
2761         }
2762         /**
2763          * ウィジェット実行ログを残すかどうか
2764          *
2765          * @return bool         true=ログ出力、false=ログ出力しない
2766          */
2767         public function getWidgetLog()
2768         {
2769                 return $this->widgetLog;
2770         }
2771         /**
2772          * PC用URLへのアクセスかどうかを設定(管理画面はPC用URLとしない)
2773          *
2774          * @param bool $status                  true=PC用アクセス、false=PC用管理画面のアクセス
2775          * @return                      なし
2776          */
2777         public function setIsPcSite($status)
2778         {
2779                 $this->isPcSite = $status;
2780         }
2781         /**
2782          * PC用URLへのアクセスかどうか(管理画面はPC用URLとしない)
2783          *
2784          * @return bool         true=PC用アクセス、false=PC用管理画面のアクセス
2785          */
2786         public function getIsPcSite()
2787         {
2788                 return $this->isPcSite;
2789         }
2790         /**
2791          * 携帯用URLへのアクセスかどうかを設定
2792          *
2793          * @param bool $status                  true=携帯アクセス、false=通常アクセス
2794          * @return                      なし
2795          */
2796         public function setIsMobileSite($status)
2797         {
2798                 $this->isMobileSite = $status;
2799                 
2800                 if ($this->isMobile() && $status){
2801                         // ##### 携帯用の設定 #####
2802                         // セッションをURLに保存
2803                         ini_set('session.use_cookies', 0);      // クッキーは使用しない
2804                 }
2805         }
2806         /**
2807          * 携帯用URLへのアクセスかどうか
2808          *
2809          * @return bool         true=携帯アクセス、false=通常アクセス
2810          */
2811         public function getIsMobileSite()
2812         {
2813                 return $this->isMobileSite;
2814         }
2815         /**
2816          * スマートフォン用URLへのアクセスかどうかを設定
2817          *
2818          * @param bool $status                  true=スマートフォン用URLへのアクセス、false=スマートフォン用URL以外へのアクセス
2819          * @return                      なし
2820          */
2821         public function setIsSmartphoneSite($status)
2822         {
2823                 $this->isSmartphoneSite = $status;
2824         }
2825         /**
2826          * スマートフォン用URLへのアクセスかどうか
2827          *
2828          * @return bool         true=スマートフォン用URLへのアクセス、false=スマートフォン用URL以外へのアクセス
2829          */
2830         public function getIsSmartphoneSite()
2831         {
2832                 return $this->isSmartphoneSite;
2833         }
2834         /**
2835          * サブウィジェットの起動かどうかを設定
2836          *
2837          * @param bool $status                  true=サブウィジェットでの起動、false=通常のウィジェット起動
2838          * @return                      なし
2839          */
2840         public function setIsSubWidget($status)
2841         {
2842                 $this->isSubWidget = $status;
2843         }
2844         /**
2845          * サブウィジェットの起動かどうか
2846          *
2847          * @return bool         true=サブウィジェットでの起動、false=通常のウィジェット起動
2848          */
2849         public function getIsSubWidget()
2850         {
2851                 return $this->isSubWidget;
2852         }
2853         /**
2854          * サーバ接続かどうかを設定
2855          *
2856          * @param bool $status                  true=サーバ接続、false=サーバ接続でない
2857          * @return                      なし
2858          */
2859         public function setIsServerConnector($status)
2860         {
2861                 $this->isServerConnector = $status;
2862         }
2863         /**
2864          * サーバ接続かどうか
2865          *
2866          * @return bool         true=サーバ接続、false=サーバ接続でない
2867          */
2868         public function isServerConnector()
2869         {
2870                 return $this->isServerConnector;
2871         }
2872         /**
2873          * 携帯端末IDを取得
2874          *
2875          * @return string               携帯端末ID
2876          */
2877         public function getMobileId()
2878         {
2879                 global $gInstanceManager;
2880                 global $gRequestManager;
2881                 
2882                 $agent = $gInstanceManager->getMobileAgent();
2883                 if ($agent->isDoCoMo()){        // ドコモ端末のとき
2884                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_DCMGUID');
2885                         if (!empty($mobileId)) $mobileId = 'DC-' . $mobileId;           // キャリアコードを付加
2886                 } else if ($agent->isEZweb()){  // au端末のとき
2887                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_UP_SUBNO');
2888                         // ドメイン名を消去
2889                         $pos = strpos($mobileId, '.ezweb.ne.jp');
2890                         if ($pos !== false) $mobileId = substr($mobileId, 0, $pos);
2891                         if (!empty($mobileId)) $mobileId = 'AU-' . $mobileId;           // キャリアコードを付加
2892                 } else if ($agent->isSoftBank()){       // ソフトバンク端末のとき
2893                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_JPHONE_UID');
2894                         if (!empty($mobileId)) $mobileId = 'SB-' . $mobileId;           // キャリアコードを付加
2895                 } else {                // その他の端末のとき(PC用)
2896                         $mobileId = '';
2897                 }
2898                 return $mobileId;
2899         }
2900         /**
2901          * 携帯端末でのアクセスかどうか
2902          *
2903          * @return bool         true=携帯端末アクセス、false=携帯端末以外からのアクセス
2904          */
2905         public function isMobile()
2906         {
2907                 global $gInstanceManager;
2908                 static $isMobile;
2909                 
2910                 if (!isset($isMobile)){
2911                         $isMobile = false;
2912                         $agent = $gInstanceManager->getMobileAgent();
2913                         if (method_exists($agent, 'isNonMobile')){
2914                                 if (!$agent->isNonMobile()){                    // 携帯端末でのアクセスの場合
2915                                         $isMobile = true;
2916                                 }
2917                         }
2918                 }
2919                 return $isMobile;
2920         }
2921         /**
2922          * スマートフォン端末でのアクセスかどうか
2923          *
2924          * @return bool         true=スマートフォン端末アクセス、false=スマートフォン端末以外からのアクセス
2925          */
2926         public function isSmartphone()
2927         {
2928                 global $gRequestManager;
2929                 static $isSmartphone;
2930                 
2931                 if (!isset($isSmartphone)){
2932                         $isSmartphone = false;
2933                         $agent = $gRequestManager->trimServerValueOf('HTTP_USER_AGENT');
2934                         if (preg_match('/android/i', $agent)){
2935                                 $isSmartphone = true;
2936                         } else if (preg_match('/ipod/i', $agent) || preg_match('/iphone/i', $agent)){
2937                                 $isSmartphone = true;
2938                         }
2939                 }
2940                 return $isSmartphone;
2941         }
2942         /**
2943          * 管理画面の小画面デバイス最適化を行うかどうか
2944          *
2945          * @return bool         true=最適化を行う、false=最適化を行わない
2946          */
2947         public function isSmallDeviceAdmin()
2948         {
2949                 static $isSmallDeviceAdmin;
2950                 
2951                 if (!isset($isSmallDeviceAdmin)){
2952                         // マルチデバイス最適化管理画面かどうか
2953                         $multiDeviceAdmin = $this->gSystem->getSystemConfig(self::CF_MULTI_DEVICE_ADMIN);
2954                         if ($multiDeviceAdmin){
2955                                 // 小画面デバイスかどうか判断
2956                                 require_once(M3_SYSTEM_LIB_PATH . self::DETECT_DEVICE_SCRIPT);
2957                                 
2958                                 $detect = new Mobile_Detect;
2959                                 if ($detect->isMobile() && !$detect->isTablet()){               // 小画面デバイスかどうか(モバイルかつタブレットではない)
2960                                         $isSmallDeviceAdmin = true;
2961                                 } else {
2962                                         $isSmallDeviceAdmin = false;
2963                                 }
2964                         } else {
2965                                 $isSmallDeviceAdmin = false;
2966                         }
2967                 }
2968                 return $isSmallDeviceAdmin;
2969         }
2970         /**
2971          * メニューの表示属性を設定
2972          *
2973          * @param array $attr           メニュー表示属性
2974          * @return                                      なし
2975          */
2976         public function setMenuAttr($attr)
2977         {
2978                 $this->menuAttr = $attr;
2979         }
2980         /**
2981          * メニューの表示属性を取得
2982          *
2983          * @return array                メニュー表示属性
2984          */
2985         public function getMenuAttr()
2986         {
2987                 return $this->menuAttr;
2988         }
2989         /**
2990          * Joomla!ドキュメントを設定
2991          *
2992          * @param object $doc                   Joomla!ドキュメントオブジェクト
2993          * @return                                              なし
2994          */
2995         public function setJoomlaDocument($text)
2996         {
2997                 $this->joomlaDocument = $text;
2998         }
2999         /**
3000          * Joomla!ドキュメントを取得
3001          *
3002          * @return object               Joomla!ドキュメントオブジェクト
3003          */
3004         public function getJoomlaDocument()
3005         {
3006                 return $this->joomlaDocument;
3007         }
3008         /**
3009          * Joomla!v1.5用メニューコンテンツを設定
3010          *
3011          * @param string $text                  メニューコンテンツ文字列
3012          * @return                      なし
3013          */
3014         public function setJoomlaMenuContent($text)
3015         {
3016                 $this->joomlaMenuContent = $text;
3017         }
3018         /**
3019          * Joomla!v1.5用メニューコンテンツを取得
3020          *
3021          * @return string               メニューコンテンツ文字列
3022          */
3023         public function getJoomlaMenuContent()
3024         {
3025                 return $this->joomlaMenuContent;
3026         }
3027         /**
3028          * Joomla!v2.5用メニュー階層データを設定
3029          *
3030          * @param array $menuData               メニュー階層データ
3031          * @return                                              なし
3032          */
3033         public function setJoomlaMenuData($menuData)
3034         {
3035                 $this->joomlaMenuData = $menuData;
3036         }
3037         /**
3038          * Joomla!v2.5用メニュー階層データを取得
3039          *
3040          * @return array                メニューデータ
3041          */
3042         public function getJoomlaMenuData()
3043         {
3044                 return $this->joomlaMenuData;
3045         }
3046         /**
3047          * Joomla!v2.5用ページ前後遷移データを設定
3048          *
3049          * @param array $navData                ページ遷移データ
3050          * @return                                              なし
3051          */
3052         public function setJoomlaPageNavData($navData)
3053         {
3054                 $this->joomlaPageNavData = $navData;
3055         }
3056         /**
3057          * Joomla!v2.5用ページ前後遷移データを取得
3058          *
3059          * @return array                ページ遷移データ
3060          */
3061         public function getJoomlaPageNavData()
3062         {
3063                 return $this->joomlaPageNavData;
3064         }
3065         /**
3066          * Joomla!v2.5用ページ番号遷移データを設定
3067          *
3068          * @param array $data           ページ遷移データ
3069          * @return                                      なし
3070          */
3071         public function setJoomlaPaginationData($data)
3072         {
3073                 $this->joomlaPaginationData = $data;
3074         }
3075         /**
3076          * Joomla!v2.5用ページ番号遷移データを取得
3077          *
3078          * @return array                ページ遷移データ
3079          */
3080         public function getJoomlaPaginationData()
3081         {
3082                 return $this->joomlaPaginationData;
3083         }
3084         /**
3085          * Joomla!用ビュー作成用データを設定
3086          *
3087          * @param array $viewData               ビュー作成データ
3088          * @return                                              なし
3089          */
3090         public function setJoomlaViewData($viewData)
3091         {
3092                 $this->joomlaViewData = $viewData;
3093         }
3094         /**
3095          * Joomla!用ビュー作成用データを取得
3096          *
3097          * @return array                ビュー作成データ
3098          */
3099         public function getJoomlaViewData()
3100         {
3101                 return $this->joomlaViewData;
3102         }
3103         /**
3104          * WordPressヘッダ部出力データ(Javascript)を設定
3105          *
3106          * @param string $headData              ヘッダ部出力データ
3107          * @return                                              なし
3108          */
3109         public function setWpHeadScriptsData($headData)
3110         {
3111                 $this->wpHeadScriptsData = $headData;
3112         }
3113         /**
3114          * WordPressヘッダ部出力データ(Javascript)を取得
3115          *
3116          * @return string                       ヘッダ部出力データ
3117          */
3118         public function getWpHeadScriptsData()
3119         {
3120                 return $this->wpHeadScriptsData;
3121         }
3122         /**
3123          * WordPressコンポーネント生成ファイルパスを設定
3124          *
3125          * @param string $path                  ファイルパス
3126          * @return                                              なし
3127          */
3128         public function setWpComponentPath($path)
3129         {
3130                 $this->wpComponentPath = $path;
3131         }
3132         /**
3133          * WordPressコンポーネント生成ファイルパスを取得
3134          *
3135          * @return string                       ファイルパス
3136          */
3137         public function getWpComponentPath()
3138         {
3139                 return $this->wpComponentPath;
3140         }
3141         /**
3142          * WordPressウィジェットクラス名を設定
3143          *
3144          * @param string $class                 クラス名
3145          * @return                                              なし
3146          */
3147         public function setWpWidgetClass($class)
3148         {
3149                 $this->wpWidgetClass = $class;
3150         }
3151         /**
3152          * WordPressウィジェットクラス名を取得
3153          *
3154          * @return string                       ファイルパス
3155          */
3156         public function getWpWidgetClass()
3157         {
3158                 return $this->wpWidgetClass;
3159         }
3160         /**
3161          * リモート表示コンテンツを設定
3162          *
3163          * @param string $position              配置ポジション名
3164          * @param string $data                  コンテンツデータ
3165          * @return                                              なし
3166          */
3167         public function setRemoteContent($position, $data)
3168         {
3169                 $this->remoteContent[$position] = $data;
3170         }
3171         /**
3172          * リモート表示コンテンツを取得
3173          *
3174          * @param string $position              配置ポジション名
3175          * @return string                               コンテンツデータ
3176          */
3177         public function getRemoteContent($position)
3178         {
3179                 return $this->remoteContent[$position];
3180         }
3181 }
3182 ?>