Code

Removed smarty packages from references
[gosa.git] / gosa-core / include / smarty / plugins / function.html_image.php
index 3f031dc00ed5ea948aeedd7aa68e10bf3b1a44e2..2f1ef6413c3780c9cdb415c7bab7972a22debcb6 100644 (file)
@@ -1,44 +1,43 @@
 <?php
 /**
-* Smarty plugin
-* 
-* @package Smarty
-* @subpackage PluginsFunction
-*/
+ * Smarty plugin
+ 
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
 
 /**
-* Smarty {html_image} function plugin
-* 
-* Type:     function<br>
-* Name:     html_image<br>
-* Date:     Feb 24, 2003<br>
-* Purpose:  format HTML tags for the image<br>
-* Examples: {html_image file="/images/masthead.gif"}
-* Output:   <img src="/images/masthead.gif" width=400 height=23>
-* 
-* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
-      (Smarty online manual)
-* @author Monte Ohrt <monte at ohrt dot com> 
-* @author credits to Duda <duda@big.hu> 
-* @version 1.0
-* @param array $params parameters
-* Input:<br>
-*          - file = file (and path) of image (required)
-*          - height = image height (optional, default actual height)
-*          - width = image width (optional, default actual width)
-*          - basedir = base directory for absolute paths, default
-*                      is environment variable DOCUMENT_ROOT
-*          - path_prefix = prefix for path output (optional, default empty)
-* @param object $smarty Smarty object
-* @param object $template template object
-* @return string 
-* @uses smarty_function_escape_special_chars()
-*/
-function smarty_function_html_image($params, $smarty, $template)
+ * Smarty {html_image} function plugin
+ 
+ * Type:     function<br>
+ * Name:     html_image<br>
+ * Date:     Feb 24, 2003<br>
+ * Purpose:  format HTML tags for the image<br>
+ * Examples: {html_image file="/images/masthead.gif"}<br>
+ * Output:   <img src="/images/masthead.gif" width=400 height=23><br>
+ * Params:
+ * <pre>
+ * - file        - (required) - file (and path) of image
+ * - height      - (optional) - image height (default actual height)
+ * - width       - (optional) - image width (default actual width)
+ * - basedir     - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
+ * - path_prefix - prefix for path output (optional, default empty)
+ * </pre>
+ * 
+ * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
+ *      (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com> 
+ * @author credits to Duda <duda@big.hu> 
+ * @version 1.0
+ * @param array                    $params   parameters
+ * @param Smarty_Internal_Template $template template object
+ * @return string 
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_image($params, $template)
 {
     require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
-    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
-
     $alt = '';
     $file = '';
     $height = '';
@@ -47,7 +46,7 @@ function smarty_function_html_image($params, $smarty, $template)
     $prefix = '';
     $suffix = '';
     $path_prefix = '';
-    $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+    $server_vars = $_SERVER;
     $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
     foreach($params as $_key => $_val) {
         switch ($_key) {
@@ -64,7 +63,7 @@ function smarty_function_html_image($params, $smarty, $template)
                 if (!is_array($_val)) {
                     $$_key = smarty_function_escape_special_chars($_val);
                 } else {
-                    throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
                 } 
                 break;
 
@@ -78,7 +77,7 @@ function smarty_function_html_image($params, $smarty, $template)
                 if (!is_array($_val)) {
                     $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                 } else {
-                    throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
                 } 
                 break;
         } 
@@ -108,8 +107,8 @@ function smarty_function_html_image($params, $smarty, $template)
                 return;
             } 
         } 
-        if ($template->security) {
-            if (!$smarty->security_handler->isTrustedResourceDir($_image_path)) {
+        if (isset($template->smarty->security_policy)) {
+            if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
                 return;
             } 
         } 
@@ -136,4 +135,4 @@ function smarty_function_html_image($params, $smarty, $template)
     return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix;
 } 
 
-?>
+?>
\ No newline at end of file