Example #1
0
 function getSmarty()
 {
     if ($this->smarty === NULL) {
         require_once 'Smarty/Smarty.class.php';
         $this->smarty = new Smarty();
         $this->smarty->template_dir = './templates';
         $this->smarty->plugins_dir = $this->smartyPluginDirs;
         $this->smarty->compile_dir = $this->getCompileDir();
         $this->smarty->clear_all_cache();
     }
     return $this->smarty;
 }
Example #2
0
 /**
  * Create a Smarty instance.
  *
  * @return \Smarty
  */
 public function createSmarty()
 {
     $base = dirname(dirname(dirname(dirname(__DIR__))));
     require_once 'Smarty/Smarty.class.php';
     $smarty = new Smarty();
     $smarty->template_dir = "{$base}/xml/templates";
     $smarty->plugins_dir = array("{$base}/packages/Smarty/plugins", "{$base}/CRM/Core/Smarty/plugins");
     $smarty->compile_dir = $this->getCompileDir();
     $smarty->clear_all_cache();
     // CRM-5308 / CRM-3507 - we need {localize} to work in the templates
     require_once 'CRM/Core/Smarty/plugins/block.localize.php';
     $smarty->register_block('localize', 'smarty_block_localize');
     return $smarty;
 }
 public function __construct($templateS, $formName = '', $viewerModuleName, $fieldData = array(), $invalidFields = array())
 {
     global $cfg;
     $this->template = new Smarty();
     $this->viewerModuleName = $viewerModuleName;
     if (isset($cfg['smarty']['debug']) && $cfg['smarty']['debug'] == true) {
         $this->template->clear_all_cache();
         $this->template->caching = false;
         $this->template->force_compile = true;
     }
     $this->template->compile_dir = $cfg['smarty']['compiledir'];
     //$this->template->template_dir = $cfg['smarty']['tplRoot'];
     $this->templateIDStack = $templateS;
     $this->formName = $formName;
     $this->fieldData = $fieldData;
     $this->invalidFields = $invalidFields;
     $this->templateFileName = MVCUtils::findTemplate(end($this->templateIDStack));
     //echo "#" . $this->templateFileName . "#<br>";
     if ($this->templateFileName === false) {
         throw new LoggedException("The template with ID " . end($this->templateIDStack) . " could not be found", 0, self::module, 'error');
     }
     $this->setupTemplate();
 }
 /**
  * Override the parent's clear_all_cache method to check if caching is on to begin with. We do this to prevent the
  * cache/MAKETHISDIRWRITABLE.txt from being deleted during test runs; this file needs to exist in order for the
  * cache directory to remain in the git repository.
  * @param int $expire_time
  */
 public function clear_all_cache($exp_time = null)
 {
     if ($this->caching == 1) {
         parent::clear_all_cache($exp_time);
     }
 }
Example #5
0
 public function ClearCacheAll($exp_time = null)
 {
     return parent::clear_all_cache($exp_time);
 }
