/**
  * The IntSmarty constructor, called when a new instance
  * is created.
  *
  * @param string $lang The default language to assume when translating or
  *                     omit to auto-detect
  */
 function __construct($lang = NULL)
 {
     parent::__construct();
     $this->lang_path = INSTALL_PATH . '/lang/';
     $this->translation = array();
     $this->translation_size = 0;
     $this->register_prefilter("smarty_lang_prefilter");
     $this->register_function("i18nfile", "smarty_function_i18nfile");
     $this->a_languages = array_unique($this->_determineLangs());
     if (!is_null($lang)) {
         array_unshift($this->a_languages, $lang);
     }
     if (isset($this->a_languages[0])) {
         $this->cur_language = $this->a_languages[0];
     } else {
         $this->cur_language = NULL;
     }
     $this->compile_id = $this->cur_language;
     foreach ($this->a_languages as $lang) {
         $this->cur_language = $lang;
         if ($this->loadLanguageTable($this->cur_language)) {
             break;
         }
     }
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->compile_dir = APPPATH . "cache/Smarty/compile";
     $this->template_dir = APPPATH . "/views/";
     $this->setTemplateDir(APPPATH . "/views/");
     $this->assign('APPPATH', APPPATH);
     $this->assign('BASEPATH', BASEPATH);
     // Assign CodeIgniter object by reference to CI
     if (method_exists($this, 'assignByRef')) {
         $ci =& get_instance();
         $this->assignByRef("ci", $ci);
     }
     log_message('debug', "Smarty Class Initialized");
 }
Example #3
0
 /**
  * Constructor - Sets the templateDir and compileDir for the Smarty files
  * @param <String> - $media Layout/Media name
  */
 function __construct($media = '')
 {
     parent::__construct();
     $THISDIR = dirname(__FILE__);
     $templatesDir = '';
     $compileDir = '';
     $templateDir = [];
     if (!empty($media)) {
         self::$currentLayout = $media;
         $customTemplatesDir = $THISDIR . '/../../custom/layouts/' . $media;
         $templateDir[] = $THISDIR . '/../../layouts/' . $media;
         $compileDir = $THISDIR . '/../../cache/templates_c/' . $media;
     }
     $defaultLayout = vglobal('defaultLayout');
     if ($defaultLayout && is_file(vglobal('root_directory') . '/layouts/' . $defaultLayout)) {
         $templateDir[] = $THISDIR . '/../../layouts/' . $defaultLayout;
     }
     if (empty($templatesDir) || !file_exists($templatesDir)) {
         self::$currentLayout = self::getDefaultLayoutName();
         $templateDir[] = $THISDIR . '/../../custom/layouts/' . self::getDefaultLayoutName();
         $templateDir[] = $THISDIR . '/../../layouts/' . self::getDefaultLayoutName();
         $compileDir = $THISDIR . '/../../cache/templates_c/' . self::getDefaultLayoutName();
     }
     if (!file_exists($compileDir)) {
         mkdir($compileDir, 0777, true);
     }
     $this->setTemplateDir($templateDir);
     $this->setCompileDir($compileDir);
     self::$debugViewer = SysDebug::get('DEBUG_VIEWER');
     // FOR SECURITY
     // Escape all {$variable} to overcome XSS
     // We need to use {$variable nofilter} to overcome double escaping
     // TODO: Until we review the use disabled.
     //$this->registerFilter('variable', array($this, 'safeHtmlFilter'));
     // FOR DEBUGGING: We need to have this only once.
     static $debugViewerURI = false;
     if (self::$debugViewer && $debugViewerURI === false) {
         $debugViewerURI = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
         if (!empty($_POST)) {
             $debugViewerURI .= '?' . http_build_query($_POST);
         } else {
             $debugViewerURI = $_SERVER['REQUEST_URI'];
         }
         $this->log("URI: {$debugViewerURI}, TYPE: " . $_SERVER['REQUEST_METHOD']);
     }
 }
Example #4
0
 /**
  * BitSmarty initiation
  *
  * @access public
  * @return void
  */
 function __construct()
 {
     global $smarty_force_compile, $smarty_debugging;
     parent::__construct();
     $this->mCompileRsrc = NULL;
     $this->config_dir = "configs/";
     // $this->caching = TRUE;
     $this->force_compile = $this->debugging = isset($smarty_debugging) && $smarty_debugging;
     $this->assign('app_name', 'bitweaver');
     $this->addPluginsDir(THEMES_PKG_PATH . "smartyplugins");
     $this->register_prefilter("add_link_ticket");
     $this->error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT;
     global $permCheck;
     $permCheck = new PermissionCheck();
     // SMARTY3	$this->register_object( 'perm', $permCheck, array(), TRUE, array( 'autoComplete' ));
     $this->assign_by_ref('perm', $permCheck);
 }
