1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
|
---|
4 | *
|
---|
5 | * http://www.lockon.co.jp/
|
---|
6 | */
|
---|
7 |
|
---|
8 | $SC_VIEW_PHP_DIR = realpath(dirname(__FILE__));
|
---|
9 | require_once($SC_VIEW_PHP_DIR . "/../module/Smarty/libs/Smarty.class.php");
|
---|
10 | require_once($SC_VIEW_PHP_DIR . "/../include/php_ini.inc");
|
---|
11 |
|
---|
12 | class SC_View {
|
---|
13 |
|
---|
14 | var $_smarty;
|
---|
15 | var $objSiteInfo; // ¥µ¥¤¥È¾ðÊó
|
---|
16 |
|
---|
17 | // ¥³¥ó¥¹¥È¥é¥¯¥¿
|
---|
18 | function SC_View($siteinfo = true) {
|
---|
19 | global $SC_VIEW_PHP_DIR;
|
---|
20 |
|
---|
21 | $this->_smarty = new Smarty;
|
---|
22 | $this->_smarty->left_delimiter = '<!--{';
|
---|
23 | $this->_smarty->right_delimiter = '}-->';
|
---|
24 | $this->_smarty->register_modifier("sfDispDBDate","sfDispDBDate");
|
---|
25 | $this->_smarty->register_modifier("sfMBDispDBDate","sfMBDispDBDate");
|
---|
26 | $this->_smarty->register_modifier("sfConvSendDateToDisp","sfConvSendDateToDisp");
|
---|
27 | $this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp");
|
---|
28 | $this->_smarty->register_modifier("sfGetVal", "sfGetVal");
|
---|
29 | $this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle");
|
---|
30 | $this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor");
|
---|
31 | $this->_smarty->register_function("sfTrim", "sfTrim");
|
---|
32 | $this->_smarty->register_function("sfPreTax", "sfPreTax");
|
---|
33 | $this->_smarty->register_function("sfPrePoint", "sfPrePoint");
|
---|
34 | $this->_smarty->register_function("sfGetChecked", "sfGetChecked");
|
---|
35 | $this->_smarty->register_function("sfGetCheckedArray", "sfGetCheckedArray");
|
---|
36 | $this->_smarty->register_function("sfTrimURL", "sfTrimURL");
|
---|
37 | $this->_smarty->register_function("sfMultiply", "sfMultiply");
|
---|
38 | $this->_smarty->register_function("sfPutBR", "sfPutBR");
|
---|
39 | $this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash");
|
---|
40 | $this->_smarty->register_function("sfCutString", "sfCutString");
|
---|
41 | $this->_smarty->plugins_dir=array("plugins", $SC_VIEW_PHP_DIR . "/../smarty_extends");
|
---|
42 | $this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding");
|
---|
43 | $this->_smarty->register_function("sf_mktime","sf_mktime");
|
---|
44 | $this->_smarty->register_function("sf_date","sf_date");
|
---|
45 | $this->_smarty->register_function("str_replace","str_replace");
|
---|
46 | $this->_smarty->register_function("sfPrintEbisTag","sfPrintEbisTag");
|
---|
47 | $this->_smarty->register_function("sfPrintAffTag","sfPrintAffTag");
|
---|
48 | $this->_smarty->register_function("sfPresentDisp","sfPresentDisp");
|
---|
49 | $this->_smarty->register_function("sfPrintRegular","sfPrintRegular");
|
---|
50 |
|
---|
51 | if(ADMIN_MODE == '1') {
|
---|
52 | $this->time_start = time();
|
---|
53 | }
|
---|
54 |
|
---|
55 | // ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ¤¹¤ë
|
---|
56 | if($siteinfo) {
|
---|
57 | if(!defined('LOAD_SITEINFO')) {
|
---|
58 | $this->objSiteInfo = new SC_SiteInfo();
|
---|
59 | $arrInfo['arrSiteInfo'] = $this->objSiteInfo->data;
|
---|
60 |
|
---|
61 | // ÅÔÆ»Éܸ©Ì¾¤òÊÑ´¹
|
---|
62 | global $arrPref;
|
---|
63 | $arrInfo['arrSiteInfo']['pref'] = $arrPref[$arrInfo['arrSiteInfo']['pref']];
|
---|
64 |
|
---|
65 | // ¥µ¥¤¥È¾ðÊó¤ò³ä¤êÅö¤Æ¤ë
|
---|
66 | foreach ($arrInfo as $key => $value){
|
---|
67 | $this->_smarty->assign($key, $value);
|
---|
68 | }
|
---|
69 |
|
---|
70 | define('LOAD_SITEINFO', 1);
|
---|
71 | }
|
---|
72 | }
|
---|
73 | }
|
---|
74 |
|
---|
75 | // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃͤò³ä¤êÅö¤Æ¤ë
|
---|
76 | function assign($val1, $val2) {
|
---|
77 | $this->_smarty->assign($val1, $val2);
|
---|
78 | }
|
---|
79 |
|
---|
80 | // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ
|
---|
81 | function fetch($template) {
|
---|
82 | return $this->_smarty->fetch($template);
|
---|
83 | }
|
---|
84 |
|
---|
85 | // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òɽ¼¨
|
---|
86 | function display($template, $no_error = false) {
|
---|
87 | if(!$no_error) {
|
---|
88 | global $GLOBAL_ERR;
|
---|
89 | if(!defined('OUTPUT_ERR')) {
|
---|
90 | print($GLOBAL_ERR);
|
---|
91 | define('OUTPUT_ERR','ON');
|
---|
92 | }
|
---|
93 | }
|
---|
94 |
|
---|
95 | $this->_smarty->display($template);
|
---|
96 | if(ADMIN_MODE == '1') {
|
---|
97 | $time_end = time();
|
---|
98 | $time = $time_end - $this->time_start;
|
---|
99 | print("½èÍý»þ´Ö:" . $time . "ÉÃ");
|
---|
100 | }
|
---|
101 |
|
---|
102 | print($_SERVER['SERVER_ADDR']);
|
---|
103 | }
|
---|
104 |
|
---|
105 | // ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
|
---|
106 | function assignobj($obj) {
|
---|
107 | $data = get_object_vars($obj);
|
---|
108 |
|
---|
109 | foreach ($data as $key => $value){
|
---|
110 | $this->_smarty->assign($key, $value);
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | // Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
|
---|
115 | function assignarray($array) {
|
---|
116 | foreach ($array as $key => $val) {
|
---|
117 | $this->_smarty->assign($key, $val);
|
---|
118 | }
|
---|
119 | }
|
---|
120 |
|
---|
121 | /* ¥µ¥¤¥È½é´üÀßÄê */
|
---|
122 | function initpath() {
|
---|
123 | global $SC_VIEW_PHP_DIR;
|
---|
124 |
|
---|
125 | $array['tpl_mainnavi'] = $SC_VIEW_PHP_DIR . '/../Smarty/templates/frontparts/mainnavi.tpl';
|
---|
126 | //$array['tpl_root_id'] = sfGetRootId();
|
---|
127 | $this->assignarray($array);
|
---|
128 | }
|
---|
129 | }
|
---|
130 |
|
---|
131 | class SC_AdminView extends SC_View{
|
---|
132 | function SC_AdminView() {
|
---|
133 | parent::SC_View(false);
|
---|
134 | $this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
|
---|
135 | $this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
|
---|
136 | $this->initpath();
|
---|
137 | }
|
---|
138 |
|
---|
139 | function printr($data){
|
---|
140 | print_r($data);
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | class SC_SiteView extends SC_View{
|
---|
145 | function SC_SiteView($cart = true) {
|
---|
146 | parent::SC_View();
|
---|
147 | $this->_smarty->template_dir = TEMPLATE_DIR;
|
---|
148 | $this->_smarty->compile_dir = COMPILE_DIR;
|
---|
149 | $this->initpath();
|
---|
150 |
|
---|
151 | // PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊѹ¹
|
---|
152 | sfDomainSessionStart();
|
---|
153 | }
|
---|
154 | }
|
---|
155 |
|
---|
156 | class SC_UserView extends SC_SiteView{
|
---|
157 | function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
|
---|
158 | parent::SC_SiteView();
|
---|
159 | $this->_smarty->template_dir = $template_dir;
|
---|
160 | $this->_smarty->compile_dir = $compile_dir;
|
---|
161 | }
|
---|
162 | }
|
---|
163 |
|
---|
164 | class SC_InstallView extends SC_View{
|
---|
165 | function SC_InstallView($template_dir, $compile_dir = COMPILE_DIR) {
|
---|
166 | parent::SC_View(false);
|
---|
167 | $this->_smarty->template_dir = $template_dir;
|
---|
168 | $this->_smarty->compile_dir = $compile_dir;
|
---|
169 | }
|
---|
170 | }
|
---|
171 |
|
---|
172 | ?> |
---|