Example #6
0
$temp_variaveis = explode("/", $_SERVER['PHP_SELF']);
$_SESSION['pastaAmbiente'] = $temp_variaveis[2];
$_SESSION['sistema'] = "Peladinha";
$_SESSION['sistemaInterface'] = "Peladinha";
// configuracao do smarty
require 'bibliotecas/smarty/libs/Smarty.class.php';
$smarty = new Smarty();
function smarty_block_dynamic($param, $content, &$smarty)
{
    return $content;
}
$smarty->compile_dir = "./html/tmp";
$smarty->caching = true;
$smarty->cache_lifetime = 86400;
$smarty->allow_php_tag = true;
$smarty->clear_all_cache();
$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
$smarty->template_dir = dirname(__FILE__) . '/html/';
// adicionando as variaveis globais para usar nos templates
$smarty->assign('globals', $GLOBALS);
$_POST["d"] = "index";
$_POST["a"] = "index";
$_POST["f"] = "logado";
// criando as variaveis, atribuindo $_GET para uma $var apenas para nao ficar usando o $_GET toda hora
$d = isset($_REQUEST["d"]) ? $_REQUEST["d"] : $_POST["d"];
$a = isset($_REQUEST["a"]) ? $_REQUEST["a"] : $_POST["a"];
$f = isset($_REQUEST["f"]) ? $_REQUEST["f"] : $_POST["f"];
// se nao estiver com as variaveis requeridas, ele redireciona
if (!isset($d) && !isset($a) && !isset($f)) {
    require_once 'redirect.php';
}
Example #7
0
function pathos_template_clear($type = SYS_TEMPLATE_CLEAR_ALL)
{
    if (DISPLAY_CACHE) {
        $s = new Smarty();
        if ($type == SYS_TEMPLATE_CLEAR_ALL) {
            $s->cache_dir = BASE . "cache";
            $s->clear_all_cache();
            $__oldumask = umask(0);
            mkdir(BASE . "cache/sessions", 0777);
            umask($__oldumask);
            #chmod(BASE."cache/session",0777);
        } else {
            $s->cache_dir = BASE . "cache/sessions";
            $s->clear_all_cache();
        }
    }
}
require_once "classes/Generator.php";
require_once "projectGenUtils.inc";
require_once "smarty/Smarty.class.php";
//
// Initialization
//
$g_cwd = realpath(dirname($_SERVER['PHP_SELF']));
echo "   CWD = " . $g_cwd . "\n";
//
// Load, instantiate, and configure the smarty template engine.
//
echo "   - Loading Smarty...\n";
$tpl = new Smarty();
$tpl->template_dir = $g_cwd . "/templates";
$tpl->compile_dir = $g_cwd . "/templates_c";
$tpl->clear_all_cache();
// By default we assume that the root of the Torque SDK
// is located two folders up from the CWD.  That is unless
// another path is passed in the command line.
$torqueRoot = "../..";
if ($argc >= 3) {
    $torqueRoot = str_replace("\\", "/", $argv[2]);
}
// Kick off the generator
T3D_Generator::init($torqueRoot);
// Ready to read our config file.
echo "   - Loading config file " . realpath($argv[1]) . "\n";
require $argv[1];
// Generate all projects
T3D_Generator::generateProjects($tpl);
// Now the solutions (if any)
Example #9
0
    $createSmarty->cache_lifetime = 5;
    // seconds; 3600= 1 hr, 86400=24 hours
    $createSmarty->use_sub_dirs = true;
    $createSmarty->clear_all_cache();
}
if (defined('IN_EVENTS')) {
    $eventSmarty = new Smarty();
    $eventSmarty->template_dir = FILE_PATH . '/templates/' . CURRENT_TEMPLATE . '/events/';
    $eventSmarty->compile_dir = PATH_TO_LIBS . '/smarty/templates_c/events/';
    $eventSmarty->config_dir = PATH_TO_LIBS . '/smarty/configs/events/';
    $eventSmarty->cache_dir = PATH_TO_LIBS . '/smarty/cache/events/';
    $eventSmarty->caching = 0;
    $eventSmarty->cache_lifetime = 5;
    // seconds; 3600= 1 hr, 86400=24 hours
    $eventSmarty->use_sub_dirs = true;
    $eventSmarty->clear_all_cache();
}
//  Session stuff
session_name(SESSION_NAME);
session_start();
//  Other important functions
function getTemplate($thisPageName)
{
    $pageNameArray = explode('.', $thisPageName);
    return $pageNameArray[0] . '.tpl';
}
function __autoload($classname)
{
    $path = FILE_PATH . '/core/';
    $classPath = $path . 'class.' . $classname . '.php';
    require_once $classPath;
Example #10
0
 /**
  * Clears both the end-user and admin template caches.
  */
 function clearSmartyCaches()
 {
     global $templates_compiledir;
     $smarty = new Smarty();
     $smarty->compile_dir = $templates_compiledir;
     $smarty->clear_all_cache();
     $smarty->clear_compiled_tpl();
     $src = "<?php\r\nheader(\"Location: ../index.php\");";
     file_put_contents($templates_compiledir . "/index.php", $src);
     unset($src);
 }