Esempio n. 1
0
define( 'DEBUG_CALENDAR_LOG', $config['debug_calendar'] );
define( 'MEMCACHED_ENABLED', $config['memcached'] );
define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define( 'TIME_ZONE', $config['time_zone'] );

define ('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : '******');

// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];

//to do: make different environments.  sys

//check if it is a installation instance
if (! defined( 'PATH_C' )) {
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
define( 'PATH_C', (rtrim( Bootstrap::sys_get_temp_dir(), PATH_SEP ) . PATH_SEP) );
define( 'PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' );
}

//Load filter class
$skinPathErrors = G::skinGetPathToSrcByVirtualUri("errors", $config);
$skinPathUpdate = G::skinGetPathToSrcByVirtualUri("update", $config);

// defining Virtual URLs
$virtualURITable = array ();
$virtualURITable['/plugin/(*)'] = 'plugin';
$virtualURITable['/(sys*)/(*.js)'] = 'jsMethod';
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/';

if (defined( 'PATH_C' )) {
 /**
  * render a smarty template
  *
  * @author Erik Amaru Ortiz <*****@*****.**>
  * @param $template string
  *        	containing the template filename on /gulliver/templates/
  *        	directory
  * @param $data associative
  *        	array containig the template data
  */
 public function renderTemplate($template, $data = array())
 {
     if (!defined('PATH_THIRDPARTY')) {
         throw new Exception('System constant (PATH_THIRDPARTY) is not defined!');
     }
     require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
     $fInfo = pathinfo($template);
     $tplExists = true;
     // file has absolute path
     if (substr($template, 0, 1) != PATH_SEP) {
         $template = PATH_TEMPLATE . $template;
     }
     // fix for template that have dot in its name but is not a valid
     // extension
     if (isset($fInfo['extension']) && ($fInfo['extension'] != 'tpl' || $fInfo['extension'] != 'html')) {
         unset($fInfo['extension']);
     }
     if (!isset($fInfo['extension'])) {
         if (file_exists($template . '.tpl')) {
             $template .= '.tpl';
         } elseif (file_exists($template . '.html')) {
             $template .= '.html';
         } else {
             $tplExists = false;
         }
     } else {
         if (!file_exists($template)) {
             $tplExists = false;
         }
     }
     if (!$tplExists) {
         throw new Exception("Template: {$template}, doesn't exist!");
     }
     $smarty = new Smarty();
     $smarty->compile_dir = Bootstrap::sys_get_temp_dir();
     $smarty->cache_dir = Bootstrap::sys_get_temp_dir();
     $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
     $smarty->template_dir = PATH_TEMPLATE;
     $smarty->force_compile = true;
     foreach ($data as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->display($template);
 }
Esempio n. 3
0
 /**
  * render a smarty template
  *
  * @author Erik Amaru Ortiz <*****@*****.**>
  * @param $template string
  *        	containing the template filename on /gulliver/templates/
  *        	directory
  * @param $data associative
  *        	array containig the template data
  */
 public static function renderTemplate($template, $data = array())
 {
     if (!defined('PATH_THIRDPARTY')) {
         throw new Exception('System constant (PATH_THIRDPARTY) is not defined!');
     }
     require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
     // file has absolute path
     if (substr($template, 0, 1) != PATH_SEP) {
         $template = PATH_TEMPLATE . $template;
     }
     if (!file_exists($template)) {
         throw new Exception("Template: {$template}, doesn't exist!");
     }
     $smarty = new Smarty();
     $smarty->compile_dir = Bootstrap::sys_get_temp_dir();
     $smarty->cache_dir = Bootstrap::sys_get_temp_dir();
     $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
     $smarty->template_dir = PATH_TEMPLATE;
     $smarty->force_compile = true;
     foreach ($data as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->display($template);
 }