Ejemplo n.º 1
0
 protected static function getFinalTemplateName($template, $module_file = null)
 {
     if (!isset($module_file)) {
         $module_file = self::getModuleAndTemplate($template);
     }
     if (($template_name = Caspar::getI18n()->hasTranslatedTemplate($template, true)) === false) {
         $template_name = \CASPAR_MODULES_PATH . $module_file['module'] . DS . 'templates' . DS . "_{$module_file['file']}.inc.php";
     }
     return $template_name;
 }
Ejemplo n.º 2
0
 /**
  * Sanitize a string
  *
  * @param string $string The string to sanitize
  *
  * @return string the sanitized string
  */
 protected function __sanitize_string($string)
 {
     try {
         $charset = class_exists('Caspar') ? Caspar::getI18n()->getCharset() : 'utf-8';
     } catch (Exception $e) {
         $charset = 'utf-8';
     }
     return htmlspecialchars($string, ENT_QUOTES, $charset);
 }
Ejemplo n.º 3
0
 /**
  * Forward the user with HTTP status code 403 and an (optional) message
  * based on a boolean check
  * 
  * @param boolean $condition
  * @param string $message[optional] The message
  */
 public function forward403unless($condition, $message = null)
 {
     if (!$condition) {
         $message = $message === null ? Caspar::getI18n()->__("You are not allowed to access to this page") : $message;
         $this->getResponse()->setHttpStatus(403);
         $this->message = $message;
         $this->getResponse()->setTemplate('main/forbidden');
     }
 }