Example #5
0
 /**
  */
 public function __construct()
 {
     parent::__construct();
     $config = CampSite::GetConfigInstance();
     $this->debugging = $config->getSetting('smarty.debugging');
     $this->force_compile = $config->getSetting('smarty.force_compile');
     $this->compile_check = $config->getSetting('smarty.compile_check');
     $this->use_sub_dirs = $config->getSetting('smarty.use_subdirs');
     // cache settings
     $preferencesService = \Zend_Registry::get('container')->getService('system_preferences_service');
     $this->useprotocol = $preferencesService->get('SmartyUseProtocol') === 'Y' ? 'true' : 'false';
     $this->templateCacheHandler = $preferencesService->TemplateCacheHandler;
     if ($this->templateCacheHandler) {
         $this->caching = 1;
         $this->caching_type = 'newscoop';
         CampTemplateCache::factory();
     } else {
         $this->caching = 0;
     }
     if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'development') {
         $this->force_compile = true;
     }
     // define dynamic uncached block
     require_once APPLICATION_PATH . self::PLUGINS . '/block.dynamic.php';
     $this->registerPlugin('block', 'dynamic', 'smarty_block_dynamic', false);
     // define render function
     require_once APPLICATION_PATH . self::PLUGINS . '/function.render.php';
     $this->registerPlugin('function', 'render', 'smarty_function_render', false);
     // define translate modifier
     require_once APPLICATION_PATH . self::PLUGINS . '/modifier.translate.php';
     $this->registerPlugin('modifier', 'translate', 'smarty_modifier_translate', false);
     $this->left_delimiter = '{{';
     $this->right_delimiter = '}}';
     $this->auto_literal = false;
     $this->cache_dir = APPLICATION_PATH . '/../cache';
     $this->compile_dir = APPLICATION_PATH . '/../cache';
     $this->plugins_dir = array_merge((array) $this->plugins_dir, array(APPLICATION_PATH . self::PLUGINS), self::getPluginsPluginsDir());
     $this->setTemplateDir(array(APPLICATION_PATH . '/../themes/', APPLICATION_PATH . '/../themes/system_templates/', APPLICATION_PATH . self::SCRIPTS));
     $this->assign('view', \Zend_Registry::get('container')->get('view'));
     $this->assign('userindex', false);
     $this->assign('user', new MetaUser());
     $this->assign('siteinfo', array('title' => $preferencesService->SiteTitle, 'keywords' => $preferencesService->SiteMetaKeywords, 'description' => $preferencesService->SiteMetaDescription));
     $this->getTemplateTranslationsFiles();
 }
 /**
  * Class Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // Store the Codeigniter super global instance... whatever
     $CI = get_instance();
     // Load the Smarty config file
     $CI->load->config('smarty');
     // Turn on/off debug
     $this->debugging = config_item('smarty_debug');
     // Set some pretty standard Smarty directories
     $this->setCompileDir(config_item('compile_directory'));
     $this->setCacheDir(config_item('cache_directory'));
     $this->setConfigDir(config_item('config_directory'));
     $this->addPluginsDir(config_item('plugins_directory'));
     // Default template extension
     $this->template_ext = config_item('template_ext');
     $this->force_compile = 1;
     // How long to cache templates for
     $this->cache_lifetime = config_item('cache_lifetime');
     // Disable Smarty security policy
     $this->disableSecurity();
     // If caching is enabled, then disable force compile and enable cache
     if (config_item('cache_status') === true) {
         $this->enable_caching();
     } else {
         $this->disable_caching();
     }
     // Set the error reporting level
     $this->error_reporting = config_item('template_error_reporting');
     // This will fix various issues like filemtime errors that some people experience
     // The cause of this is most likely setting the error_reporting value above
     // This is a static function in the main Smarty class
     //Smarty::muteExpectedErrors();
     // Should let us access Codeigniter stuff in views
     // This means we can go for example {$this->session->userdata('item')}
     // just like we normally would in standard CI views
     $this->assign("this", $CI);
     //My Vars
     $this->assign('APPPATH', APPPATH);
     $this->assign('BASEPATH', BASEPATH);
     $this->assign('systemurl', base_url());
     $this->assign('template', 'default');
     $this->assign("CI", $CI);
 }
Example #7
0
 function __construct($_name)
 {
     $this->name = $_name;
     parent::__construct();
     $smartyDir = getenv("DOCUMENT_ROOT") . '/Smarty';
     $this->setTemplateDir(".");
     $this->setCompileDir("{$smartyDir}/templates_c/");
     $this->setConfigDir("{$smartyDir}/configs/");
     $this->setCacheDir("{$smartyDir}/cache/");
     //important
     $this->force_compile = true;
     $this->caching = Smarty::CACHING_LIFETIME_CURRENT;
     //??
     $this->assign('app_name', '');
     error_reporting(E_ALL & ~E_NOTICE);
     //        error_reporting(E_ALL ^ E_DEPRECATED);
     //        ini_set('display_errors', '1');
     //        $smarty->debugging = true;
     //        $this->testInstall();
 }
 /**
  * @param modX $modx A reference to the modX object
  * @param array $params An array of configuration parameters
  */
 function __construct(modX &$modx, $params = array())
 {
     parent::__construct();
     $this->modx =& $modx;
     /* set up configuration variables for Smarty. */
     $this->template_dir = $modx->getOption('manager_path') . 'templates/';
     $this->compile_dir = $modx->getOption(xPDO::OPT_CACHE_PATH) . 'mgr/smarty/';
     $this->config_dir = $modx->getOption('core_path') . 'model/smarty/configs';
     $this->plugins_dir = array($this->modx->getOption('core_path') . 'model/smarty/plugins');
     $this->caching = false;
     foreach ($params as $paramKey => $paramValue) {
         $this->{$paramKey} = $paramValue;
     }
     if (!is_dir($this->compile_dir)) {
         $this->modx->getCacheManager();
         $this->modx->cacheManager->writeTree($this->compile_dir);
     }
     $this->assign('app_name', 'MODX');
     $this->_blocks = array();
     $this->_derived = null;
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     $this->CI =& get_instance();
     $config =& get_config();
     $this->caching = false;
     $this->setConfigDir(BASEPATH . 'libraries/Smarty-3.1.21/configs');
     $this->setCacheDir(BASEPATH . '../cache');
     $this->loadPlugin('smarty_compiler_switch');
     if (!class_exists('SmartyPlugin')) {
         $this->CI->load->library('SmartyPlugin');
     }
     $methods = get_class_methods('SmartyPlugin');
     foreach ($methods as $plugin) {
         if ($plugin != '__construct') {
             $this->registerPlugin('function', $plugin, 'SmartyPlugin::' . $plugin);
         }
     }
     $this->theme();
     define('IMGPATH', BASEPATH . '../media/uploads/');
     define('IMGURL', $this->CI->config->item('images_url'));
 }
