/**
  * Construct the object
  * 
  * @param Exception The exception to be made user friendly
  */
 public function __construct($exception)
 {
     global $cfg;
     $this->template = new Smarty();
     $this->template->compile_dir = $cfg['smarty']['compiledir'];
     $this->exception = $exception;
     $this->templateFileName = MVCUtils::findTemplate($cfg['smarty']['RenderedexceptionTemplateFile']);
     $this->_setupTemplate();
 }
 public static function smarty_resource_rfile_timestamp($templateName, &$timestamp, &$smarty)
 {
     global $cfg;
     $file = MVCUtils::findTemplate($templateName);
     if ($file === false) {
         return false;
     } else {
         return true;
     }
 }
 public function isValid(&$data)
 {
     global $cfg;
     $db = Database::getInstance($cfg['MVC']['dsn']);
     $data = $db->quoteSmart($data);
     $exists = $db->getOne("SELECT COUNT(*) FROM templates WHERE filename = {$data}");
     if ($exists > 0) {
         return 'The specified template is already in use';
     } elseif (MVCUtils::findTemplate($data) === false) {
         return 'The specified template does not exist';
     } else {
         return true;
     }
 }
Ejemplo n.º 4
0
 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();
 }