/** * Override Smarty::_read_file * Read template email from database * * @param string $filename * @return string|bool Return false if not found */ function _read_file($filename) { // if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) { // $contents = ''; // while (!feof($fd)) { // $contents .= fread($fd, 8192); // } // fclose($fd); // return $contents; // } else { // return false; // } // echo $filename . "<hr/>HERE";die; $objMail = new Objects_Mail(); if (Vi_Registry::isRegistered('emailLangCode')) { $langCode = Vi_Registry::get('emailLangCode'); } else { $langCode = Vi_Registry::getLangCode(); } $template = $objMail->getMailTemplate($filename, $langCode); if (null == $template) { return false; } else { return $template['content']; } }
public function __construct($params) { if (Vi_Registry::isRegistered('EDIT_LAYOUT_MODE')) { $this->_sampleMode = Vi_Registry::get('EDIT_LAYOUT_MODE'); } $this->_name = $params['name']; if (isset($params['title'])) { $this->_title = $params['title']; $this->_holderId = $params['holder_id']; } $this->_params = $params; $view = Vi_Layout::getMvcInstance()->getView(); $this->view = clone $view; $this->db = Vi_Registry::get('db'); $this->session = Vi_Registry::getSession(); $this->auth = Vi_Registry::getAuth(); $this->aclFront = Vi_Registry::getAclFront(); $this->aclAdmin = Vi_Registry::getAclAdmin(); $this->view->setEngine(clone $view->getEngine()); $this->_langCode = Vi_Language::getCurrentLangCode(); $config = Vi_Registry::getConfig(); $this->_compileDir = $config['viewConfig']['compile_dir']; $this->_cacheDir = $config['viewConfig']['cache_dir']; /* * set up dir for smarty * 'template_dir' => 'stickers/$stickerName', 'compile_dir' => 'tmp/compile/stickers/$stickerName/$langCode', 'cache_dir' => 'tmp/cache/stickers/$stickerName/$langCode', */ $this->view->setScriptPath('./'); $this->view->setCompilePath($config['viewConfig']['compile_dir']); $this->view->setCachePath($config['viewConfig']['cache_dir']); /* * call main funtion */ $this->_saveInfo['currentType'] = Vi_Language::$currentType; $this->_saveInfo['currentName'] = Vi_Language::$currentName; Vi_Language::$currentType = Vi_Language::TYPE_STICKER; Vi_Language::$currentName = $this->_name; $this->view->STICKER_URL = Vi_Registry::getBaseUrl() . "stickers/{$this->_name}/"; $this->view->HELPER_URL = $this->view->STICKER_URL . 'helpers/'; $this->init(); $this->run(); }
/** * Change alias name to module name in URI * * @return void * @throws Exception if module's alias point to empty module's name */ public function changeAliasToModuleName() { $appBaseUrl = Vi_Registry::get('APP_BASE_URL'); $params = substr($_SERVER['REQUEST_URI'], strlen($appBaseUrl)); $params = explode('/', trim($params, '/')); $alias = $params[0]; if (null == $alias) { return null; } else { if (Vi_Registry::isRegistered('moduleAliases')) { $moduleAliases = @Vi_Registry::get('moduleAliases'); if (!array_key_exists($alias, $moduleAliases)) { return null; } $module = $moduleAliases[$alias]; if (null == $module) { throw new Exception("Module's alias ({$alias}) point to empty module's name"); } $params[0] = $module; $params = implode('/', $params); $_SERVER['REDIRECT_URL'] = $appBaseUrl . $params; $_SERVER['REQUEST_URI'] = $appBaseUrl . $params; } } // /** // * Reset server params // */ // echo '<pre>';print_r($_SERVER); // $params = implode('/', $params); // $_SERVER['REDIRECT_URL'] = $appBaseUrl . $params; // $_SERVER['REQUEST_URI'] = $appBaseUrl . $params; // echo '<pre>';print_r($_SERVER);die; }
public static function getAclAdmin() { if (Vi_Registry::isRegistered('aclAdmin')) { return Vi_Registry::get('aclAdmin'); } else { return null; } }
public function getData() { if ($this->_data != "") { $this->preHolderContent = str_replace('{name}', $this->_name, $this->preHolderContent); if (isset($this->_params['customClass'])) { $this->preHolderContent = str_replace('{class}', $this->_params['customClass'], $this->preHolderContent); } else { $this->preHolderContent = str_replace('{class}', "", $this->preHolderContent); } $this->postHolderContent = str_replace('{name}', $this->_name, $this->postHolderContent); $this->_data = $this->preHolderContent . $this->_data . $this->postHolderContent; } $editLayoutMode = false; if (Vi_Registry::isRegistered('EDIT_LAYOUT_MODE')) { $editLayoutMode = Vi_Registry::get('EDIT_LAYOUT_MODE'); } if ($editLayoutMode && $this->_name != "allstickers") { $this->preHolderContent = str_replace('{name}', $this->_name, $this->preHolderContent); $this->postHolderContent = str_replace('{name}', $this->_name, $this->postHolderContent); $this->_data = $this->preHolderContent . $this->_data . $this->postHolderContent; } return $this->_data; }