Example #10
0
 public function __construct(Request $peticion, ACL $_acl)
 {
     //Contruye las variables para la la vista
     parent::__construct();
     $this->_request = $peticion;
     $this->_js = array();
     $this->_acl = $_acl;
     $this->_rutas = array();
     $this->_jsPlugin = array();
     $this->_template = DEFAULT_LAYOUT;
     self::$_item = null;
     //Verifica el modulo y/o controlador para cargar los archivos de la vista y los archivos js
     $modulo = $this->_request->getModulo();
     $controlador = $this->_request->getControlador();
     if ($modulo) {
         $this->_rutas['view'] = ROOT . 'src' . DS . $this->_request->getFolder($modulo) . DS . '_modules' . DS . $modulo . DS . 'views' . DS . $controlador . DS;
         $this->_rutas['js'] = BASE_URL . 'src/' . $this->_request->getFolder($modulo) . '/_modules/' . $modulo . '/views/' . $controlador . '/js/';
     } else {
         $this->_rutas['view'] = ROOT . 'src' . DS . $this->_request->getFolder($controlador) . DS . 'views' . DS . $controlador . DS;
         $this->_rutas['js'] = BASE_URL . 'src/' . $this->_request->getFolder($controlador) . '/views/' . $controlador . '/js/';
     }
     //throw new Exception($this->_rutas['view'] . ' --- ' . $this->_rutas['js']);
 }
Example #11
0
 /**
  * Main constructor
  *
  * @param plugins     $plugins     Galette's plugins
  * @param I18n        $i18n        Galette's I18n
  * @param Preferences $preferences Galette's preferences
  * @param Logo        $logo        Galette's logo
  * @param Login       $login       Galette's login
  * @param array       $session     Galette's session
  */
 function __construct($plugins, $i18n, $preferences, $logo, $login, $session)
 {
     parent::__construct();
     //paths configuration
     $this->setTemplateDir(GALETTE_ROOT . GALETTE_TPL_SUBDIR);
     $this->setCompileDir(GALETTE_COMPILE_DIR);
     $this->setConfigDir(GALETTE_CONFIG_PATH);
     $this->setCacheDir(GALETTE_CACHE_DIR);
     /*if ( GALETTE_MODE !== 'DEV' ) {
           //enable caching
           $this->caching = \Smarty::CACHING_LIFETIME_CURRENT;
           $this->setCompileCheck(false);
       }*/
     $this->addPluginsDir(GALETTE_ROOT . 'includes/smarty_plugins');
     $this->assign('login', $login);
     $this->assign('logo', $logo);
     $this->assign('template_subdir', GALETTE_BASE_PATH . GALETTE_TPL_SUBDIR);
     foreach ($plugins->getTplAssignments() as $k => $v) {
         $this->assign($k, $v);
     }
     $this->assign('tpl', $this);
     $this->assign('headers', $plugins->getTplHeaders());
     $this->assign('plugin_actions', $plugins->getTplAdhActions());
     $this->assign('plugin_batch_actions', $plugins->getTplAdhBatchActions());
     $this->assign('plugin_detailled_actions', $plugins->getTplAdhDetailledActions());
     $this->assign('jquery_dir', GALETTE_BASE_PATH . 'includes/jquery/');
     $this->assign('jquery_version', JQUERY_VERSION);
     $this->assign('jquery_migrate_version', JQUERY_MIGRATE_VERSION);
     $this->assign('jquery_ui_version', JQUERY_UI_VERSION);
     $this->assign('jquery_markitup_version', JQUERY_MARKITUP_VERSION);
     $this->assign('jquery_jqplot_version', JQUERY_JQPLOT_VERSION);
     $this->assign('scripts_dir', GALETTE_BASE_PATH . 'includes/');
     $this->assign('PAGENAME', basename($_SERVER['SCRIPT_NAME']));
     $this->assign('galette_base_path', GALETTE_BASE_PATH);
     $this->assign('GALETTE_VERSION', GALETTE_VERSION);
     $this->assign('GALETTE_MODE', GALETTE_MODE);
     /** galette_lang should be removed and languages used instead */
     $this->assign('galette_lang', $i18n->getAbbrev());
     $this->assign('languages', $i18n->getList());
     $this->assign('plugins', $plugins);
     $this->assign('preferences', $preferences);
     $this->assign('pref_slogan', $preferences->pref_slogan);
     $this->assign('pref_theme', $preferences->pref_theme);
     $this->assign('pref_editor_enabled', $preferences->pref_editor_enabled);
     $this->assign('pref_mail_method', $preferences->pref_mail_method);
     $this->assign('existing_mailing', isset($session['mailing']));
     $this->assign('require_tabs', null);
     $this->assign('require_cookie', null);
     $this->assign('contentcls', null);
     $this->assign('require_tabs', null);
     $this->assign('require_cookie', false);
     $this->assign('additionnal_html_class', null);
     $this->assign('require_calendar', null);
     $this->assign('head_redirect', null);
     $this->assign('error_detected', null);
     $this->assign('warning_detected', null);
     $this->assign('success_detected', null);
     $this->assign('color_picker', null);
     $this->assign('require_sorter', null);
     $this->assign('require_dialog', null);
     $this->assign('require_tree', null);
     $this->assign('html_editor', null);
     $this->assign('require_charts', null);
 }
Example #12
0
 /**
  * Constructor
  *
  * @param array The hash of CMSMS config settings
  */
 public function __construct()
 {
     parent::__construct();
     global $CMS_ADMIN_PAGE;
     // <- Still needed?
     global $CMS_INSTALL_PAGE;
     $config = cmsms()->GetConfig();
     // Do not allow any absolute paths in template resolution.
     $this->no_absolute_templates = TRUE;
     // Set template_c and cache dirs
     $this->setCompileDir(TMP_TEMPLATES_C_LOCATION);
     $this->setCacheDir(TMP_CACHE_LOCATION);
     $this->assign('app_name', 'CMS');
     if ($config["debug"] == true) {
         $this->force_compile = true;
         $this->debugging = false;
     }
     // Set plugins dirs
     $this->addPluginsDir(cms_join_path($config['root_path'], 'plugins'));
     // common resources.
     $this->registerResource('module_db_tpl', new CMSModuleDbTemplateResource());
     $this->registerResource('module_file_tpl', new CMSModuleFileTemplateResource());
     $this->registerResource('template', new CMSPageTemplateResource());
     // <- Should proably be global and removed from parser?
     // Load User Defined Tags
     if (!cmsms()->test_state(CmsApp::STATE_INSTALL)) {
         $utops = cmsms()->GetUserTagOperations();
         $usertags = $utops->ListUserTags();
         $caching = false;
         if (get_site_preference('smarty_cacheudt', 'never') == 'always' && cmsms()->is_frontend_request()) {
             $caching = true;
         }
         foreach ($usertags as $id => $udt_name) {
             $function = $utops->CreateTagFunction($udt_name);
             $this->registerPlugin('function', $udt_name, $function, $caching);
         }
     }
     // register default plugin handler
     $this->registerDefaultPluginHandler(array(&$this, 'defaultPluginHandler'));
     if (cmsms()->is_frontend_request()) {
         $this->setTemplateDir(cms_join_path($config['root_path'], 'tmp', 'templates'));
         $this->setConfigDir(cms_join_path($config['root_path'], 'tmp', 'templates'));
         // Check if we are at install page, don't register anything if so, cause nothing below is needed.
         if (isset($CMS_INSTALL_PAGE)) {
             return;
         }
         if (is_sitedown()) {
             $this->setCaching(false);
             $this->force_compile = true;
         }
         // Load resources
         $this->registerResource('tpl_top', new CMSPageTemplateResource('top'));
         $this->registerResource('tpl_head', new CMSPageTemplateResource('head'));
         $this->registerResource('tpl_body', new CMSPageTemplateResource('body'));
         $this->registerResource('content', new CMSContentTemplateResource());
         //$this->registerResource('htmlblob',new CMSGlobalContentTemplateResource());
         $this->registerResource('globalcontent', new CMSGlobalContentTemplateResource());
         // just for frontend actions.
         $this->registerPlugin('compiler', 'content', array('CMS_Content_Block', 'smarty_compile_fecontentblock'), false);
         $this->registerPlugin('function', 'content_image', 'CMS_Content_Block::smarty_fetch_imageblock', false);
         $this->registerPlugin('function', 'content_module', 'CMS_Content_Block::smarty_fetch_moduleblock', false);
         $this->registerPlugin('function', 'process_pagedata', 'CMS_Content_Block::smarty_fetch_pagedata', false);
         // Autoload filters
         $this->autoloadFilters();
         // compile check can only be enabled, if using smarty cache... just for safety.
         if (get_site_preference('use_smartycache', 0)) {
             if (version_compare(phpversion(), '5.3') >= 0) {
                 $this->setCompileCheck(get_site_preference('use_smartycompilecheck', 1));
             }
         }
     } else {
         if (cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE)) {
             $this->setCaching(false);
             $this->force_compile = true;
             $this->setTemplateDir(cms_join_path($config['root_path'], $config['admin_dir'], 'templates'));
             $this->setConfigDir(cms_join_path($config['root_path'], $config['admin_dir'], 'configs'));
             $this->registerResource('globalcontent', new CMSNullTemplateResource());
         }
     }
     $this->AddTemplateDir(cms_join_path($config['root_path'], 'lib', 'smarty', 'libs'));
     // Enable security object
     // Note: Buggy, disabled prior to release of CMSMS 1.11
     //$this->enableSecurity('CMSSmartySecurityPolicy');
 }
Example #13
0
 public function __construct()
 {
     parent::__construct();
     // enable security
     //$this->enableSecurity('My_Security_Policy');
     $this->registerPlugin('block', 'l', 'smarty_block_l');
     $this->php_handling = Smarty::PHP_ALLOW;
 }
Example #14
0
 /**
  * 继承Smarty并设置项目的属性
  */
 function __construct($charset = 'UTF-8', $cur_skin = 'default')
 {
     //Class Constructor. These automatically get set with each new instance.
     method_exists('Smarty', 'Smarty') && $this->Smarty() || parent::__construct();
     if (isset($cur_skin) && !empty($cur_skin)) {
         $this->_cur_skin = $cur_skin;
     } else {
         if (defined('VIEW_SKIN_CURRENT')) {
             $this->_cur_skin = VIEW_SKIN_CURRENT;
         } else {
             $this->_cur_skin = $this->_dft_skin;
         }
     }
     if (defined('VIEW_SKINS_ROOT')) {
         $this->_parent_dir = VIEW_SKINS_ROOT;
     } else {
         die("please set template skin dir first! ");
     }
     $this->template_dir = VIEW_SKINS_ROOT . $this->_cur_skin . '/';
     //echo $this->template_dir;
     //$this->use_sub_dirs = true;
     $this->compile_id = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'local') . '_' . $this->_cur_skin;
     $this->compile_dir = VIEW_COMPILE_DIR;
     $this->config_dir = VIEW_CONFIG_DIR;
     $this->plugins_dir = array(LIB_ROOT . 'function/smarty/plugins', SMARTY_DIR . '/plugins');
     // Smarty 的模板缓存,奇怪的设计,慎用
     //$this->cache_dir = VIEW_CACHE_DIR;
     //$this->cache_lifetime = defined('VIEW_CACHE_LIFETIME') ? VIEW_CACHE_LIFETIME : 1440;
     //$this->clear_all_cache();
     //$this->caching = defined('VIEW_CACHE_ENABLE') ? VIEW_CACHE_ENABLE : true;
     //$this->security = true;
     $this->use_sub_dirs = TRUE;
     //开启缓存目录分级
     $this->left_delimiter = '{%';
     $this->right_delimiter = '%}';
     $this->_charset = $charset;
     new Sp_View_Helper($this);
     $this->assign_by_ref('head_title', $this->_head_title);
     $this->assign_by_ref('head_keywords', $this->_head_keywords);
     $this->assign_by_ref('head_description', $this->_head_description);
     $this->assign_by_ref('head_links', $this->_head_links);
     $this->assign_by_ref('head_styles', $this->_head_styles);
     $this->assign_by_ref('head_scripts', $this->_head_scripts);
     $this->assign_by_ref('foot_scripts', $this->_foot_scripts);
     $this->assign_by_ref('charset', $this->_charset);
     defined('SP_URL_API') && $this->assign('SP_URL_API', SP_URL_API);
     //API  kong 增加
     defined('SP_URL_HOME') && $this->assign('SP_URL_HOME', SP_URL_HOME);
     defined('SP_URL_CSS') && $this->assign('SP_URL_CSS', SP_URL_CSS);
     defined('SP_URL_IMG') && $this->assign('SP_URL_IMG', SP_URL_IMG);
     defined('SP_URL_JS') && $this->assign('SP_URL_JS', SP_URL_JS);
     defined('SP_URL_STO') && $this->assign('SP_URL_STO', SP_URL_STO);
     defined('SP_URL_CS') && $this->assign('SP_URL_CS', SP_URL_CS);
     defined('SP_URL_UPLOAD') && $this->assign('SP_URL_UPLOAD', SP_URL_UPLOAD);
     defined('SP_URL_FILE') && $this->assign('SP_URL_FILE', SP_URL_FILE);
     defined('SP_DOMAIN_SUFFIX') && $this->assign('SP_DOMAIN_SUFFIX', SP_DOMAIN_SUFFIX);
     defined('DATA_TYPE') && $this->assign('DATA_TYPE', DATA_TYPE);
     $this->assign('COOKIE_DOMAIN', Request::genCookieDomain());
     // current request
     $this->_request = Request::current();
     $this->assign_by_ref('_request', $this->_request);
     is_null($this->_parent_dir) && ($this->_parent_dir = CONF_ROOT . 'templates/');
     if (is_dir($this->_parent_dir)) {
         $this->assign('parent_dir', $this->_parent_dir);
     } else {
         $this->assign('parent_dir', '');
     }
     $user = Sp_Account_User::current();
     if ($user->isLogin()) {
         $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status'));
         $this->assign('user', $user);
     }
     $this->assign('SP_COMPANY', SP_COMPANY);
     //公司名称
     $this->assign('SP_INVEST_COMPANY', SP_INVEST_COMPANY);
     //网站名称
     $this->default_template_handler_func = array($this, 'make_template');
 }